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: wilson at gcc dot gnu.org
Subject: [Bug ld/22756] Linker relaxation miscalculates symbol addresses on riscv
Date: Fri, 02 Feb 2018 19:38:47 +0000

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

Jim Wilson <wilson at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at sourceware dot org   |wilson at gcc dot 
gnu.org

--- Comment #2 from Jim Wilson <wilson at gcc dot gnu.org> ---
The problem is with testglue.o, which has both a definition of __wrap_exit, and
an undefined reference to exit.  With the --wrap option, the later gets renamed
to __wrap_exit, and we now have two references to the same symbol in the symbol
table, which violates assumptions in the riscv port.

Looking at other ports, I see that 3 of them have a solution for this, to check
for duplicate symbols and ignore them.  The solution is O(N^2) but we only need
it when --wrap is used, so perhaps it is OK.  I do prefer to use code which is
already used in other ports.

Although looking closer at the code to support deleting bytes during
relaxation, it looks like every port is broken in at least one way.  Here is my
unverified list:

no wrap symbol support and no symbol size support
  elfxx-mips.c
  elf32-h8300.c
  elf32-ip2k.c
  elf32-m68hc11.c
  elf32-sh.c
no wrap symbol support
  elfnn-riscv.c
  elf32-m32c.c
  elf32-microblaze.c
  elf32-msp430.c
  elf32-nds32.c
  elf32-pru.c
  elf32-rl78.c
  elf32-rx.c
  elf32-v850.c
O(N^2) solution to wrap symbols, but no symbol size support
  elf32-cr16.c
  elf32-crx.c
  elf32-ft32.c

Maybe worth a meta bug to track?

Anyways, I have a patch for elfnn-riscv.c based on the elf32-crx.c support, and
will commit soon.

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