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.