This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug lto/43038] DECL_PRESERVE_P or attribute((used)) static globals not completely preserved with -flto
- From: "hubicka at ucw dot cz" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 2 Mar 2011 16:56:57 +0000
- Subject: [Bug lto/43038] DECL_PRESERVE_P or attribute((used)) static globals not completely preserved with -flto
- Auto-submitted: auto-generated
- References: <bug-43038-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43038
--- Comment #17 from Jan Hubicka <hubicka at ucw dot cz> 2011-03-02 16:56:47 UTC ---
> Well, with a used global local decl I would just leave the unit alone,
> doing a 1:1 partition for it (not mangling it). That way we can even
> handle multiple conflicting used declared statics ...
Well, you would not only require 1:1 partition but prevent inliing functions
containing asm statements posisbly referring used global local decl to
other units.
> Not sure if it's worth going that way though.
I would preffer we do not. It is ugly.
>
> > Also the not mangling unless we hit conflict probably should be implemented
> > in a way that when conflict exists all static of same name are renamed, so
> > asm statements won't compile rather that end up referring random other
> > variable.
>
> Yes (assuming people forgot to annotate vars with attribute((used))).
I think this won't help, since alias analysis, readonly var discovery and
others
will stand in the way and break code on random basis. Main benefit IMO is to
reduce the symbol tables and make nm output more readable etc.
> We should also consider mangling them according to the function
> or TU context, also for easier debugging. Not sure if this is possible
> without running into target limitations though.
You mean something like mylocalstatic.mysourcefile.c? Possibly, it would make
names noticeably longer obviously.
Honza