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: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 2 Mar 2011 16:42:17 +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 #16 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-03-02 16:42:02 UTC ---
(In reply to comment #15)
> (In reply to comment #14)
> > Ah, the reason for writting reply was primarily the observation that enforcing
> > partitioning based on origin of asm statement won't fly with crossmoudle
> > inlining, so I think it is quite useless complication of the whole thing.
>
> 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 ...
>
> Of course that's the same end-result as if the user would compile the
> unit without -flto.
>
> Not sure if it's worth going that way though.
>
> > 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))).
Of course if there is a conflict with a global (non-local) decl then
the asm will bogously pick that up. So either way isn't bullet-proof.
Richard.