http://sourceware.org/bugzilla/show_bug.cgi?id=15270
Bug #: 15270 Summary: GNU LD produce stale dynamic table entries for symbols optimized out by LTO Product: binutils Version: unspecified Status: NEW Severity: normal Priority: P2 Component: ld AssignedTo: unassig...@sourceware.org ReportedBy: hubi...@gcc.gnu.org Classification: Unclassified The problem is in detail described in: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56557 Compiling: //================ #include <fstream> int main() { std::fstream x; } //================ The link error is; cryolite@ubuntu:~/work/gcc-bugs/20130306$ ~/local/gcc-4.8-20130303/bin/g++ -flto -rdynamic main.cpp with older revisions of GCC leads to link error. This problem was fixed on GCC side, but there are also useless referneces to symbols. The resulting binary contains lots of bogus SHN_UNDEF symbols (using ld.bfd 2.22.52.0.1), including the _ZTC* symbols that will fail to link against latest 4.8.0 libstdc++ (or 4.7.x libstdc++), because they aren't exported. I'd say that the only needed SHN_UNDEF symbols in the dynamic table are the symbols that are actually used in the relocations. If I link without -flto, the relocs are: 0000000000600dc0 0000000400000006 R_X86_64_GLOB_DAT 0000000000000000 __gmon_start__ + 0 0000000000600de0 0000000700000007 R_X86_64_JUMP_SLOT 0000000000000000 __libc_start_main + 0 0000000000600de8 0000000c00000007 R_X86_64_JUMP_SLOT 0000000000000000 _ZNSt13basic_fstreamIcSt11char_traitsIcEED1Ev + 0 0000000000600df0 0000000e00000007 R_X86_64_JUMP_SLOT 0000000000000000 _ZNSt13basic_fstreamIcSt11char_traitsIcEEC1Ev + 0 0000000000600df8 0000001200000007 R_X86_64_JUMP_SLOT 0000000000400820 __gxx_personality_v0 + 0 0000000000600e00 0000001300000007 R_X86_64_JUMP_SLOT 0000000000000000 _Unwind_Resume + 0 and SHN_UNDEF symbols in the binary beyond those are just: 1: 0000000000600e08 0 NOTYPE WEAK DEFAULT 24 data_start 5: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _Jv_RegisterClasses 8: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_deregisterTMCloneTable 10: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_registerTMCloneTable But with -flto there are 96 SHN_UNDEF symbols in the binary. That looks like liblto_plugin.so bug to me, the symbols are there just in the symbol tables, but aren't actually used for anything. -- 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. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils