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: Tue, 1 Mar 2011 16:42:32 +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 #10 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-03-01 16:42:26 UTC ---
(In reply to comment #9)
> On Tue, 1 Mar 2011, d.g.gorbachev at gmail dot com wrote:
>
> > > The problem is that statics need to be mangled, so they persist
> > > as i.1234 instead. Really refering to a local symbol in asm is
> > > going to be difficult with LTO (any global or other static symbol
> > > with name i will cause a non-resolvable conflict).
> >
> > One solution is to introduce a new attribute, say "nomangle", and shift
> > responsibility for possible conflicts on a user.
>
> The original LTO proposal included assembler changes to allow multiple
> local symbols with the same name in the output. You could resurrect that,
> though allowing references to the multiple local symbols from asm imposes
> extra requirements on what the assembler interface must look like
> (directives to say which versions are being referred to by asms in a
> particular part of the input?).
I think we settled on the idea to delay mangling of local symbols until after
we composed ltrans units (so we can also compose units in a way to avoid
the need to mangle local symbols with a used attribute). It shouldn't be
too difficult to implement but sofar nobody has done the work (and it
will likely be easier with a global symbol table which we hopefully will
get for 4.7).