On Mon, 9 Dec 2019 13:19:22 +0100
Tobias Burnus <tob...@codesourcery.com> wrote:

> Hi, I see now the following error:
> 
> …/libgcc/crtstuff.c:372:52: error: operator '||' has no right operand
>    372 |   || USE_TM_CLONE_REGISTRY || USE_EH_FRAME_REGISTRY
>        |                                                    ^
> /net/build5-trusty-cs/scratch/tburnus/mainline-nv/src/gcc-mainline/libgcc/crtstuff.c:254:17:
>  warning: '__DTOR_LIST__' defined but not used [-Wunused-variable]
>    254 | STATIC func_ptr __DTOR_LIST__[1]
>        |                 ^~~~~~~~~~~~~
> Makefile:1038: recipe for target 'crtbeginT.o' failed
> 
> Cheers,
> 
> Tobias

Sorry, I need to change that to defined(USE_EH_FRAME_REGISTRY). Committing
shortly.

Thanks,
Jozef

> 
> On 11/6/19 5:17 PM, Jozef Lawrynowicz wrote:
> > __do_global_dtors_aux in crtstuff.c will not do anything meaningful if:
> >   * crtstuff.c is not being compiled for use in a shared library
> >   * the target uses .{init,fini}_array sections
> >   * TM clone registry is disabled
> >   * EH frame registry is disabled
> >
> > The attached patch prevents it from being defined at all if all the above
> > conditions are true. This saves code size in the final linked executable.
> >
> > 0002-libgcc-Dont-define-__do_global_dtors_aux-if-it-will-.patch
> >
> >  From 967262117f0c838fe8a9226484bf6e014c86f0ba Mon Sep 17 00:00:00 2001
> > From: Jozef Lawrynowicz<joze...@mittosystems.com>
> > Date: Tue, 29 Oct 2019 13:02:08 +0000
> > Subject: [PATCH 2/3] libgcc: Dont define __do_global_dtors_aux if it will be
> >   empty
> >
> > libgcc/ChangeLog:
> >
> > 2019-11-06  Jozef Lawrynowicz<joze...@mittosystems.com>
> >
> >     * crtstuff.c (__do_global_dtors_aux): Wrap in #if so it's only defined
> >     if it will have contents.
> >
> > ---
> >   libgcc/crtstuff.c | 9 ++++++++-
> >   1 file changed, 8 insertions(+), 1 deletion(-)
> >
> > diff --git a/libgcc/crtstuff.c b/libgcc/crtstuff.c
> > index 9a3247b7848..0b0a0b865fe 100644
> > --- a/libgcc/crtstuff.c
> > +++ b/libgcc/crtstuff.c
> > @@ -368,8 +368,12 @@ extern void __cxa_finalize (void *) 
> > TARGET_ATTRIBUTE_WEAK;
> >      On some systems, this routine is run more than once from the .fini,
> >      when exit is called recursively, so we arrange to remember where in
> >      the list we left off processing, and we resume at that point,
> > -   should we be re-invoked.  */
> > +   should we be re-invoked.
> >   
> > +   This routine does not need to be run if none of the following clauses 
> > are
> > +   true, as it will not do anything, so can be removed.  */
> > +#if defined(CRTSTUFFS_O) || !defined(FINI_ARRAY_SECTION_ASM_OP) \
> > +  || USE_TM_CLONE_REGISTRY || USE_EH_FRAME_REGISTRY
> >   static void __attribute__((used))
> >   __do_global_dtors_aux (void)
> >   {
> > @@ -455,6 +459,9 @@ __do_global_dtors_aux_1 (void)
> >   CRT_CALL_STATIC_FUNCTION (__LIBGCC_INIT_SECTION_ASM_OP__,
> >                       __do_global_dtors_aux_1)
> >   #endif
> > +#endif /* defined(CRTSTUFFS_O) || !defined(FINI_ARRAY_SECTION_ASM_OP)
> > +  || defined(USE_TM_CLONE_REGISTRY) || defined(USE_EH_FRAME_REGISTRY) */
> > +
> >   
> >   #if USE_EH_FRAME_REGISTRY || USE_TM_CLONE_REGISTRY
> >   /* Stick a call to __register_frame_info into the .init section.  For some
> > -- 2.17.1  

Reply via email to