aboutsummaryrefslogtreecommitdiff
path: root/binutils/testsuite/binutils-all
diff options
context:
space:
mode:
Diffstat (limited to 'binutils/testsuite/binutils-all')
-rw-r--r--binutils/testsuite/binutils-all/link-order.s2
-rw-r--r--binutils/testsuite/binutils-all/objcopy.exp2
-rw-r--r--binutils/testsuite/binutils-all/x86-64/objdump-sframe-01.d18
-rw-r--r--binutils/testsuite/binutils-all/x86-64/pr33198.c4
-rw-r--r--binutils/testsuite/binutils-all/x86-64/pr33230.obj.bz2bin0 -> 411 bytes
-rw-r--r--binutils/testsuite/binutils-all/x86-64/readelf-sframe-01.d18
-rw-r--r--binutils/testsuite/binutils-all/x86-64/sframe-func.s11
-rw-r--r--binutils/testsuite/binutils-all/x86-64/x86-64.exp227
8 files changed, 280 insertions, 2 deletions
diff --git a/binutils/testsuite/binutils-all/link-order.s b/binutils/testsuite/binutils-all/link-order.s
index 5994cb8..918cd06 100644
--- a/binutils/testsuite/binutils-all/link-order.s
+++ b/binutils/testsuite/binutils-all/link-order.s
@@ -5,7 +5,7 @@
foo:
.prologue 2, 2
.vframe r2
- mov r2 = r12
+ mov r2 = r12;;
.body
.restore sp
mov r12 = r2
diff --git a/binutils/testsuite/binutils-all/objcopy.exp b/binutils/testsuite/binutils-all/objcopy.exp
index 6aa6d2d..89370bc 100644
--- a/binutils/testsuite/binutils-all/objcopy.exp
+++ b/binutils/testsuite/binutils-all/objcopy.exp
@@ -1293,7 +1293,7 @@ proc objcopy_test_elf_common_symbols {} {
# ia64 specific tests
if { ([istarget "ia64-*-elf*"]
|| [istarget "ia64-*-linux*"]) } {
- objcopy_test "ia64 link order" link-order.s object "" ""
+ objcopy_test "ia64 link order" link-order.s object "-x" ""
}
# ELF specific tests
diff --git a/binutils/testsuite/binutils-all/x86-64/objdump-sframe-01.d b/binutils/testsuite/binutils-all/x86-64/objdump-sframe-01.d
new file mode 100644
index 0000000..cca83cb
--- /dev/null
+++ b/binutils/testsuite/binutils-all/x86-64/objdump-sframe-01.d
@@ -0,0 +1,18 @@
+#PROG:objcopy
+#name: objdump dump SFrame section .sframe2
+#source: sframe-func.s
+#as: --gsframe
+#objcopy: --rename-section .sframe=.sframe2
+#objdump: --sframe=.sframe2
+#target: x86_64-*-*
+#xfail: ![gas_sframe_check]
+
+#...
+ Header :
+
+ Version: SFRAME_VERSION_2
+ Flags: SFRAME_F_FDE_FUNC_START_PCREL
+ CFA fixed RA offset: -8
+ Num FDEs: 1
+ Num FREs: 4
+#pass
diff --git a/binutils/testsuite/binutils-all/x86-64/pr33198.c b/binutils/testsuite/binutils-all/x86-64/pr33198.c
new file mode 100644
index 0000000..cd0130c
--- /dev/null
+++ b/binutils/testsuite/binutils-all/x86-64/pr33198.c
@@ -0,0 +1,4 @@
+void
+foo (void)
+{
+}
diff --git a/binutils/testsuite/binutils-all/x86-64/pr33230.obj.bz2 b/binutils/testsuite/binutils-all/x86-64/pr33230.obj.bz2
new file mode 100644
index 0000000..6309a2a
--- /dev/null
+++ b/binutils/testsuite/binutils-all/x86-64/pr33230.obj.bz2
Binary files differ
diff --git a/binutils/testsuite/binutils-all/x86-64/readelf-sframe-01.d b/binutils/testsuite/binutils-all/x86-64/readelf-sframe-01.d
new file mode 100644
index 0000000..a6973d8
--- /dev/null
+++ b/binutils/testsuite/binutils-all/x86-64/readelf-sframe-01.d
@@ -0,0 +1,18 @@
+#PROG:objcopy
+#name: readelf dump SFrame section .sframe2
+#source: sframe-func.s
+#as: --gsframe
+#objcopy: --rename-section .sframe=.sframe2
+#readelf: --sframe=.sframe2
+#target: x86_64-*-*
+#xfail: ![gas_sframe_check]
+
+#...
+ Header :
+
+ Version: SFRAME_VERSION_2
+ Flags: SFRAME_F_FDE_FUNC_START_PCREL
+ CFA fixed RA offset: -8
+ Num FDEs: 1
+ Num FREs: 4
+#pass
diff --git a/binutils/testsuite/binutils-all/x86-64/sframe-func.s b/binutils/testsuite/binutils-all/x86-64/sframe-func.s
new file mode 100644
index 0000000..cbd83c3
--- /dev/null
+++ b/binutils/testsuite/binutils-all/x86-64/sframe-func.s
@@ -0,0 +1,11 @@
+ .cfi_sections .sframe
+ .cfi_startproc
+ .long 8
+ .cfi_def_cfa_offset 16
+ .cfi_offset 6, -16
+ .long 8
+ .cfi_def_cfa_register 6
+ .long 8
+ .cfi_def_cfa 7, 8
+ .long 8
+ .cfi_endproc
diff --git a/binutils/testsuite/binutils-all/x86-64/x86-64.exp b/binutils/testsuite/binutils-all/x86-64/x86-64.exp
index 05c7304..6d1b308 100644
--- a/binutils/testsuite/binutils-all/x86-64/x86-64.exp
+++ b/binutils/testsuite/binutils-all/x86-64/x86-64.exp
@@ -96,3 +96,230 @@ if {[catch "system \"bzip2 -dc $t > $tempfile\""] != 0} {
}
}
}
+
+proc run_pr33198_test { fat strip_flags } {
+ global srcdir
+ global subdir
+ global llvm_plug_opt
+ global AR
+ global CLANG_FOR_TARGET
+ global NM
+ global READELF
+ global STRIP
+
+ set test pr33198
+ set testname "${test}${fat} with $strip_flags"
+
+ if { [istarget "x86_64-*-linux*-gnux32"] \
+ || ![info exists CLANG_FOR_TARGET]
+ || [string match "" $llvm_plug_opt] } then {
+ untested $testname
+ return
+ }
+
+ set src $srcdir/$subdir/${test}.c
+ set obj tmpdir/${test}${fat}.o
+ set archive tmpdir/${test}${fat}.a
+ set CLANG_CFLAGS "-c -O2 -flto"
+ if { "$fat" == "-fat" } {
+ append CLANG_CFLAGS " -ffat-lto-objects"
+ }
+
+ append strip_flags " --strip-unneeded $llvm_plug_opt"
+
+ set cmd "$CLANG_FOR_TARGET $CLANG_CFLAGS -o $obj $src"
+ send_log "$cmd\n"
+ verbose "$cmd" 1
+ catch "exec $cmd" got
+ if ![string match "" $got] then {
+ send_log "$got\n"
+ verbose "$got" 1
+ fail "$testname ($obj)"
+ return
+ }
+
+ set cmd "$NM $llvm_plug_opt $obj\n"
+ send_log "$cmd\n"
+ verbose "$cmd" 1
+ catch "exec $cmd" got
+ if ![regexp "0+ T foo" $got] then {
+ send_log "$got\n"
+ verbose "$got" 1
+ fail "$testname ($obj)"
+ return
+ }
+
+ pass "$testname ($obj)"
+
+ set cmd "$STRIP $strip_flags $obj -o ${obj}.strip"
+ send_log "$cmd\n"
+ verbose "$cmd" 1
+ catch "exec $cmd" got
+ if ![string match "" $got] then {
+ send_log "$got\n"
+ verbose "$got" 1
+ fail "$testname (strip $obj)"
+ return
+ }
+
+ set cmd "$NM $llvm_plug_opt ${obj}.strip"
+ send_log "$cmd\n"
+ verbose "$cmd" 1
+ catch "exec $cmd" got
+ if ![regexp "0+ T foo" $got] then {
+ send_log "$got\n"
+ verbose "$got" 1
+ fail "$testname (strip $obj)"
+ return
+ }
+
+ if { "$fat" == "-fat" } {
+ set cmd "$READELF -SW ${obj}.strip"
+ send_log "$cmd\n"
+ verbose "$cmd" 1
+ catch "exec $cmd" got
+ if [regexp "\.llvm\.lto *LLVM_LTO *" $got] then {
+ send_log "$got\n"
+ verbose "$got" 1
+ fail "$testname (strip $obj)"
+ return
+ }
+ }
+
+ pass "$testname (strip $obj)"
+
+ set cmd "$AR $llvm_plug_opt -s -r -c $archive $obj"
+ send_log "$cmd\n"
+ verbose "$cmd" 1
+ catch "exec $cmd" got
+ if ![string match "" $got] then {
+ send_log "$got\n"
+ verbose "$got" 1
+ fail "$testname ($archive)"
+ return
+ }
+
+ set cmd "$NM $llvm_plug_opt $archive\n"
+ send_log "$cmd\n"
+ verbose "$cmd" 1
+ catch "exec $cmd" got
+ if ![regexp "0+ T foo" $got] then {
+ send_log "$got\n"
+ verbose "$got" 1
+ fail "$testname ($archive)"
+ return
+ }
+
+ pass "$testname ($archive)"
+
+ set cmd "$STRIP $strip_flags $archive -o ${archive}.strip"
+ send_log "$cmd\n"
+ verbose "$cmd" 1
+ catch "exec $cmd" got
+ if ![string match "" $got] then {
+ send_log "$got\n"
+ verbose "$got" 1
+ fail "$testname (strip $archive)"
+ return
+ }
+
+ set cmd "$NM $llvm_plug_opt ${archive}.strip"
+ send_log "$cmd\n"
+ verbose "$cmd" 1
+ catch "exec $cmd" got
+ if ![regexp "0+ T foo" $got] then {
+ send_log "$got\n"
+ verbose "$got" 1
+ fail "$testname (strip $archive)"
+ return
+ }
+
+ if { "$fat" == "-fat" } {
+ set cmd "$READELF -SW ${archive}.strip"
+ send_log "$cmd\n"
+ verbose "$cmd" 1
+ catch "exec $cmd" got
+ if [regexp "\.llvm\.lto *LLVM_LTO *" $got] then {
+ send_log "$got\n"
+ verbose "$got" 1
+ fail "$testname (strip $archive)"
+ return
+ }
+ }
+
+ pass "$testname (strip $archive)"
+}
+
+run_pr33198_test "" "-R .gnu.lto_* -R .gnu.debuglto_* -R .llvm.lto -N __gnu_lto_v1"
+run_pr33198_test "-fat" "-R .gnu.lto_* -R .gnu.debuglto_* -R .llvm.lto -N __gnu_lto_v1"
+run_pr33198_test "" "-R .llvm.lto"
+run_pr33198_test "-fat" "-R .llvm.lto"
+
+proc run_pr33230_test { testname obj strip_flags run_readelf } {
+ global srcdir
+ global subdir
+ global READELF
+ global STRIP
+
+ append strip_flags " --strip-debug"
+ append testname " ($strip_flags)"
+
+ set cmd "$STRIP $strip_flags $obj -o ${obj}.strip"
+ send_log "$cmd\n"
+ verbose "$cmd" 1
+ catch "exec $cmd" got
+ if { $run_readelf == "yes" } {
+ if ![string match "" $got] then {
+ send_log "$got\n"
+ verbose "$got" 1
+ fail "$testname (${obj})"
+ return
+ }
+ set cmd "$READELF -h $obj"
+ send_log "$cmd\n"
+ verbose "$cmd" 1
+ catch "exec $cmd" got
+ if { ![regexp "Machine: +AArch64" $got] } then {
+ send_log "$got\n"
+ verbose "$got" 1
+ fail "$testname (${obj})"
+ return
+ }
+ set cmd "$READELF -h ${obj}.strip"
+ send_log "$cmd\n"
+ verbose "$cmd" 1
+ catch "exec $cmd" got
+ if { ![regexp "Machine: +AArch64" $got] } then {
+ send_log "$got\n"
+ verbose "$got" 1
+ fail "$testname (${obj}.strip)"
+ return
+ }
+ } elseif { ![regexp "Unable to recognise the format" $got] } then {
+ send_log "$got\n"
+ verbose "$got" 1
+ fail "$testname"
+ return
+ }
+
+ pass "$testname"
+}
+
+set t $srcdir/$subdir/pr33230.obj.bz2
+# We need to strip the ".bz2", but can leave the dirname.
+set test $subdir/[file tail $t]
+set testname [file rootname $test]
+verbose $testname
+set obj tmpdir/pr33230.o
+if {[catch "system \"bzip2 -dc $t > $obj\""] != 0} {
+ untested "bzip2 -dc ($testname)"
+} else {
+ catch "exec $STRIP --help" got
+ if { [regexp "elf64-littleaarch64" $got] } {
+ set run_readelf "yes"
+ } else {
+ set run_readelf "no"
+ }
+ run_pr33230_test "$testname" $obj "" $run_readelf
+ run_pr33230_test "$testname" $obj "--input-target=default" $run_readelf
+}