aboutsummaryrefslogtreecommitdiff
path: root/binutils/testsuite/binutils-all/objcopy.exp
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@mips.com>2018-04-09 13:42:00 +0100
committerMaciej W. Rozycki <macro@mips.com>2018-04-09 13:42:00 +0100
commit3f97ba9fc82dbb1bca72fd8a137b2de132348367 (patch)
tree103114a16d83aec1c5af01d633382ef1422e1bc9 /binutils/testsuite/binutils-all/objcopy.exp
parent9ccfa98b4cbc86ac34734ecf9d35466461c7e34c (diff)
downloadgdb-3f97ba9fc82dbb1bca72fd8a137b2de132348367.zip
gdb-3f97ba9fc82dbb1bca72fd8a137b2de132348367.tar.gz
gdb-3f97ba9fc82dbb1bca72fd8a137b2de132348367.tar.bz2
binutils/testsuite: Verify the handling of invalid `r_sym' in relocation
Verify that `strip' terminates gracefully and a correct error message is produced for a relocation encountered with an invalid symbol index. No single relocation number is valid across all targets we support, so pick a few numbers to choose from depending on the target. binutils/ * testsuite/binutils-all/strip-14.d: New test. * testsuite/binutils-all/strip-14rel.s: New test source. * testsuite/binutils-all/strip-14rela.s: New test source. * testsuite/binutils-all/strip-14mips64.s: New test source. * testsuite/binutils-all/objcopy.exp: Run the new test.
Diffstat (limited to 'binutils/testsuite/binutils-all/objcopy.exp')
-rw-r--r--binutils/testsuite/binutils-all/objcopy.exp16
1 files changed, 16 insertions, 0 deletions
diff --git a/binutils/testsuite/binutils-all/objcopy.exp b/binutils/testsuite/binutils-all/objcopy.exp
index 0639fe5..532bdc6 100644
--- a/binutils/testsuite/binutils-all/objcopy.exp
+++ b/binutils/testsuite/binutils-all/objcopy.exp
@@ -1107,6 +1107,22 @@ if [is_elf_format] {
set reloc_format rela
}
run_dump_test "strip-13" [list [list source strip-13${reloc_format}.s]]
+ # Select a relocation number that corresponds to one actually
+ # supported by the target and ABI being tested.
+ if { [istarget "aarch64*-*"] } {
+ set reloc 259
+ } elseif { [istarget "ia64*-*"] \
+ || [istarget "m32r*-*"] \
+ || [istarget "v850*-*"] } {
+ set reloc 50
+ } else {
+ set reloc 1
+ }
+ run_dump_test "strip-14" [list \
+ [list source strip-14${reloc_format}.s] \
+ [list as "--defsym RELOC=${reloc}"] \
+ [list as [expr {[is_elf64 tmpdir/bintest.o] \
+ ? "--defsym ELF64=1" : ""}]]]
# This requires STB_GNU_UNIQUE support with OSABI set to GNU.
if { [supports_gnu_unique] } {