From patchwork Fri Jul 13 16:11:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Christophe Lyon X-Patchwork-Id: 141920 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp988764ljj; Fri, 13 Jul 2018 09:13:57 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcaxlzfsWay8zqxru24oM6xutGS2sQeH1oEEGiDbTMFgQLrV6lqKRd7v25c4/26CVk+IpOe X-Received: by 2002:a65:6455:: with SMTP id s21-v6mr6505638pgv.394.1531498437646; Fri, 13 Jul 2018 09:13:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531498437; cv=none; d=google.com; s=arc-20160816; b=U98XcCAXpZsnOpMZPRAFEz53WwBVAZKcJKnkUipb3KehZKq9hhNem9Eae9ClpGuUxH 8iF7hbrD6NgF9qlQ4Y1RImStLiTJdDcuWsxOvtGxkkVW/LUvzMecDXBTjthJWMQOcGiL xuytYL9MWx3hO6d6UaAKGAc8EjPt9EMXQeWbQwcHf4Tege5FVu6qc19hhW64U/tPw/nn m9XYgGfWOouwlQEH7ed/ZPWQfq96ZhDhHVrZ2tC5hjJw8f0VKrFdGXTdde19wnsInu0L /fAKRR347HvbVYA2FmFMGvBJ16yvgvJLI2Hzl3ay/qWs5TnqEr2z/oEIKcYeQNHPpmyq 4quw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:delivered-to:sender:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :mailing-list:dkim-signature:domainkey-signature :arc-authentication-results; bh=KuP9OV70CwpyjzI3rrMZkNQc61knW9Nkd538YR6NWKM=; b=S9TiFW8jRdv6jYjcf7o/yZWWPFes86k6idcWldJccW9OS1yD0rFCcakRjdQIACVPS+ 20SnvTdRhIjgnLE8EM/r5x0K00DizvI8G05pJt4Qpr/4GUpWaEMdCqBs/PkQkR9guE7q mHq/36GXFMHZnTulVS1uKem/17D2ngSmyMQK07rZITZcnYrCFtS4/hh338VRfLG4C/ty 67bzSMcjfvFvh24jaHP+AofLSgDedsi7ccEX9axdCeDUKYQbWkhcf5F6Cw/vHMbaeQ9x WECbf3+Uhh9Kw9RuLwn7YJyP9ux4Nj+WEwBtcxg1Dz6+9rqy+ySiKswa+MhgTXIdKEJl /iqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="KC/2ccxI"; spf=pass (google.com: domain of gcc-patches-return-481515-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="gcc-patches-return-481515-patch=linaro.org@gcc.gnu.org" Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id e39-v6si24010732plg.168.2018.07.13.09.13.57 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Jul 2018 09:13:57 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-481515-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="KC/2ccxI"; spf=pass (google.com: domain of gcc-patches-return-481515-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="gcc-patches-return-481515-patch=linaro.org@gcc.gnu.org" DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; q=dns; s= default; b=H8EKvakF2YhWfhQklxGzj7E/P4kFmhF4OhAY6NesoW/RMjyFnXPMY gJ5FvXS8NBaAkrqwWgVOM7P4Wxuc/FfCFz43jPrNI57doxuO780gfCTbZ87MG516 WhAEImq/eeKI6yduyAt05wbaVb/mQJoMHfTbFQSCC206jwjL7GUgTU= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; s=default; bh=3ASBi+8MeQc8uPCPJcvP8s98hwA=; b=KC/2ccxI8BJEAKQMcC6NeKk2RoFa CbDR+gRwrPosFmHGwKYY1qSEZ2dhVD2Bb3fmr4K0aiOnR8jEPNnJ5/jRQJG4B3mR h38F7AsF1DpvA6dcOzgX1Jdx5CMDUuwG5EjWxtwWxIcm++YFnp7D9o9MqQ7Fv+SH d4u3CncfrFpVBto= Received: (qmail 20825 invoked by alias); 13 Jul 2018 16:13:45 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 20816 invoked by uid 89); 13 Jul 2018 16:13:44 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-27.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1940, HContent-Transfer-Encoding:8bit X-HELO: mx07-00178001.pphosted.com Received: from mx07-00178001.pphosted.com (HELO mx07-00178001.pphosted.com) (62.209.51.94) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 13 Jul 2018 16:13:43 +0000 Received: from pps.filterd (m0046668.ppops.net [127.0.0.1]) by mx07-.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id w6DG8fPt026684; Fri, 13 Jul 2018 18:13:41 +0200 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 2k6vcm0s3w-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 13 Jul 2018 18:13:41 +0200 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 97D7431; Fri, 13 Jul 2018 16:13:40 +0000 (GMT) Received: from Webmail-eu.st.com (sfhdag5node1.st.com [10.75.127.13]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 85966A6AB; Fri, 13 Jul 2018 16:13:40 +0000 (GMT) Received: from gnb.st.com (10.75.127.48) by SFHDAG5NODE1.st.com (10.75.127.13) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Fri, 13 Jul 2018 18:13:39 +0200 From: To: CC: Subject: [ARM/FDPIC v2 05/21] [ARM] FDPIC: Fix __do_global_dtors_aux and frame_dummy generation Date: Fri, 13 Jul 2018 18:11:00 +0200 Message-ID: <20180713161136.29104-6-christophe.lyon@st.com> In-Reply-To: <20180713161136.29104-1-christophe.lyon@st.com> References: <20180713161136.29104-1-christophe.lyon@st.com> MIME-Version: 1.0 X-IsSubscribed: yes From: Christophe Lyon In FDPIC, we need to make sure __do_global_dtors_aux and frame_dummy are referenced by their address, not by pointers to the function descriptors. 2018-XX-XX Christophe Lyon Mickaël Guêné * libgcc/crtstuff.c: Add support for FDPIC. Change-Id: Iff3aec3815e8ebd87276c0107752f00908a22100 -- 2.6.3 diff --git a/libgcc/crtstuff.c b/libgcc/crtstuff.c index d81c527..ad40719 100644 --- a/libgcc/crtstuff.c +++ b/libgcc/crtstuff.c @@ -429,9 +429,17 @@ __do_global_dtors_aux (void) #ifdef FINI_SECTION_ASM_OP CRT_CALL_STATIC_FUNCTION (FINI_SECTION_ASM_OP, __do_global_dtors_aux) #elif defined (FINI_ARRAY_SECTION_ASM_OP) +#if defined(__FDPIC__) +__asm__( + " .section .fini_array\n" + " .word __do_global_dtors_aux\n" +); +asm (TEXT_SECTION_ASM_OP); +#else /* defined(__FDPIC__) */ static func_ptr __do_global_dtors_aux_fini_array_entry[] __attribute__ ((__used__, section(".fini_array"), aligned(sizeof(func_ptr)))) = { __do_global_dtors_aux }; +#endif /* defined(__FDPIC__) */ #else /* !FINI_SECTION_ASM_OP && !FINI_ARRAY_SECTION_ASM_OP */ static void __attribute__((used)) __do_global_dtors_aux_1 (void) @@ -473,9 +481,17 @@ frame_dummy (void) #ifdef __LIBGCC_INIT_SECTION_ASM_OP__ CRT_CALL_STATIC_FUNCTION (__LIBGCC_INIT_SECTION_ASM_OP__, frame_dummy) #else /* defined(__LIBGCC_INIT_SECTION_ASM_OP__) */ +#if defined(__FDPIC__) +__asm__( + " .section .init_array\n" + " .word frame_dummy\n" +); +asm (TEXT_SECTION_ASM_OP); +#else /* defined(__FDPIC__) */ static func_ptr __frame_dummy_init_array_entry[] __attribute__ ((__used__, section(".init_array"), aligned(sizeof(func_ptr)))) = { frame_dummy }; +#endif /* defined(__FDPIC__) */ #endif /* !defined(__LIBGCC_INIT_SECTION_ASM_OP__) */ #endif /* USE_EH_FRAME_REGISTRY || USE_TM_CLONE_REGISTRY */