Fix crtstuff.c wrt used/unused attrs

Jan Hubicka hubicka@ucw.cz
Sun May 9 16:43:00 GMT 2010


> On Sun, May 9, 2010 at 4:30 PM, Jan Hubicka <hubicka@ucw.cz> wrote:
> > Hi,
> > my unused variable/function removal patch cause us to remove unused vars with
> > -fno-toplevel-reorder.  I am not sure if we want to do this (i.e. we can just
> > disable the feature for toplevel-reorder), but it is valid optimization.
> >
> > This breaks bootstrap because crtstuff is decorating constructor arrays as
> > unused rather than used (because it was written before used attribute was
> > introduced for variables).  I think this should be fixed in any case.  We can
> > decide on -fno-toplevel-reorder behaviour later based on if glibc/kernel breaks
> > with removal too or not.
> >
> > Bootstrapped/regtested x86_64-linux, OK?
> 
> Ok.  Btw, we can still end up mangling local statics with used attribute,
> IMHO we need to avoid doing that.

For LTO, yes.  I think we should avoid mangling when possible.  Also I think
with -fwhole-program we should still be bringing variables static (unless
marked externally_visible) but never mangle them (there will never be conflict)

I guess we can get around by disabling mangling when there are no conflicts
overall.  It will save some effort in assembly output.

Thanks,
Honza



More information about the Gcc-patches mailing list