bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/13229] V2 of getsymbol linker plugin interface is not supported


From: hubicka at gcc dot gnu.org
Subject: [Bug ld/13229] V2 of getsymbol linker plugin interface is not supported by GNU LD
Date: Sat, 01 Oct 2011 15:19:27 +0000

http://sourceware.org/bugzilla/show_bug.cgi?id=13229

--- Comment #9 from Jan Hubicka <hubicka at gcc dot gnu.org> 2011-10-01 
15:19:27 UTC ---
OK,
I now understand the problem.  It is partly GNU LD issue.
What happens is

1) nsGNOMEShellService includes header that define gfxUnknownSurface.
   The class is obviously uunused but it has virtual destructor and thus GCC
   decides to keep it around until after interprocedural optimization for
   possible devirtualization.
   Note that even with -O0 the class goes trivially away. This is stupid but
should not affect code quality
2) Other shared library, libxul.so also included some modules that use&define
gfxUnknownSurface. It is linked with LTO info and resolution is:

11903 34650d5e PREVAILING_DEF_IRONLY_EXP _ZTV17gfxUnknownSurface

This consequentely makes GCC to privatize it and rename it to static 
_ZTV17gfxUnknownSurface.local.<somerandomnumbers>
address@hidden:/abuild/jh/build-mozilla-new14-gnu-ld/toolkit/library> grep
_ZTV17gfxUnknownSurface *.s
libxul.so.ltrans18.s:   leaq    16+_ZTV17gfxUnknownSurface.local.102757(%rip),
%rax
libxul.so.ltrans18.s:   .hidden _ZTV17gfxUnknownSurface.local.102757
libxul.so.ltrans23.s:   .hidden _ZTV17gfxUnknownSurface.local.102757
libxul.so.ltrans23.s:   .globl  _ZTV17gfxUnknownSurface.local.102757
libxul.so.ltrans23.s:   .type   _ZTV17gfxUnknownSurface.local.102757, @object
libxul.so.ltrans23.s:   .size   _ZTV17gfxUnknownSurface.local.102757, 144
libxul.so.ltrans23.s:_ZTV17gfxUnknownSurface.local.102757:

3) Despite the fact that original _ZTV17gfxUnknownSurface has been fully
optimized out from libxul.so, GNU LD incorrectly assigns a dynamic linker entry
for it:
address@hidden:/abuild/jh/build-mozilla-new14-gnu-ld/toolkit/library> nm -D
libxul.so| grep _ZTV17gfxUnknownSurface
0000000000000000 W _ZTV17gfxUnknownSurface

4) Finally at a time we link the new shared library -llibxul is used.  This
makes linker to notice dynamic linker entry for _ZTV17gfxUnknownSurface and
consequentely it changes prevailance info to PREVAILING_DEF as quoted above.
This makes GCC to no longer optimize the symbol out and finally we die on
undefined reference.

So in addition to your patch, I think there are two bugs:

1) GNU LD should not produce dynamic linker entries for
PREVAILING_DEF_IRONLY_EXP that has been optimized out.  This is very important
since in C++ code this is a mjority and size of linker table would grow a lot
2) The class is probably by some .h trickery hidden visibility for libxul and
default visibility for the other library. Is it correct for gold&GNU LD to make
the resolution PREVAILING_DEF because the symbol is mentioned but not used by
some other shared library here?

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]