public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/1] Don't convert R_SPARC_32 to R_SPARC_RELATIVE if class is ELFCLASS64
@ 2016-05-11 10:11 James Clarke
  2016-05-11 10:11 ` [PATCH 1/1] " James Clarke
  0 siblings, 1 reply; 7+ messages in thread
From: James Clarke @ 2016-05-11 10:11 UTC (permalink / raw)
  To: binutils; +Cc: James Clarke

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-06-28 11:22 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-11 10:11 [PATCH 0/1] Don't convert R_SPARC_32 to R_SPARC_RELATIVE if class is ELFCLASS64 James Clarke
2016-05-11 10:11 ` [PATCH 1/1] " James Clarke
2016-05-24 19:27   ` Cary Coutant
2016-06-27 22:13     ` James Clarke
2016-06-28 11:03       ` Nick Clifton
2016-06-28 11:22         ` John Paul Adrian Glaubitz
2016-05-25 14:40   ` Nick Clifton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).