[binutils-gdb] RISC-V: Fix symbol address problem with versioned symbols.

Jim Wilson wilson@sourceware.org
Sun Jun 3 21:45:00 GMT 2018


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=137b5cbd204241ec47873c353cf7e41b47182d53

commit 137b5cbd204241ec47873c353cf7e41b47182d53
Author: Jim Wilson <jimw@sifive.com>
Date:   Sun Jun 3 14:44:44 2018 -0700

    RISC-V: Fix symbol address problem with versioned symbols.
    
    	bfd/
    	PR ld/22756
    	* elfnn-riscv.c (riscv_relax_delete_bytes): Add versioned_hidden check
    	to code that ignores duplicate symbols.

Diff:
---
 bfd/ChangeLog     | 6 ++++++
 bfd/elfnn-riscv.c | 9 ++++++---
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 1a4a301..250e416 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2018-06-03  Jim Wilson  <jimw@sifive.com>
+
+	PR ld/22756
+	* elfnn-riscv.c (riscv_relax_delete_bytes): Add versioned_hidden check
+	to code that ignores duplicate symbols.
+
 2018-06-01  H.J. Lu  <hongjiu.lu@intel.com>
 
 	* version.m4: Bump version to 2.30.52
diff --git a/bfd/elfnn-riscv.c b/bfd/elfnn-riscv.c
index b82e655..a0bdee5 100644
--- a/bfd/elfnn-riscv.c
+++ b/bfd/elfnn-riscv.c
@@ -2708,9 +2708,12 @@ riscv_relax_delete_bytes (bfd *abfd, asection *sec, bfd_vma addr, size_t count,
 	 call to SYMBOL as well. Since both __wrap_SYMBOL and SYMBOL reference
 	 the same symbol (which is __wrap_SYMBOL), but still exist as two
 	 different symbols in 'sym_hashes', we don't want to adjust
-	 the global symbol __wrap_SYMBOL twice.
-	 This check is only relevant when symbols are being wrapped.  */
-      if (link_info->wrap_hash != NULL)
+	 the global symbol __wrap_SYMBOL twice.  */
+      /* The same problem occurs with symbols that are versioned_hidden, as
+	 foo becomes an alias for foo@BAR, and hence they need the same
+	 treatment.  */
+      if (link_info->wrap_hash != NULL
+	  || sym_hash->versioned == versioned_hidden)
 	{
 	  struct elf_link_hash_entry **cur_sym_hashes;



More information about the Binutils-cvs mailing list