https://sourceware.org/bugzilla/show_bug.cgi?id=18720

--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Cary Coutant from comment #1)
> With my proposed fix for gas (see PR 18703 comment #12), indirect3b.o would
> not have the stray unversioned definition for foo, and ld would work just
> fine as is.
> 
> https://sourceware.org/bugzilla/show_bug.cgi?id=18703#c12
> 
> With your testcase, gold binds to the unversioned foo in indirect3b.o, and
> the resulting binary prints "MAIN" twice. With the patched assembler, both
> gold and ld print "DSO" twice.

I tried your gas change:

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;

on master branch on Linux/x86-64 and got:

FAIL: ELF symbol versioning
FAIL: Indirect symbol 1a: : local symbol `foo' in tmpdir/indirect1b.o is
referenced by DSO
FAIL: Indirect symbol 1a: : final link failed: Bad value
FAIL: Indirect symbol 1b: : local symbol `foo' in tmpdir/indirect1b.o is
referenced by DSO
FAIL: Indirect symbol 1b: : final link failed: Bad value
FAIL: Run with libindirect3c.so 1
FAIL: Run with libindirect3c.so 2
FAIL: Run with libindirect3c.so 3
FAIL: Run with libindirect3c.so 4
FAIL: vers24a
FAIL: vers24b
FAIL: ELF symbol versioning
FAIL: symver symver1

Do you those failures?

-- 
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

Reply via email to