diff options
Diffstat (limited to 'binutils/testsuite')
6 files changed, 173 insertions, 5 deletions
diff --git a/binutils/testsuite/binutils-all/objcopy.exp b/binutils/testsuite/binutils-all/objcopy.exp index ff93fea..6aa6d2d 100644 --- a/binutils/testsuite/binutils-all/objcopy.exp +++ b/binutils/testsuite/binutils-all/objcopy.exp @@ -180,7 +180,7 @@ proc objcopy_test_verilog {testname} { untested "verilog width-4 and width-8 tests" return } - + foreach width {4 8} { set got [binutils_run $OBJCOPY "-O verilog --verilog-data-width $width $binfile $verilog-$width.hex"] if ![string equal "" $got] then { @@ -194,7 +194,7 @@ proc objcopy_test_verilog {testname} { } } - # Test generating endian correct output. + # Test generating endian correct output. set testname "objcopy (verilog output endian-ness == input endian-ness)" set got [binutils_run $OBJCOPY "-O verilog --verilog-data-width 4 $binfile $verilog-I4.hex"] if ![string equal "" $got] then { @@ -202,9 +202,9 @@ proc objcopy_test_verilog {testname} { } send_log "regexp_diff $verilog-I4.hex $srcdir/$subdir/verilog-I4.hex\n" if {! [regexp_diff "$verilog-I4.hex" "$srcdir/$subdir/verilog-I4.hex"]} { - pass $testname + pass $testname } else { - fail $testname + fail $testname } } @@ -661,6 +661,87 @@ proc strip_test_with_saving_a_symbol { } { strip_test_with_saving_a_symbol +# Test stripping an archive. + +proc strip_test_archive { } { + global AR + global CC + global STRIP + global srcdir + global subdir + + set test "strip -g on archive" + + if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog.o object debug] != "" } { + untested $test + return + } + + set stripobjfile tmpdir/striptestprog.o + set stripobjarchive testprog.o + if [is_remote host] { + set archive libstrip.a + set objfile [remote_download host tmpdir/testprog.o] + remote_file host delete $archive + remote_file host delete $stripobjfile + remote_file host delete $stripobjarchive + } else { + set archive tmpdir/libstrip.a + set objfile tmpdir/testprog.o + remote_file build delete $stripobjfile + remote_file build delete $stripobjarchive + } + + remote_file build delete tmpdir/libstrip.a + + set exec_output [binutils_run $STRIP "-g -o $stripobjfile $objfile"] + set exec_output [prune_warnings $exec_output] + if ![string equal "" $exec_output] { + fail $test + return + } + + set exec_output [binutils_run $AR "rc $archive ${objfile}"] + set exec_output [prune_warnings $exec_output] + if ![string equal "" $exec_output] { + fail $test + return + } + + set exec_output [binutils_run $STRIP "-g $archive"] + set exec_output [prune_warnings $exec_output] + if ![string equal "" $exec_output] { + fail $test + return + } + + set exec_output [binutils_run $AR "x $archive"] + set exec_output [prune_warnings $exec_output] + if ![string equal "" $exec_output] { + fail $test + return + } + + if [is_remote host] { + set stripobjfile [remote_download host $stripobjfile] + set stripobjarchive [remote_download host $stripobjarchive] + } + + send_log "cmp $stripobjarchive $stripobjfile\n" + verbose "cmp $stripobjarchive $stripobjfile" + set status [remote_exec build cmp "$stripobjarchive $stripobjfile"] + set exec_output [lindex $status 1] + set exec_output [prune_warnings $exec_output] + + if [string equal "" $exec_output] then { + pass $test + } else { + fail $test + } +} + +strip_test_archive + # Build a final executable. set exe [exeext] diff --git a/binutils/testsuite/binutils-all/riscv/property-cfi-lp-unlabeled.d b/binutils/testsuite/binutils-all/riscv/property-cfi-lp-unlabeled.d new file mode 100644 index 0000000..396b4cd --- /dev/null +++ b/binutils/testsuite/binutils-all/riscv/property-cfi-lp-unlabeled.d @@ -0,0 +1,8 @@ +#as: -defsym __property_zicfilp_unlabeled__=1 -march=rv64i -mabi=lp64 +#readelf: -n +#source: property.s + +Displaying notes found in: .note.gnu.property +[ ]+Owner[ ]+Data size[ ]+Description +[ ]+GNU[ ]+0x00000010[ ]+NT_GNU_PROPERTY_TYPE_0 +[ ]+Properties: RISC-V AND feature: CFI_LP_UNLABELED diff --git a/binutils/testsuite/binutils-all/riscv/property-cfi-ss.d b/binutils/testsuite/binutils-all/riscv/property-cfi-ss.d new file mode 100644 index 0000000..5bc844a --- /dev/null +++ b/binutils/testsuite/binutils-all/riscv/property-cfi-ss.d @@ -0,0 +1,8 @@ +#as: -defsym __property_zicfiss__=1 -march=rv64i -mabi=lp64 +#readelf: -n +#source: property.s + +Displaying notes found in: .note.gnu.property +[ ]+Owner[ ]+Data size[ ]+Description +[ ]+GNU[ ]+0x00000010[ ]+NT_GNU_PROPERTY_TYPE_0 +[ ]+Properties: RISC-V AND feature: CFI_SS diff --git a/binutils/testsuite/binutils-all/riscv/property.s b/binutils/testsuite/binutils-all/riscv/property.s new file mode 100644 index 0000000..1b62654 --- /dev/null +++ b/binutils/testsuite/binutils-all/riscv/property.s @@ -0,0 +1,41 @@ + .text + .globl _start + .type _start,@function +_start: + ret + +.ifdef __property_zicfilp_unlabeled__ + .section ".note.gnu.property", "a" + .p2align 3 + .long 1f - 0f /* name length */ + .long 5f - 2f /* data length */ + .long 5 /* note type */ +0: .asciz "GNU" /* vendor name */ +1: + .p2align 3 +2: .long 0xc0000000 /* pr_type. */ + .long 4f - 3f /* pr_datasz. */ +3: + .long 0x1 /* GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_UNLABELED. */ +4: + .p2align 3 +5: +.endif + +.ifdef __property_zicfiss__ + .section ".note.gnu.property", "a" + .p2align 3 + .long 1f - 0f /* name length */ + .long 5f - 2f /* data length */ + .long 5 /* note type */ +0: .asciz "GNU" /* vendor name */ +1: + .p2align 3 +2: .long 0xc0000000 /* pr_type. */ + .long 4f - 3f /* pr_datasz. */ +3: + .long 0x2 /* GNU_PROPERTY_RISCV_FEATURE_1_CFI_SS. */ +4: + .p2align 3 +5: +.endif diff --git a/binutils/testsuite/binutils-all/x86-64/x86-64.exp b/binutils/testsuite/binutils-all/x86-64/x86-64.exp index 2df0269..05c7304 100644 --- a/binutils/testsuite/binutils-all/x86-64/x86-64.exp +++ b/binutils/testsuite/binutils-all/x86-64/x86-64.exp @@ -81,7 +81,7 @@ if {[catch "system \"bzip2 -dc $t > $tempfile\""] != 0} { fail $testname } else { send_log "cmp tmpdir/pr27708.out $srcdir/$subdir/pr27708.dump\n" - verbose "cmp tmpdir/pr27708.out $srcdir/$subdir/pr26808.dump" 1 + verbose "cmp tmpdir/pr27708.out $srcdir/$subdir/pr27708.dump" 1 set status [remote_exec build cmp "tmpdir/pr27708.out $srcdir/$subdir/pr27708.dump"] set exec_output [lindex $status 1] set exec_output [prune_warnings $exec_output] diff --git a/binutils/testsuite/lib/binutils-common.exp b/binutils/testsuite/lib/binutils-common.exp index 41d94d2..2da7138 100644 --- a/binutils/testsuite/lib/binutils-common.exp +++ b/binutils/testsuite/lib/binutils-common.exp @@ -480,6 +480,36 @@ proc supports_dt_relr {} { return 0 } +# Whether a target assembler supports --gsframe. +proc gas_sframe_check {} { + global check_as_sframe_result + global AS + global ASFLAGS + if [info exists check_as_sframe_result] { + return $check_as_sframe_result + } + + set as_file "tmpdir/check_as_sframe.s" + set as_fh [open $as_file w 0666] + puts $as_fh "# Generated file. DO NOT EDIT" + puts $as_fh "\t.cfi_startproc" + puts $as_fh "\t.cfi_endproc" + close $as_fh + remote_download host $as_file + verbose -log "Checking SFrame support in AS:" + + set status [remote_exec host "$AS $ASFLAGS --gsframe $as_file"] + + if { [lindex $status 0] != 0 } then { + verbose -log "SFrame not supported in AS" + set check_as_sframe_result 0 + } else { + verbose -log "SFrame supported in AS" + set check_as_sframe_result 1 + } + return $check_as_sframe_result +} + # get_relative_path FROM TO # # Return a relative path to TO starting from FROM, which is usually |