`.LANCHOR0' referenced in section `.text' of libc_pic.a(strtoul_l.os): defined in discarded section `.gnu.linkonce.r.__strtol_ul_max_tab' of libc_pic.a(strtoul_l.os) `.LANCHOR1' referenced in section `.text' of libc_pic.a(strtoul_l.os): defined in discarded section `.gnu.linkonce.r.__strtol_ul_rem_tab' of libc_pic.a(strtoul_l.os)
-fno-section-anchors strtoul_l.os 000000fe 00000f0e R_PPC_GOT16 00000000 __strtol_ul_max_tab + 0 00000102 0000100e R_PPC_GOT16 00000000 __strtol_ul_rem_tab + 0 15: 00000000 140 OBJECT GLOBAL HIDDEN 5 __strtol_ul_max_tab 16: 00000000 35 OBJECT GLOBAL HIDDEN 6 __strtol_ul_rem_tab -fsection-anchors strtoul_l_os 000000fe 0000060e R_PPC_GOT16 00000000 .LANCHOR0 + 0 00000102 0000080e R_PPC_GOT16 00000000 .LANCHOR1 + 0 6: 00000000 0 NOTYPE LOCAL DEFAULT 5 .LANCHOR0 8: 00000000 0 NOTYPE LOCAL DEFAULT 6 .LANCHOR1 GOT relocs work by creating one entry in .got per symbol, so for example if there are a dozen GOT relocs referencing __strtol_ul_max_tab you get just one entry in .got. Global symbols merge. There can only be one strong definition of a global symbol, and all references resolve to that single definition. However, .LANCHOR0 is local, so is a different symbol to .LANCHOR0 in some other file. Thus the GOT reloc referencing .LANCHOR0 in this file creates a separate .got entry to a GOT reloc in another file referencing .LANCHOR0. I'd say this is a gcc bug. (The GOT reloc can't really use section anchors anyway because [EMAIL PROTECTED] has rather useless semantics, so why can't gcc use the original symbol?) ld can't treat the local symbols in linkonce sections as if they were global because .LANCHOR0 in .gnu.linkonce.r.__strtol_ul_max_tab must be different from .LANCHOR0 in .gnu.linkonce.r.some_other_name. -- Summary: [4.2 Regression] GOT reloc using section anchor Product: gcc Version: 4.2.0 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: target AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: dje at gcc dot gnu dot org GCC build triplet: powerpc-linux GCC host triplet: powerpc-linux GCC target triplet: powerpc-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28598