http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47952
Aldy Hernandez <aldyh at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #3 from Aldy Hernandez <aldyh at gcc dot gnu.org> 2011-03-07 15:37:06 UTC --- [These notes are from a question via email to Jakub/Richard. Saving here to keep everything in one place. Still awaiting response.] In this PR we have an undefined reference to symbol "_ZGTtNSt14_List_iteratorIN4Game12BuildProjectEEC1EPSt15_List_node_base" (see full .s in attachment). This symbol is only used in the .tm_clone_table: .section .tm_clone_table,"aw",@progbits [...] .quad _ZGTtNSt14_List_iteratorIN4Game12BuildProjectEEC1EPSt15_List_node_base [...] However, the symbol seems to be an alias to another symbol (which is used): .globl _ZGTtNSt14_List_iteratorIN4Game12BuildProjectEEC1EPSt15_List_node_base .set _ZGTtNSt14_List_iteratorIN4Game12BuildProjectEEC1EPSt15_List_node_base, _ZGTtNSt14_List_iteratorIN4Game12BuildProjectEEC2EPSt15_List_node_base Notice these are constructor variants (C1 versus C2 in the mangling). The original symbol is defined like this: .section .text._ZGTtNSt14_List_iteratorIN4Game12BuildProjectEEC2EPSt15_List_node_base,"axG",@progbits,_ZNSt14_List_iteratorIN4Game12BuildProjectEEC5EPSt15_List_node_base,comdat .align 2 .weak _ZGTtNSt14_List_iteratorIN4Game12BuildProjectEEC2EPSt15_List_node_base .type _ZGTtNSt14_List_iteratorIN4Game12BuildProjectEEC2EPSt15_List_node_base, @function _ZGTtNSt14_List_iteratorIN4Game12BuildProjectEEC2EPSt15_List_node_base: [...] [...] This is a wild guess, but should we avoid dumping symbols in the .tm_clone_table if the original function was a weak symbol? The one-liner below, fixes the undefined reference at hand, as well as a myriad of other linking problems in the Glob2 benchmark. ?? Index: varasm.c =================================================================== --- varasm.c (revision 170622) +++ varasm.c (working copy) @@ -5867,6 +5867,9 @@ finish_tm_clone_pairs_1 (void **slot, vo if (!src_n->needed) return 1; + if (DECL_WEAK (src_n->decl)) + return 1; + if (!*switched) { switch_to_section (get_named_section (NULL, ".tm_clone_table", 3));