binutils testsuite strip-13 test
authorAlan Modra <amodra@gmail.com>
Mon, 13 Aug 2018 04:11:18 +0000 (13:41 +0930)
committerAlan Modra <amodra@gmail.com>
Sat, 18 Aug 2018 04:16:32 +0000 (13:46 +0930)
commit506b86a4f5fe2aff90e62940a07c9e275d406cd4
tree8fb1c7ac2d4073b8d5ad46f07d16e2900c83a160
parent503c367dc237e6fec46d0b8ccf3e74f7406b3260
binutils testsuite strip-13 test

The strip-13 test runs into difficulty using dc.a on some targets.
dc.a writes a power of 2 number of bytes large enough to contain a
target address.  On some targets, eg. avr-elf, this can be 2 bytes but
the ELF format used require words of 4 bytes to make up a relocation
entry.  There was a hack in the test, duplicating the reloc type into
what is normally the addend to make the test work when little-endian,
but that hack fails for similar big-endian targets.

This patch fixes that problem by arranging to emit 32-bit and 64-bit
ELF relocs using .4byte and .8byte directives, chosen as appropriate
for the ELF size.  I've also bumped the reloc number tested to a
higher unused value, and made the number more easily parameterised by
target should that be necessary in the future.  Whether REL or RELA
relocs are used is now chosen by a new is_rela readelf test of an
object file, rather than by lists of targets.

* testsuite/lib/binutils-common.exp (is_elf64): Use directory of
input file for readelf.out.
(is_rela): New proc.
* testsuite/binutils-all/objcopy.exp (elf64): Set new variable
from first result of is_elf64 test.
(reloc_format): Set using is_rela.
(strip-13): Pass RELOC and ELF64 to assembler.
(strip-14, strip-15): Use elf64 rather than calling is_elf64 again.
* testsuite/binutils-all/strip-13.d: Run for more targets.
* testsuite/binutils-all/strip-13mips64.s: Use RELOC and set
addend to zero.
* testsuite/binutils-all/strip-13rel.s: Use RELOC and ELF64.
Don't add _NONE reloc.
* testsuite/binutils-all/strip-13rela.s: Likewise.
binutils/ChangeLog
binutils/testsuite/binutils-all/objcopy.exp
binutils/testsuite/binutils-all/strip-13.d
binutils/testsuite/binutils-all/strip-13mips64.s
binutils/testsuite/binutils-all/strip-13rel.s
binutils/testsuite/binutils-all/strip-13rela.s
binutils/testsuite/lib/binutils-common.exp
This page took 0.027841 seconds and 4 git commands to generate.