http://sourceware.org/bugzilla/show_bug.cgi?id=12942
Summary: Plugin not handling correctly resolution of COMDATs. Product: binutils Version: unspecified Status: NEW Severity: normal Priority: P2 Component: ld AssignedTo: unassig...@sources.redhat.com ReportedBy: hubi...@gcc.gnu.org Hi, you need the following fix to GCC to output symbol table correctly. I will commit it after testing. Index: ipa.c =================================================================== --- ipa.c (revision 175350) +++ ipa.c (working copy) @@ -542,13 +542,13 @@ { int i; struct ipa_ref *ref; - for (i = 0; ipa_ref_list_reference_iterate (&node->ref_list, i, ref); i++) + for (i = 0; ipa_ref_list_refering_iterate (&node->ref_list, i, ref); i++) if (ref->use == IPA_REF_ADDR) { struct varpool_node *node; - if (ref->refered_type == IPA_REF_CGRAPH) + if (ref->refering_type == IPA_REF_CGRAPH) return true; - node = ipa_ref_varpool_node (ref); + node = ipa_ref_refering_varpool_node (ref); if (!DECL_VIRTUAL_P (node->decl)) return true; } With fixed GCC the following testcase fails with GNU LD but not with Gold: evans:/abuild/jh/dealIIb/:[0]# cat a.h inline int test (void) { } typedef int (*test_t) (void); evans:/abuild/jh/dealIIb/:[0]# cat a.cc #include "a.h" extern "C" void abort (); test_t b(void); int main(void) { if (test != b ()) abort (); } evans:/abuild/jh/dealIIb/:[0]# cat b.cc #include <stdio.h> #include "a.h" test_t b(void) { return test; } evans:/abuild/jh/dealIIb/:[0]# /abuild/jh/trunk-install/bin/g++ a.cc -flto -c -O2 evans:/abuild/jh/dealIIb/:[0]# /abuild/jh/trunk-install/bin/g++ b.cc -c -O2 evans:/abuild/jh/dealIIb/:[0]# /abuild/jh/trunk-install/bin/g++ a.o b.o -save-temps -O2 -flto -fuse-linker-plugin [Leaving LTRANS /tmp/cc7tSz5y.args] [Leaving LTRANS /tmp/ccAl4bQf.ltrans.out] [Leaving LTRANS /tmp/cc0AoaEb.args] [Leaving LTRANS /tmp/ccAl4bQf.ltrans0.o] evans:/abuild/jh/dealIIb/:[0]# ./a.out Aborted (core dumped) evans:/abuild/jh/dealIIb/:[134]# /abuild/jh/trunk-install/bin/g++ a.o b.o -save-temps -O2 evans:/abuild/jh/dealIIb/:[0]# ./a.out evans:/abuild/jh/dealIIb/:[0]# more ./-lm.res 1 a.o 3 164 623d5db5 PREVAILING_DEF_IRONLY _Z4testv 170 623d5db5 PREVAILING_DEF main 181 623d5db5 RESOLVED_EXEC _Z1bv I.e. with LTO compilation the _Z4testv is not merged. Golds variant of -lm.res is: 1 a.o 3 164 623d5db5 PREVAILING_DEF _Z4testv 170 623d5db5 PREVAILING_DEF main 181 623d5db5 RESOLVED_EXEC _Z1bv -- 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