On Linux/x86-64, I got [hjl@gnu-6 runtime]$ cat tst-quadmod2.S #define BIAS -0x7fff0000 .section .data.rel.local,"aw",@progbits .align 8 .Ljmp: .quad func + BIAS .text .type func, @function func: .cfi_startproc xorl %edi, %edi jmp exit@PLT .cfi_endproc .size func, .-func .globl foo .type foo, @function foo: .cfi_startproc .cfi_def_cfa_register 6 movq .Ljmp(%rip), %rax subq $BIAS, %rax jmp *%rax .cfi_endproc .size foo, .-foo [hjl@gnu-6 runtime]$ make libtst-quadmod2.so gcc -B./ -c -g -o tst-quadmod2.o tst-quadmod2.S ./ld -shared -o libtst-quadmod2.so tst-quadmod2.o [hjl@gnu-6 runtime]$ readelf -r libtst-quadmod2.so Relocation section '.rela.dyn' at offset 0x1e8 contains 1 entries: Offset Info Type Sym. Value Sym. Name + Addend 0000002003f8 000000000008 R_X86_64_RELATIVE ffffffff80010240 Relocation section '.rela.plt' at offset 0x200 contains 1 entries: Offset Info Type Sym. Value Sym. Name + Addend 0000002003f0 000600000007 R_X86_64_JUMP_SLO 0000000000000000 exit + 0 Addend for R_X86_64_RELATIVE is a negative number. But it is displayed as an address.
Displaying it as a decimal number would be much less useful.
CVSROOT: /cvs/src Module name: src Changes by: hjl@sourceware.org 2012-05-11 15:48:15 Modified files: binutils : ChangeLog readelf.c ld/testsuite : ChangeLog ld/testsuite/ld-ia64: tlspic.rd ld/testsuite/ld-x86-64: tlsdesc-nacl.rd tlsdesc.rd tlspic-nacl.rd tlspic.rd Log message: Always display addend as signed hex number binutils/ PR binutils/14088 * readelf.c (dump_relocations): Always display addend as signed hex number. ld/testsuite/ PR binutils/14088 * ld-ia64/tlspic.rd: Updated. * ld-x86-64/tlsdesc-nacl.rd: Likewise. * ld-x86-64/tlsdesc.rd: Likewise. * ld-x86-64/tlspic-nacl.rd: Likewise. * ld-x86-64/tlspic.rd: Likewise. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/src/binutils/ChangeLog.diff?cvsroot=src&r1=1.1903&r2=1.1904 http://sourceware.org/cgi-bin/cvsweb.cgi/src/binutils/readelf.c.diff?cvsroot=src&r1=1.570&r2=1.571 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ChangeLog.diff?cvsroot=src&r1=1.1523&r2=1.1524 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-ia64/tlspic.rd.diff?cvsroot=src&r1=1.17&r2=1.18 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-x86-64/tlsdesc-nacl.rd.diff?cvsroot=src&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-x86-64/tlsdesc.rd.diff?cvsroot=src&r1=1.10&r2=1.11 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-x86-64/tlspic-nacl.rd.diff?cvsroot=src&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-x86-64/tlspic.rd.diff?cvsroot=src&r1=1.16&r2=1.17
Fixed.
The master branch has been updated by Maciej W. Rozycki <macro@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=c0c237fcdd133e84e67657cc6b7e4678f106bdcb commit c0c237fcdd133e84e67657cc6b7e4678f106bdcb Author: Maciej W. Rozycki <macro@imgtec.com> Date: Wed Feb 1 22:09:33 2017 +0000 MIPS/LD/testsuite: Correct relocation addends in VxWorks tests Fix commit 171191bac50e ("Add support for STT_IFUNC"), <https://sourceware.org/ml/binutils/2008-12/msg00052.html>, commit e04d7088afe0 ("PR ld/14088: Always display addend as signed hex number"), <https://sourceware.org/ml/binutils/2012-05/msg00123.html> and commit 343dbc36ffae ("Print addend as signed in objdump"), <https://sourceware.org/ml/binutils/2012-05/msg00163.html> regressions: FAIL: VxWorks executable test 1 (dynamic) FAIL: ld-mips-elf/vxworks-forced-local-1 seen with `mips-vxworks' and `mipsel-vxworks' targets and adjust dump patterns according to changes made to the presentation of relocation addends in `readelf -r' and `objdump -r' output. ld/ * testsuite/ld-mips-elf/vxworks-forced-local-1.d: Correct the presentation of relocation addends. * testsuite/ld-mips-elf/vxworks1-lib.rd: Likewise. * testsuite/ld-mips-elf/vxworks1.dd: Likewise. * testsuite/ld-mips-elf/vxworks1.rd: Likewise.
The binutils-2_28-branch branch has been updated by Maciej W. Rozycki <macro@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=1d0d283e6bcc643c6ca96edd7ac4551e09d9975d commit 1d0d283e6bcc643c6ca96edd7ac4551e09d9975d Author: Maciej W. Rozycki <macro@imgtec.com> Date: Wed Feb 1 22:09:33 2017 +0000 MIPS/LD/testsuite: Correct relocation addends in VxWorks tests Fix commit 171191bac50e ("Add support for STT_IFUNC"), <https://sourceware.org/ml/binutils/2008-12/msg00052.html>, commit e04d7088afe0 ("PR ld/14088: Always display addend as signed hex number"), <https://sourceware.org/ml/binutils/2012-05/msg00123.html> and commit 343dbc36ffae ("Print addend as signed in objdump"), <https://sourceware.org/ml/binutils/2012-05/msg00163.html> regressions: FAIL: VxWorks executable test 1 (dynamic) FAIL: ld-mips-elf/vxworks-forced-local-1 seen with `mips-vxworks' and `mipsel-vxworks' targets and adjust dump patterns according to changes made to the presentation of relocation addends in `readelf -r' and `objdump -r' output. ld/ * testsuite/ld-mips-elf/vxworks-forced-local-1.d: Correct the presentation of relocation addends. * testsuite/ld-mips-elf/vxworks1-lib.rd: Likewise. * testsuite/ld-mips-elf/vxworks1.dd: Likewise. * testsuite/ld-mips-elf/vxworks1.rd: Likewise. (cherry picked from commit c0c237fcdd133e84e67657cc6b7e4678f106bdcb)