diff options
Diffstat (limited to 'binutils')
-rw-r--r-- | binutils/ChangeLog | 8 | ||||
-rw-r--r-- | binutils/testsuite/binutils-all/arc/double_store.s | 6 | ||||
-rw-r--r-- | binutils/testsuite/binutils-all/arc/objdump.exp | 73 |
3 files changed, 70 insertions, 17 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 14cfcff..d8577b0 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,11 @@ +2017-06-29 Anton Kolesov <Anton.Kolesov@synopsys.com> + + * testsuite/binutils-all/arc/double_store.s: New file. + * testsuite/binutils-all/arc/objdump.exp: Tests for disassembler + options. + (do_objfile): New function. + (check_assembly): Likewise. + 2017-06-29 Andreas Arnez <arnez@linux.vnet.ibm.com> * readelf.c (get_note_type): Add NT_S390_GS_CB and NT_S390_GS_BC. diff --git a/binutils/testsuite/binutils-all/arc/double_store.s b/binutils/testsuite/binutils-all/arc/double_store.s new file mode 100644 index 0000000..794d7e8 --- /dev/null +++ b/binutils/testsuite/binutils-all/arc/double_store.s @@ -0,0 +1,6 @@ +.cpu HS +.section .text +.global __start +__start: + std r0r1, [r3] + diff --git a/binutils/testsuite/binutils-all/arc/objdump.exp b/binutils/testsuite/binutils-all/arc/objdump.exp index ca36431..2037b2b 100644 --- a/binutils/testsuite/binutils-all/arc/objdump.exp +++ b/binutils/testsuite/binutils-all/arc/objdump.exp @@ -25,31 +25,70 @@ if {[which $OBJDUMP] == 0} then { send_user "Version [binutil_version $OBJDUMP]" -########################### -# Set up the test of dsp.s -########################### +# Helper functions -if {![binutils_assemble $srcdir/$subdir/dsp.s tmpdir/dsp.o]} then { - return +# Create object file from the assembly source. +proc do_objfile { srcfile } { + global srcdir + global subdir + + set objfile [regsub -- "\.s$" $srcfile ".o"] + + if {![binutils_assemble $srcdir/$subdir/$srcfile tmpdir/$objfile]} then { + return + } + + if [is_remote host] { + set objfile [remote_download host tmpdir/$objfile] + } else { + set objfile tmpdir/$objfile + } + + return $objfile } -if [is_remote host] { - set objfile [remote_download host tmpdir/dsp.o] -} else { - set objfile tmpdir/dsp.o +# Ensure that disassembler output includes EXPECTED lines. +proc check_assembly { testname objfile expected { disas_flags "" } } { + global OBJDUMP + global OBJDUMPFLAGS + + set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS --disassemble $disas_flags \ + $objfile"] + + if [regexp $expected $got] then { + pass $testname + } else { + fail $testname + } } # Make sure that a warning message is generated (because the disassembly does # not match the assembled instructions, which has happened because the user # has not specified a -M option on the disassembler command line, and so the # disassembler has had to guess as the instruction class in use). - -set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS --disassemble $objfile"] - set want "Warning: disassembly.*vmac2hnfr\[ \t\]*r0,r2,r4.*dmulh12.f\[ \t\]*r0,r2,r4.*dmulh11.f" +check_assembly "Warning test" [do_objfile dsp.s] $want + +set double_store_hs_expected {std\s*r0r1,\[r3\]} +set objfile [do_objfile double_store.s] +check_assembly "arc double_store default -M" $objfile \ + $double_store_hs_expected +check_assembly "arc double_store -Mcpu=hs" $objfile \ + $double_store_hs_expected "-Mcpu=hs" +check_assembly "arc double_store -Mcpu=hs38_linux" $objfile \ + $double_store_hs_expected "-Mcpu=hs38_linux" +set double_store_em_expected ".long 0x1b000006" +check_assembly "arc double_store -Mcpu=em" $objfile \ + $double_store_em_expected "-Mcpu=em" +check_assembly "arc double_store -Mcpu=em4_dmips" $objfile \ + $double_store_em_expected "-Mcpu=em4_dmips" +# Test to ensure that only value up to the next `,' is checked. There used to +# be a bug, where whole `em,fpus' was compared against known CPU values, and +# that comparison would fail. When this bug is present, whole cpu= option will +# be ignored and instruction will be disassembled as ARC HS. +check_assembly "arc double_store -Mcpu=em,fpus" $objfile \ + $double_store_em_expected "-Mcpu=em,fpus" +# Make sure that the last cpu= value is used. +check_assembly "arc double_store -Mcpu=hs,cpu=em" $objfile \ + $double_store_em_expected "-Mcpu=hs,cpu=em" -if [regexp $want $got] then { - pass "Warning test" -} else { - fail "Warning test" -} |