aboutsummaryrefslogtreecommitdiff
path: root/binutils/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'binutils/testsuite')
-rw-r--r--binutils/testsuite/binutils-all/aarch64/pei-aarch64-little.d2
-rw-r--r--binutils/testsuite/binutils-all/ar.exp4
-rw-r--r--binutils/testsuite/binutils-all/copy-7.d14
-rw-r--r--binutils/testsuite/binutils-all/copy-7.s7
-rw-r--r--binutils/testsuite/binutils-all/loongarch64/pei-loongarch64.d2
-rw-r--r--binutils/testsuite/binutils-all/nm.exp18
-rw-r--r--binutils/testsuite/binutils-all/objcopy.exp44
-rw-r--r--binutils/testsuite/binutils-all/readelf.exp9
-rw-r--r--binutils/testsuite/binutils-all/riscv/pei-riscv64.d2
-rw-r--r--binutils/testsuite/binutils-all/tek2.obj8
-rw-r--r--binutils/testsuite/binutils-all/testranges-ia64.d2
-rw-r--r--binutils/testsuite/binutils-all/x86-64/x86-64.exp2
-rw-r--r--binutils/testsuite/lib/binutils-common.exp28
13 files changed, 108 insertions, 34 deletions
diff --git a/binutils/testsuite/binutils-all/aarch64/pei-aarch64-little.d b/binutils/testsuite/binutils-all/aarch64/pei-aarch64-little.d
index 27cb6e1..22f6649 100644
--- a/binutils/testsuite/binutils-all/aarch64/pei-aarch64-little.d
+++ b/binutils/testsuite/binutils-all/aarch64/pei-aarch64-little.d
@@ -1,7 +1,7 @@
#skip: aarch64_be-*-*
#ld: -e0
#PROG: objcopy
-#objcopy: -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel -j .rela -j .rel.* -j .rela.* -j .rel* -j .rela* -j .reloc --target=efi-app-aarch64
+#objcopy: -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel -j .rela -j .rel.* -j .rela.* -j .rel* -j .rela* -j .reloc --output-target=efi-app-aarch64
#objdump: -h -f
#name: Check if efi app format is recognized
diff --git a/binutils/testsuite/binutils-all/ar.exp b/binutils/testsuite/binutils-all/ar.exp
index d06fe90..f38dce5 100644
--- a/binutils/testsuite/binutils-all/ar.exp
+++ b/binutils/testsuite/binutils-all/ar.exp
@@ -1013,8 +1013,8 @@ tek1.obj:
*: no symbols
tek2.obj:
-00000001 D _binary_x_end
-00000001 A _binary_x_size
+00000003 D _binary_x_end
+00000003 A _binary_x_size
00000000 D _binary_x_start
} $got] {
fail $testname
diff --git a/binutils/testsuite/binutils-all/copy-7.d b/binutils/testsuite/binutils-all/copy-7.d
new file mode 100644
index 0000000..ac8e756
--- /dev/null
+++ b/binutils/testsuite/binutils-all/copy-7.d
@@ -0,0 +1,14 @@
+#PROG: objcopy
+#readelf: -tW
+#name: copy with unknown section flag
+#warning: .*/copy-7[.].*:[.]special: warning: retaining .* 0x10000
+
+There are .* section headers, starting at offset .*
+
+Section Headers:
+ \[Nr\].*
+#...
+ \[ [1-9]\] .special
+ PROGBITS .*
+ \[0+10000\]: UNKNOWN \(0+10000\)
+#...
diff --git a/binutils/testsuite/binutils-all/copy-7.s b/binutils/testsuite/binutils-all/copy-7.s
new file mode 100644
index 0000000..0861c3c
--- /dev/null
+++ b/binutils/testsuite/binutils-all/copy-7.s
@@ -0,0 +1,7 @@
+ .globl text_symbol
+ .text
+text_symbol:
+ .nop
+
+ .section .special,"0x10000", %progbits
+ .long -1
diff --git a/binutils/testsuite/binutils-all/loongarch64/pei-loongarch64.d b/binutils/testsuite/binutils-all/loongarch64/pei-loongarch64.d
index 574b3e5..61b026d 100644
--- a/binutils/testsuite/binutils-all/loongarch64/pei-loongarch64.d
+++ b/binutils/testsuite/binutils-all/loongarch64/pei-loongarch64.d
@@ -1,6 +1,6 @@
#ld: -e0
#PROG: objcopy
-#objcopy: -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel -j .rela -j .rel.* -j .rela.* -j .rel* -j .rela* -j .reloc --target=pei-loongarch64
+#objcopy: -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel -j .rela -j .rel.* -j .rela.* -j .rel* -j .rela* -j .reloc --output-target=pei-loongarch64
#objdump: -h -f
#name: Check if efi app format is recognized
diff --git a/binutils/testsuite/binutils-all/nm.exp b/binutils/testsuite/binutils-all/nm.exp
index c571520..1feb857 100644
--- a/binutils/testsuite/binutils-all/nm.exp
+++ b/binutils/testsuite/binutils-all/nm.exp
@@ -304,7 +304,6 @@ if [is_elf_format] {
setup_xfail "msp430*-*-*"
setup_xfail "kvx*-*-*"
setup_xfail "visium*-*-*"
- setup_xfail "x86_64-*-cloudabi*"
set testname "nm --ifunc-chars"
if {![binutils_assemble $srcdir/$subdir/ifunc.s tmpdir/ifunc.o]} then {
@@ -330,6 +329,23 @@ if [is_elf_format] {
fail "$testname (local ifunc)"
}
+ # PR 32556
+ # Test nm --ifunc-chars=--
+
+ set got [binutils_run $NM "$NMFLAGS --ifunc-chars=-- $tmpfile"]
+
+ if [regexp -line "^\\S+ - global_foo$" $got] then {
+ pass "$testname=-- (global ifunc)"
+ } else {
+ fail "$testname=-- (global ifunc)"
+ }
+
+ if [regexp -line "^\\S+ - local_foo$" $got] then {
+ pass "$testname=-- (local ifunc)"
+ } else {
+ fail "$testname=-- (local ifunc)"
+ }
+
if { $verbose < 1 } {
remote_file host delete "tmpdir/ifunc.o"
}
diff --git a/binutils/testsuite/binutils-all/objcopy.exp b/binutils/testsuite/binutils-all/objcopy.exp
index 89370bc..b11b17e 100644
--- a/binutils/testsuite/binutils-all/objcopy.exp
+++ b/binutils/testsuite/binutils-all/objcopy.exp
@@ -1313,6 +1313,7 @@ if [is_elf_format] {
run_dump_test "group-7b"
run_dump_test "group-7c"
run_dump_test "copy-1"
+ run_dump_test "copy-7"
run_dump_test "note-1"
# Use copytest.o from the note-1 test to determine ELF32 or ELF64
if [is_elf64 tmpdir/copytest.o] {
@@ -1462,18 +1463,23 @@ proc objcopy_test_without_global_symbol { } {
global OBJDUMPFLAGS
global srcdir
global subdir
+ global CFLAGS_FOR_TARGET
set test "strip without global symbol "
- if { [target_compile $srcdir/$subdir/pr19547.c tmpdir/pr19547.o object debug] != "" } {
+ set opts "debug"
+ if [string match "*-fsanitize=*" $CFLAGS_FOR_TARGET] {
+ append opts " additional_flags=-fno-sanitize=all"
+ }
+
+ set objfile tmpdir/pr19547.o
+ if { [target_compile $srcdir/$subdir/pr19547.c $objfile object $opts] != "" } {
untested $test
return
}
if [is_remote host] {
- set objfile [remote_download host tmpdir/pr19547.o]
- } else {
- set objfile tmpdir/pr19547.o
+ set objfile [remote_download host $objfile]
}
set exec_output [binutils_run $OBJCOPY "$OBJCOPYFLAGS --strip-unneeded $objfile"]
@@ -1566,3 +1572,33 @@ if { ![is_xcoff_format] } {
}
run_dump_test "rename-section-01"
+
+proc objcopy_tek2bin {} {
+ global OBJCOPY
+ global OBJDUMP
+ global srcdir
+ global subdir
+
+ set tek $srcdir/$subdir/tek2.obj
+ set out tmpdir/tek2bin
+ if [is_remote host] {
+ set tek [remote_download host $tek]
+ set out tek2bin
+ }
+
+ set got [binutils_run $OBJCOPY "-O binary $tek $out"]
+ if ![string equal "" $got] then {
+ send_log "$got\n"
+ fail "objcopy tek2bin"
+ } else {
+ set got [binutils_run $OBJDUMP "-s -b binary $out"]
+ if {![regexp ".* 0000 000031 .*" $got]} {
+ fail "objcopy tek2bin (objdump)"
+ } else {
+ pass "objcopy tek2bin"
+ }
+ }
+ remote_file host delete $out
+}
+
+objcopy_tek2bin
diff --git a/binutils/testsuite/binutils-all/readelf.exp b/binutils/testsuite/binutils-all/readelf.exp
index 571bb99..dcb63b1 100644
--- a/binutils/testsuite/binutils-all/readelf.exp
+++ b/binutils/testsuite/binutils-all/readelf.exp
@@ -317,24 +317,21 @@ proc readelf_thin_archive_test {} {
if ![is_remote host] {
set tempfile tmpdir/bintest.o
- set templib tmpdir/bintest.thin.a
set libname tmpdir/bintest.thin.a
} else {
set tempfile [remote_download host tmpdir/bintest.o]
- set templib [remote_download host tmpdir/bintest.thin.a]
set libname bintest.thin.a
}
set testname "readelf -h bintest.thin"
+ file_on_host delete $libname
set got [binutils_run $AR "rcT $libname ${tempfile}"]
if ![string match "" $got] {
fail $testname
return
}
- readelf_test -h $templib readelf.h.thin
-
- pass $testname
+ readelf_test -h $libname readelf.h.thin
}
if ![is_remote host] {
@@ -630,7 +627,7 @@ if ![is_remote host] {
}
# First, determine the size, so specific output matchers can be used.
-readelf_find_size $tempfile 2
+readelf_find_size $tempfile 4
# Make sure that readelf can decode the contents.
readelf_test -wi $tempfile dw5-op.W
diff --git a/binutils/testsuite/binutils-all/riscv/pei-riscv64.d b/binutils/testsuite/binutils-all/riscv/pei-riscv64.d
index 189b016..4316414 100644
--- a/binutils/testsuite/binutils-all/riscv/pei-riscv64.d
+++ b/binutils/testsuite/binutils-all/riscv/pei-riscv64.d
@@ -1,7 +1,7 @@
#as: -march=rv64gc -mabi=lp64d
#ld: -m elf64lriscv -e0
#PROG: objcopy
-#objcopy: -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel -j .rela -j .rel.* -j .rela.* -j .rel* -j .rela* -j .reloc --target=pei-riscv64-little
+#objcopy: -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel -j .rela -j .rel.* -j .rela.* -j .rel* -j .rela* -j .reloc --output-target=pei-riscv64-little
#objdump: -h -f
#name: Check if efi app format is recognized
diff --git a/binutils/testsuite/binutils-all/tek2.obj b/binutils/testsuite/binutils-all/tek2.obj
index da696d1..a4e29af 100644
--- a/binutils/testsuite/binutils-all/tek2.obj
+++ b/binutils/testsuite/binutils-all/tek2.obj
@@ -1,6 +1,6 @@
-%47615103000000000000000000000000000000000000000000000000000000000000000
-%103E95.data11011
+%47616100000310000000000000000000000000000000000000000000000000000000000
+%103EB5.data11013
%1E3FB5.data4F_binary_x_start10
-%1C3735.data4D_binary_x_end11
-%1D3135*ABS*2E_binary_x_size11
+%1C3755.data4D_binary_x_end13
+%1D3155*ABS*2E_binary_x_size13
%0781010
diff --git a/binutils/testsuite/binutils-all/testranges-ia64.d b/binutils/testsuite/binutils-all/testranges-ia64.d
index e1e29e7..26963c9 100644
--- a/binutils/testsuite/binutils-all/testranges-ia64.d
+++ b/binutils/testsuite/binutils-all/testranges-ia64.d
@@ -1,7 +1,7 @@
#PROG: objcopy
#source: testranges-ia64.s
#readelf: -wR --wide
-#name: unordered .debug_info references to .debug_ranges
+#name: unordered .debug_info references to .debug_ranges (ia64)
#target: ia64-*-*
Contents of the .debug_ranges section:
diff --git a/binutils/testsuite/binutils-all/x86-64/x86-64.exp b/binutils/testsuite/binutils-all/x86-64/x86-64.exp
index 6d1b308..3c98b03 100644
--- a/binutils/testsuite/binutils-all/x86-64/x86-64.exp
+++ b/binutils/testsuite/binutils-all/x86-64/x86-64.exp
@@ -295,7 +295,7 @@ proc run_pr33230_test { testname obj strip_flags run_readelf } {
fail "$testname (${obj}.strip)"
return
}
- } elseif { ![regexp "Unable to recognise the format" $got] } then {
+ } elseif { ![regexp "Unable to recognise the architecture" $got] } then {
send_log "$got\n"
verbose "$got" 1
fail "$testname"
diff --git a/binutils/testsuite/lib/binutils-common.exp b/binutils/testsuite/lib/binutils-common.exp
index 7297f6d..fb12607 100644
--- a/binutils/testsuite/lib/binutils-common.exp
+++ b/binutils/testsuite/lib/binutils-common.exp
@@ -32,7 +32,6 @@ proc is_elf_format {} {
# && ![istarget *-*-windiss*]
if { ![istarget *-*-chorus*]
- && ![istarget *-*-cloudabi*]
&& ![istarget *-*-eabi*]
&& ![istarget *-*-*elf*]
&& ![istarget *-*-*freebsd*]
@@ -1175,17 +1174,17 @@ proc run_dump_test { name {extra_options {}} } {
[big_or_little_endian] opts(ld)
if { $opts(name) == "" } {
- set testname "$subdir/$name"
+ set base_testname "$subdir/$name"
} else {
- set testname $opts(name)
+ set base_testname $opts(name)
}
set err_warn 0
foreach opt { warning error warning_output error_output } {
if { $opts($opt) != "" } {
if { $err_warn } {
- perror "$testname: bad mix of warning and error test directives"
- unresolved $testname
+ perror "$base_testname: bad mix of warning and error test directives"
+ unresolved $base_testname
return
}
set err_warn 1
@@ -1224,19 +1223,19 @@ proc run_dump_test { name {extra_options {}} } {
}
}
if { $targmatch == 0 } {
- unsupported $testname
+ unsupported $base_testname
return
}
}
foreach targ $opts(alltargets) {
if ![match_target $targ] {
- unsupported $testname
+ unsupported $base_testname
return
}
}
foreach targ $opts(notarget) {
if [match_target $targ] {
- unsupported $testname
+ unsupported $base_testname
return
}
}
@@ -1254,7 +1253,7 @@ proc run_dump_test { name {extra_options {}} } {
size { set dumpprogram size }
default {
perror "unrecognized DUMPPROG option $opts(DUMPPROG) in $file.d"
- unresolved $testname
+ unresolved $base_testname
return
}
}
@@ -1264,7 +1263,7 @@ proc run_dump_test { name {extra_options {}} } {
if {$opts($p) != ""} {
if {$dumpprogram != ""} {
perror "ambiguous dump program in $file.d"
- unresolved $testname
+ unresolved $base_testname
return
} else {
set dumpprogram $p
@@ -1274,7 +1273,7 @@ proc run_dump_test { name {extra_options {}} } {
}
if { $dumpprogram == "" && $opts(map) == "" && !$err_warn } {
perror "dump program unspecified in $file.d"
- unresolved $testname
+ unresolved $base_testname
return
}
}
@@ -1313,7 +1312,7 @@ proc run_dump_test { name {extra_options {}} } {
if { $cmdret != 0} {
send_log "compilation of $cfile failed, exit status $cmdret with <$comp_output>"
# Should this be 'unresolved', or is that too silent?
- fail $testname
+ fail $base_testname
return 0
}
}
@@ -1356,6 +1355,11 @@ proc run_dump_test { name {extra_options {}} } {
}
foreach as_flags $as_final_flags {
+ if { [llength $as_final_flags] > 1 } {
+ set testname [concat $base_testname $as_flags]
+ } else {
+ set testname $base_testname
+ }
# Assemble each file.
set objfiles {}
for { set i 0 } { $i < [llength $sourcefiles] } { incr i } {