From 2ae0bdddef8193e3d2ffc352f4fc035808b5fce4 Mon Sep 17 00:00:00 2001 From: Max Filippov Date: Sun, 22 Jul 2018 21:45:48 -0700 Subject: [PATCH] xtensa: ld: convert tests to run_dump_test Three tests with individual .exp files can be implemented in less verbose way with run_dump_test infrastructure. Convert them. ld/ 2018-07-23 Max Filippov * testsuite/ld-xtensa/coalesce.d: New file. * testsuite/ld-xtensa/coalesce.exp: Remove file. * testsuite/ld-xtensa/diff_overflow.d: New file. * testsuite/ld-xtensa/diff_overflow.exp: Remove file. * testsuite/ld-xtensa/lcall.d: New file. * testsuite/ld-xtensa/lcall.exp: Remove file. * testsuite/ld-xtensa/xtensa.exp (coalesce, diff_overflow) (lcall): New tests. --- ld/ChangeLog | 11 +++ ld/testsuite/ld-xtensa/coalesce.d | 7 ++ ld/testsuite/ld-xtensa/coalesce.exp | 99 -------------------- ld/testsuite/ld-xtensa/diff_overflow.d | 6 ++ ld/testsuite/ld-xtensa/diff_overflow.exp | 45 --------- ld/testsuite/ld-xtensa/lcall.d | 10 ++ ld/testsuite/ld-xtensa/lcall.exp | 113 ----------------------- ld/testsuite/ld-xtensa/xtensa.exp | 4 + 8 files changed, 38 insertions(+), 257 deletions(-) create mode 100644 ld/testsuite/ld-xtensa/coalesce.d delete mode 100644 ld/testsuite/ld-xtensa/coalesce.exp create mode 100644 ld/testsuite/ld-xtensa/diff_overflow.d delete mode 100644 ld/testsuite/ld-xtensa/diff_overflow.exp create mode 100644 ld/testsuite/ld-xtensa/lcall.d delete mode 100644 ld/testsuite/ld-xtensa/lcall.exp diff --git a/ld/ChangeLog b/ld/ChangeLog index acfebc8d2f9..20c987ca58f 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,14 @@ +2018-07-23 Max Filippov + + * testsuite/ld-xtensa/coalesce.d: New file. + * testsuite/ld-xtensa/coalesce.exp: Remove file. + * testsuite/ld-xtensa/diff_overflow.d: New file. + * testsuite/ld-xtensa/diff_overflow.exp: Remove file. + * testsuite/ld-xtensa/lcall.d: New file. + * testsuite/ld-xtensa/lcall.exp: Remove file. + * testsuite/ld-xtensa/xtensa.exp (coalesce, diff_overflow) + (lcall): New tests. + 2018-07-23 Max Filippov * testsuite/ld-xtensa/relax-static-defs.s: New file. diff --git a/ld/testsuite/ld-xtensa/coalesce.d b/ld/testsuite/ld-xtensa/coalesce.d new file mode 100644 index 00000000000..2041a64db43 --- /dev/null +++ b/ld/testsuite/ld-xtensa/coalesce.d @@ -0,0 +1,7 @@ +#source: coalesce1.s +#source: coalesce2.s +#ld: -T coalesce.t +#objdump: -d +#... +0000000c
: +#... diff --git a/ld/testsuite/ld-xtensa/coalesce.exp b/ld/testsuite/ld-xtensa/coalesce.exp deleted file mode 100644 index 16756cc4f6f..00000000000 --- a/ld/testsuite/ld-xtensa/coalesce.exp +++ /dev/null @@ -1,99 +0,0 @@ -# Test literal coaslescing for Xtensa targets. -# By David Heine, Tensilica, Inc. -# Copyright (C) 2002-2018 Free Software Foundation, Inc. -# -# This file is part of the GNU Binutils. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, -# MA 02110-1301, USA. - -if ![istarget "xtensa*-*-*"] { - return -} - -set testname "COALESCE" - -set OBJDUMPFLAGS "-dr" - -# -# default_ld_objdump -# run objdump on a file -# -proc default_ld_objdump { objdump object outputfile } { - global OBJDUMPFLAGS - global objdump_output - global host_triplet - - if {[which $objdump] == 0} then { - perror "$objdump does not exist" - return 0 - } - - if ![info exists OBJDUMPFLAGS] { set OBJDUMPFLAGS "" } - - verbose -log "$objdump $OBJDUMPFLAGS $object >$outputfile" - - catch "exec $objdump $OBJDUMPFLAGS $object >$outputfile" exec_output - set exec_output [prune_warnings $exec_output] - if [string match "" $exec_output] then { - return 1 - } else { - verbose -log "$exec_output" - perror "$object: objdump failed" - return 0 - } -} - - -if ![ld_assemble $as $srcdir/$subdir/coalesce1.s tmpdir/coalesce1.o] { - unresolved $testname - return -} -if ![ld_assemble $as $srcdir/$subdir/coalesce2.s tmpdir/coalesce2.o] { - unresolved $testname - return -} - -set object "tmpdir/coalesce" -set outputfile "$object.txt" - -if ![ld_link $ld $object "-T $srcdir/$subdir/coalesce.t tmpdir/coalesce1.o tmpdir/coalesce2.o"] { - verbose -log "failure in ld" - fail $testname - return -} - -if ![default_ld_objdump $objdump $object $outputfile ] { - verbose -log "failure in objdump" - fail $testname - return -} - -set file [open $outputfile r] -set found 0 - -while { [gets $file line] != -1 } { - # verbose "$line" 2 - if [regexp "^0000000c
:" $line] { - set found 1 - } -} -close $file -if $found { - pass $testname -} else { - fail $testname -} - diff --git a/ld/testsuite/ld-xtensa/diff_overflow.d b/ld/testsuite/ld-xtensa/diff_overflow.d new file mode 100644 index 00000000000..037c7e3e4f7 --- /dev/null +++ b/ld/testsuite/ld-xtensa/diff_overflow.d @@ -0,0 +1,6 @@ +#source: diff_overflow1.s +#source: diff_overflow2.s +#as: --text-section-literals +#ld: +#objdump: -d +#... diff --git a/ld/testsuite/ld-xtensa/diff_overflow.exp b/ld/testsuite/ld-xtensa/diff_overflow.exp deleted file mode 100644 index 524fa2a8c20..00000000000 --- a/ld/testsuite/ld-xtensa/diff_overflow.exp +++ /dev/null @@ -1,45 +0,0 @@ -# Test DIFF* relocation signedness and overflow checking -# By Max Filippov, Cadence Design Systems, Inc. -# Copyright (C) 2014-2018 Free Software Foundation, Inc. -# -# This file is part of the GNU Binutils. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, -# MA 02110-1301, USA. - -if ![istarget "xtensa*-*-*"] { - return -} - -set testname "DIFF_OVERFLOW" - -if ![ld_assemble $as "--text-section-literals $srcdir/$subdir/diff_overflow1.s" tmpdir/diff_overflow1.o] { - unresolved $testname - return -} -if ![ld_assemble $as "--text-section-literals $srcdir/$subdir/diff_overflow2.s" tmpdir/diff_overflow2.o] { - unresolved $testname - return -} - -set object "tmpdir/diff_overflow" - -if ![ld_link $ld $object "tmpdir/diff_overflow1.o tmpdir/diff_overflow2.o"] { - verbose -log "failure in ld" - fail $testname - return -} - -pass $testname diff --git a/ld/testsuite/ld-xtensa/lcall.d b/ld/testsuite/ld-xtensa/lcall.d new file mode 100644 index 00000000000..cc49b5fd27f --- /dev/null +++ b/ld/testsuite/ld-xtensa/lcall.d @@ -0,0 +1,10 @@ +#source: lcall1.s +#source: lcall2.s +#ld: -T lcall.t +#objdump: -d +#... +00000004 : +#failif +#... +.*l32r.* +#... diff --git a/ld/testsuite/ld-xtensa/lcall.exp b/ld/testsuite/ld-xtensa/lcall.exp deleted file mode 100644 index 3adb80f0f95..00000000000 --- a/ld/testsuite/ld-xtensa/lcall.exp +++ /dev/null @@ -1,113 +0,0 @@ -# Test Xtensa longcall optimization. -# By David Heine, Tensilica, Inc. -# Copyright (C) 2002-2018 Free Software Foundation, Inc. -# -# This file is part of the GNU Binutils. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, -# MA 02110-1301, USA. - -if ![istarget "xtensa*-*-*"] { - return -} - -set testname "LCALL" - -set OBJDUMPFLAGS "-dr" - -# -# default_ld_objdump -# run objdump on a file -# -proc default_ld_objdump { objdump object outputfile } { - global OBJDUMPFLAGS - global objdump_output - global host_triplet - - if {[which $objdump] == 0} then { - perror "$objdump does not exist" - return 0 - } - - if ![info exists OBJDUMPFLAGS] { set OBJDUMPFLAGS "" } - - verbose -log "$objdump $OBJDUMPFLAGS $object >$outputfile" - - catch "exec $objdump $OBJDUMPFLAGS $object >$outputfile" exec_output - set exec_output [prune_warnings $exec_output] - if [string match "" $exec_output] then { - return 1 - } else { - verbose -log "$exec_output" - perror "$object: objdump failed" - return 0 - } -} - - -if ![ld_assemble $as $srcdir/$subdir/lcall1.s tmpdir/lcall1.o] { - unresolved $testname - return -} -if ![ld_assemble $as $srcdir/$subdir/lcall2.s tmpdir/lcall2.o] { - unresolved $testname - return -} - -set object "tmpdir/lcall" -set outputfile "$object.txt" - -if ![ld_link $ld $object "-T $srcdir/$subdir/lcall.t tmpdir/lcall1.o tmpdir/lcall2.o"] { - verbose -log "failure in ld" - fail $testname - return -} - -if ![default_ld_objdump $objdump $object $outputfile ] { - verbose -log "failure in objdump" - fail $testname - return -} - -set file [open $outputfile r] -while { [gets $file line] != -1 } { - # verbose "$line" 2 - if [regexp "l32r" $line] { - verbose -log "Found an l32r in the linked object" - verbose -log "$line" - fail $testname - } -} -close $file -pass $testname - - -set testname "LCALL2" -set file [open $outputfile r] -set found 0 - -while { [gets $file line] != -1 } { - # verbose "$line" 2 - if [regexp "^00000004 :" $line] { - set found 1 - } -} -close $file -if $found { - pass $testname -} else { - fail $testname -} - diff --git a/ld/testsuite/ld-xtensa/xtensa.exp b/ld/testsuite/ld-xtensa/xtensa.exp index cd74be28a08..47f97d284b1 100644 --- a/ld/testsuite/ld-xtensa/xtensa.exp +++ b/ld/testsuite/ld-xtensa/xtensa.exp @@ -23,6 +23,10 @@ if { !([istarget "xtensa*-*-*"]) } { return } +run_dump_test "coalesce" +run_dump_test "diff_overflow" +run_dump_test "lcall" + run_dump_test "relax-static-pie" run_dump_test "relax-static-local-pie" run_dump_test "relax-static-shared" -- 2.30.2