bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/22756] Linker relaxation miscalculates symbol addresses on riscv


From: address@hidden
Subject: [Bug ld/22756] Linker relaxation miscalculates symbol addresses on riscv
Date: Fri, 01 Jun 2018 18:37:44 +0000

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

--- Comment #7 from Andreas Schwab <address@hidden> ---
This simpler patch instead of #c3 fixes both the original problem and the
preceding test case.

diff --git c/bfd/elfnn-riscv.c w/bfd/elfnn-riscv.c
index 5f66f4f2d9..9c2b48baf5 100644
--- c/bfd/elfnn-riscv.c
+++ w/bfd/elfnn-riscv.c
@@ -2653,6 +2653,14 @@ riscv_relax_delete_bytes (bfd *abfd, asection *sec,
bfd_vma addr, size_t count)
   for (i = 0; i < symcount; i++)
     {
       struct elf_link_hash_entry *sym_hash = sym_hashes[i];
+      unsigned j;
+
+      /* Check for symbol aliases, don't adjust the same symbol twice.  */
+      for (j = 0; j < i; j++)
+       if (sym_hashes[j] == sym_hash)
+         break;
+      if (j < i)
+       continue;

       if ((sym_hash->root.type == bfd_link_hash_defined
           || sym_hash->root.type == bfd_link_hash_defweak)

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]