This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug lto/43038] DECL_PRESERVE_P or attribute((used)) static globals not completely preserved with -flto


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43038

--- Comment #11 from Jan Hubicka <hubicka at ucw dot cz> 2011-03-01 17:41:48 UTC ---
> > 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?).

Hmm, doing that would imply need to refer to the static in some global way
anyway. When it is referenced from regular code and two static variables from
two different units might end up in the same instruction.
Not too hard to implement I guess.
> 
> 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).

I do not like much the idea of improsing new artificial limits on the
partitioning. Once we start doing fancy stuff at the ltrans time, we will
have hard time partitioning the important stuff into single partition.  Those
extra requirements would just make it harder

I probably like most the variant with extending the asm syntax for
inputs/outputs at toplevel statements (like Sun compiler seems to do already)
and declaring direct references to statics not LTO compatible.

It seems much cleaner to me to declare that variable is used at the place it is
actually used rather than annotating the declaration. Also it avoid the need
for asm statement to be aware of target mangling rules (i.e. prefixing with _)

Honza


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]