This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH 0/1] Don't convert R_SPARC_32 to R_SPARC_RELATIVE if class is ELFCLASS64
- From: James Clarke <jrtc27 at jrtc27 dot com>
- To: binutils at sourceware dot org
- Cc: James Clarke <jrtc27 at jrtc27 dot com>
- Date: Wed, 11 May 2016 11:10:35 +0100
- Subject: [PATCH 0/1] Don't convert R_SPARC_32 to R_SPARC_RELATIVE if class is ELFCLASS64
- Authentication-results: sourceware.org; auth=none
Currently, ld (both bfd and gold) will convert an R_SPARC_32 relocation to be
an R_SPARC_RELATIVE one when creating an ELFCLASS64 file (and would convert
R_SPARC_64 to R_SPARC_RELATIVE for an ELFCLASS32 file if it were to be given
such a relocation). This is clearly incorrect based on the size and alignment
requirements for each. This patch ensures R_SPARC_XX is only converted to
R_SPARC_RELATIVE when creating an ELFCLASSXX file.
This seems to produce a regression in the test suite for -Bsymbolic-functions:
/home/jrtc27/src/binutils/binutils-2.26/builddir-single/ld/../gas/as-new -I/home/jrtc27/src/binutils/binutils-2.26/ld/testsuite/ld-elf -o tmpdir/symbolic-func.o /home/jrtc27/src/binutils/binutils-2.26/ld/testsuite/ld-elf/symbolic-fun
c.s
Executing on host: sh -c {/home/jrtc27/src/binutils/binutils-2.26/builddir-single/ld/../gas/as-new -I/home/jrtc27/src/binutils/binutils-2.26/ld/testsuite/ld-elf -o tmpdir/symbolic-func.o /home/jrtc27/src/binutils/binutils-2.26/ld/tes
tsuite/ld-elf/symbolic-func.s 2>&1} /dev/null ld.tmp (timeout = 300)
spawn [open ...]
/home/jrtc27/src/binutils/binutils-2.26/builddir-single/ld/ld-new -o tmpdir/symbolic-func.so -L/home/jrtc27/src/binutils/binutils-2.26/ld/testsuite/ld-elf -shared -Bsymbolic-functions tmpdir/symbolic-func.o
Executing on host: sh -c {/home/jrtc27/src/binutils/binutils-2.26/builddir-single/ld/ld-new -o tmpdir/symbolic-func.so -L/home/jrtc27/src/binutils/binutils-2.26/ld/testsuite/ld-elf -shared -Bsymbolic-functions tmpdir/symbolic-func.o 2>
&1} /dev/null ld.tmp (timeout = 300)
spawn [open ...]
Executing on host: sh -c {/home/jrtc27/src/binutils/binutils-2.26/builddir-single/ld/../binutils/readelf -r --wide tmpdir/symbolic-func.so >dump.out 2>ld.stderr} /dev/null (timeout = 300)
spawn [open ...]
/home/jrtc27/src/binutils/binutils-2.26/builddir-single/ld/../binutils/readelf -r --wide tmpdir/symbolic-func.so
regexp_diff match failure
regexp "^0*[1-9a-f][0-9a-f]* +[^ ]+ +[^ ]+ +([0-9a-f]+( +\.text( \+ 0)?)?)?$"
line "0000000000100200 0000000100000003 R_SPARC_32 00000000000001f8 .text + 1f8"
FAIL: -Bsymbolic-functions
Linking symbolic-func.so with system linker:
Relocation section '.rela.dyn' at offset 0x1e0 contains 1 entries:
Offset Info Type Sym. Value Sym. Name + Addend
000000100200 000000000016 R_SPARC_RELATIVE 1f8
Linking symbolic-func.so with new linker:
Relocation section '.rela.dyn' at offset 0x1e0 contains 1 entries:
Offset Info Type Sym. Value Sym. Name + Addend
000000100200 000100000003 R_SPARC_32 00000000000001f8 .text + 1f8
I don't know what's supposed to happen here, but I would be very surprised if
the R_SPARC_32 is meant to be an R_SPARC_RELATIVE given the sizes and alignment
requirements.
Note: this bug appeared in 22b75d0ae688dadd85f4bf89bd14541f9c9c6f2c, which
created elfxx-sparc.c and unified the code in elf{32,64}-sparc.c.
James Clarke (1):
Don't convert R_SPARC_32 to R_SPARC_RELATIVE if class is ELFCLASS64
bfd/elfxx-sparc.c | 3 ++-
gold/sparc.cc | 12 +++++++-----
2 files changed, 9 insertions(+), 6 deletions(-)
--
2.8.2