https://sourceware.org/bugzilla/show_bug.cgi?id=18703
--- Comment #12 from Cary Coutant <ccoutant at gmail dot com> --- > The documentation can have some improvements. But ld.bfd behavior is > well-defined as shown by testcases in ld/testsuite/ld-elfvers. If you're going to maintain that ".symver foo,foo@VER" is valid, then I think the assembler needs to be fixed so that it doesn't assume that the original name and the versioned name don't have the same base. In obj-elf.c, elf_frob_symbol seems to be written with the assumption that they are different. The following patch fixes that so that we don't get the duplicate symbol: diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c index 78dc6d9..8668be0 100644 --- a/gas/config/obj-elf.c +++ b/gas/config/obj-elf.c @@ -2182,6 +2182,11 @@ elf_frob_symbol (symbolS *symp, int *puntp) memmove (&p[2], &p[3], l); S_SET_NAME (symp, sy_obj->versioned_name); } + else if (strncmp (S_GET_NAME (symp), sy_obj->versioned_name, + strlen (S_GET_NAME (symp))) == 0) + { + S_SET_NAME (symp, sy_obj->versioned_name); + } else { symbolS *symp2; (testsuite/gas/elf/symver.d and testsuite/gas/symver/symver1.d will also need adjusting.) With that patch to gas, gold now has the same behavior for Sri's test case (and it also passes the vers27d1.c test case in the ld testsuite). Shall I forward this bug to gas? As long as gas is emitting an unversioned symbol, I'm going to maintain that gold is doing the right thing in assigning it a default version. -- 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