[Bug lto/48200] linking shared library with LTO results in different exported symbols

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Mar 22 10:17:00 GMT 2011


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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW
                 CC|                            |hubicka at gcc dot gnu.org

--- Comment #5 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-03-22 10:02:24 UTC ---
Confirmed.

I think what happens is that the symver global asms get partitioned away
from the function definitions.  With -flto-partition=none it works for me.

> grep pci_fill_info libpci.so.3.1.7.ltrans?.s
libpci.so.3.1.7.ltrans0.s:      .symver
pci_fill_info_v30,pci_fill_info@LIBPCI_3.0
libpci.so.3.1.7.ltrans0.s:      .symver
pci_fill_info_v31,pci_fill_info@@LIBPCI_3.1
libpci.so.3.1.7.ltrans1.s:      call    pci_fill_info_v31@PLT
libpci.so.3.1.7.ltrans1.s:      .globl  pci_fill_info_v31
libpci.so.3.1.7.ltrans1.s:      .type   pci_fill_info_v31, @function
libpci.so.3.1.7.ltrans1.s:pci_fill_info_v31:
libpci.so.3.1.7.ltrans1.s:      .size   pci_fill_info_v31, .-pci_fill_info_v31
libpci.so.3.1.7.ltrans1.s:      .globl  pci_fill_info_v30
libpci.so.3.1.7.ltrans1.s:      .set    pci_fill_info_v30,pci_fill_info_v31
libpci.so.3.1.7.ltrans2.s:      call    pci_fill_info_v31@PLT

so indeed that is what happens (-save-temps appended to the link command
produces those intermediate files).

We can't really know better (we do not parse asm strings), -flto-partition=none
is a workaround.  A fix would be to not use toplevel asms, but I'm not sure
a different way for the symvers exists (maybe it's possible to do entirely
in the linker script ...).



More information about the Gcc-bugs mailing list