From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 129746 invoked by alias); 12 Oct 2018 11:03:10 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 129726 invoked by uid 89); 12 Oct 2018 11:03:09 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.2 spammy=HContent-Transfer-Encoding:8bit X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 12 Oct 2018 11:03:08 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7B817EBD; Fri, 12 Oct 2018 04:03:05 -0700 (PDT) Received: from e120077-lin.cambridge.arm.com (e120077-lin.cambridge.arm.com [10.2.206.194]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 832863F5B7; Fri, 12 Oct 2018 04:03:04 -0700 (PDT) Subject: Re: [ARM/FDPIC v3 05/21] [ARM] FDPIC: Fix __do_global_dtors_aux and frame_dummy generation To: Christophe Lyon , gcc-patches@gcc.gnu.org, ian@airs.com Cc: christophe.lyon@linaro.org References: <20181011133518.17258-1-christophe.lyon@st.com> <20181011133518.17258-6-christophe.lyon@st.com> From: "Richard Earnshaw (lists)" Openpgp: preference=signencrypt Message-ID: <6599c145-e040-5c7c-7913-17099178affa@arm.com> Date: Fri, 12 Oct 2018 11:29:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20181011133518.17258-6-christophe.lyon@st.com> Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 8bit X-SW-Source: 2018-10/txt/msg00744.txt.bz2 On 11/10/18 14:34, Christophe Lyon wrote: > 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. > This looks a little bit hacky; and since it's to a generic file I'd like a second opinion from the libgcc maintainer. At the very least, don't you need an alignment directive before the entries? R. > Change-Id: Iff3aec3815e8ebd87276c0107752f00908a22100 > > 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 */ > >