From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 36157 invoked by alias); 12 Jul 2019 06:06:42 -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 36149 invoked by uid 89); 12 Jul 2019 06:06:42 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-14.0 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SEM_URI,SEM_URIRED,SPF_PASS autolearn=ham version=3.3.1 spammy=gun, sk:christo, U*christophe.lyon X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.110.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 12 Jul 2019 06:06:41 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8D2F0337; Thu, 11 Jul 2019 23:06:39 -0700 (PDT) Received: from localhost (e121540-lin.manchester.arm.com [10.32.98.39]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 95A083F59C; Thu, 11 Jul 2019 23:08:36 -0700 (PDT) From: Richard Sandiford To: Christophe Lyon Mail-Followup-To: Christophe Lyon ,, richard.sandiford@arm.com Cc: Subject: Re: [ARM/FDPIC v5 05/21] [ARM] FDPIC: Fix __do_global_dtors_aux and frame_dummy generation References: <20190515124006.25840-1-christophe.lyon@st.com> <20190515124006.25840-6-christophe.lyon@st.com> Date: Fri, 12 Jul 2019 06:49:00 -0000 In-Reply-To: <20190515124006.25840-6-christophe.lyon@st.com> (Christophe Lyon's message of "Wed, 15 May 2019 14:39:30 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-SW-Source: 2019-07/txt/msg00927.txt.bz2 Christophe Lyon writes: > 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. > > 2019-XX-XX Christophe Lyon > Micka=C3=ABl Gu=C3=AAn=C3=A9 > > * libgcc/crtstuff.c: Add support for FDPIC. > > Change-Id: I0bc4b1232fbf3c69068fb23a1b9cafc895d141b1 > > diff --git a/libgcc/crtstuff.c b/libgcc/crtstuff.c > index 4927a9f..159b461 100644 > --- a/libgcc/crtstuff.c > +++ b/libgcc/crtstuff.c > @@ -429,9 +429,18 @@ __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" > + " .align 2\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)))) > =3D { __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) It'd be good to avoid hard-coding the pointer size. Would it work to do: __asm__("\t.equ\.t__do_global_dtors_aux_alias, __do_global_dtors_aux\n"); extern char __do_global_dtors_aux_alias; static void *__do_global_dtors_aux_fini_array_entry[] __attribute__ ((__used__, section(".fini_array"), aligned(sizeof(void *)= ))) =3D { &__do_global_dtors_aux_alias }; ? Similarly for the init_array. AFAICT this and 02/21 are the only patches that aren't Arm-specific, is that right? Thanks, Richard