forked from Imagelibrary/binutils-gdb
This merges the three versions of run_dump_test. Improved warning handling versus the old gas version shows up a number of tests that need their disassembly updating: arm-linuxeabi +FAIL: ARM v1 instructions arm-linuxeabi +FAIL: Accepted v8-a with ARMv8.1 AdvSIMD. arm-linuxeabi +FAIL: bl local instructions for v4t. arm-linuxeabi +FAIL: UDF and some that now fail due to detecting assembly warnings: h8300-elf +FAIL: binutils-all/strip-13 h8300-elf +FAIL: binutils-all/strip-14 h8300-elf +FAIL: binutils-all/strip-15 I've generally kept the union of all run_dump_test features, except that the ld target aliases "cfi" and "shared" have disappeared, as has the binutils substitution of $srcdir as $scrdir/$subdir. binutils/ * testsuite/binutils-all/add-symbol.d: Add "section_subst: no". * testsuite/binutils-all/elfedit.exp: Don't set tempfile or copyfile. * testsuite/binutils-all/symbols-1.d, * testsuite/binutils-all/symbols-2.d, * testsuite/binutils-all/symbols-3.d, * testsuite/binutils-all/symbols-4.d: Quote '*' and '!'. * testsuite/binutils-all/add-empty-section.d, * testsuite/binutils-all/add-section.d, * testsuite/binutils-all/elfedit.exp, * testsuite/binutils-all/note-1.d, * testsuite/binutils-all/pr23633.d: Add $subdir after $srcdir. * testsuite/config/default.exp (AS, ASFLAGS): Define. * testsuite/config/hppa.sed: Handle all common symbols. * testsuite/lib/binutils-common.exp (run_dump_test): New proc, merged from three other versions. (slurp_options, file_contents, set_file_contents): Likewise. (big_or_little_endian, get_standard_section_names): Likewise. * testsuite/lib/utils-lib.exp (run_dump_test): Delete. (slurp_options, proc file_contents): Delete. (get_standard_section_names): Delete. gas/ * testsuite/config/default.exp: Make tmpdir. * testsuite/lib/gas-defs.exp (run_dump_test): Delete. (get_standard_section_names, slurp_options): Delete. ld/ * testsuite/ld-d10v/reloc-007.d, * testsuite/ld-d10v/reloc-008.d, * testsuite/ld-d10v/reloc-015.d, * testsuite/ld-d10v/reloc-016.d: Remove "error:". * testsuite/ld-elf/eh-frame-hdr.d, * testsuite/ld-elf/eh5.d, * testsuite/ld-gc/personality.d: Replace "cfi" and "shared" in target list with appropriate proc. * testsuite/ld-elf/frame.exp: Use check_shared_lib_support rather than "istarget shared". * testsuite/lib/ld-lib.exp (proc big_or_little_endian): Delete. (run_dump_test, slurp_options, file_contents): Delete. (set_file_contents, istarget): Delete.
156 lines
4.6 KiB
Plaintext
156 lines
4.6 KiB
Plaintext
# Copyright (C) 1993-2018 Free Software Foundation, Inc.
|
|
|
|
# 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.
|
|
|
|
# Please email any bugs, comments, and/or additions to this file to:
|
|
# bug-dejagnu@prep.ai.mit.edu
|
|
|
|
# This file was written by Rob Savoye <rob@cygnus.com>
|
|
# and extended by Ian Lance Taylor <ian@cygnus.com>
|
|
|
|
proc load_common_lib { name } {
|
|
load_lib $name
|
|
}
|
|
|
|
load_common_lib binutils-common.exp
|
|
|
|
proc binutil_version { prog } {
|
|
if ![is_remote host] {
|
|
set path [which $prog]
|
|
if {$path == 0} then {
|
|
perror "$prog can't be run, file not found."
|
|
return ""
|
|
}
|
|
} else {
|
|
set path $prog
|
|
}
|
|
set state [remote_exec host $prog --version]
|
|
set tmp "[lindex $state 1]\n"
|
|
# Should find a way to discard constant parts, keep whatever's
|
|
# left, so the version string could be almost anything at all...
|
|
regexp "\[^\n\]* (cygnus-|)(\[-0-9.a-zA-Z-\]+)\[\r\n\].*" "$tmp" version cyg number
|
|
if ![info exists number] then {
|
|
return "$path (no version number)\n"
|
|
}
|
|
return "$path $number\n"
|
|
}
|
|
|
|
#
|
|
# default_binutils_run
|
|
# run a program, returning the output
|
|
# sets binutils_run_failed if the program does not exist
|
|
# sets binutils_run_status to the exit status of the program
|
|
#
|
|
proc default_binutils_run { prog progargs } {
|
|
global binutils_run_failed
|
|
global binutils_run_status
|
|
global host_triplet
|
|
|
|
set binutils_run_failed 0
|
|
if [info exists binutils_run_status] {
|
|
unset binutils_run_status
|
|
}
|
|
|
|
if ![is_remote host] {
|
|
if {[which $prog] == 0} then {
|
|
perror "$prog does not exist"
|
|
set binutils_run_failed 1
|
|
return ""
|
|
}
|
|
}
|
|
|
|
# For objdump, automatically translate standard section
|
|
# names to the targets one, if they are different.
|
|
set sect_names [get_standard_section_names]
|
|
if { $sect_names != "" && [string match "*objdump" $prog] } {
|
|
regsub -- "-j \\.text" $progargs "-j [lindex $sect_names 0]" progargs
|
|
regsub -- "-j \\.data" $progargs "-j [lindex $sect_names 1]" progargs
|
|
regsub -- "-j \\.bss" $progargs "-j [lindex $sect_names 2]" progargs
|
|
}
|
|
|
|
send_log "$prog $progargs\n"
|
|
verbose "$prog $progargs"
|
|
|
|
# Gotta quote dollar-signs because they get mangled by the
|
|
# shell otherwise.
|
|
regsub -all "\\$" "$progargs" "\\$" progargs
|
|
|
|
set state [remote_exec host $prog $progargs]
|
|
set binutils_run_status [lindex $state 0]
|
|
set exec_output [prune_warnings [lindex $state 1]]
|
|
if {![string match "" $exec_output]} then {
|
|
send_log "$exec_output\n"
|
|
verbose "$exec_output"
|
|
} else {
|
|
if { [lindex $state 0] != 0 } {
|
|
set exec_output "$prog exited with status [lindex $state 0]"
|
|
send_log "$exec_output\n"
|
|
verbose "$exec_output"
|
|
}
|
|
}
|
|
return $exec_output
|
|
}
|
|
|
|
#
|
|
# default_binutils_assemble_flags
|
|
# assemble a file
|
|
#
|
|
proc default_binutils_assemble_flags { source object asflags } {
|
|
global srcdir
|
|
global host_triplet
|
|
|
|
# The HPPA assembler syntax is a little different than most, to make
|
|
# the test source file assemble we need to run it through sed.
|
|
#
|
|
# This is a hack in that it won't scale well if other targets need
|
|
# similar transformations to assemble. We'll generalize the hack
|
|
# if/when other targets need similar handling.
|
|
if { [istarget "hppa*-*-*"] && ![istarget "*-*-linux*" ] } then {
|
|
set sed_file $srcdir/config/hppa.sed
|
|
send_log "sed -f $sed_file < $source > asm.s\n"
|
|
verbose "sed -f $sed_file < $source > asm.s"
|
|
catch "exec sed -f $sed_file < $source > asm.s"
|
|
set source asm.s
|
|
}
|
|
|
|
set exec_output [target_assemble $source $object $asflags]
|
|
set exec_output [prune_warnings $exec_output]
|
|
|
|
if [string match "" $exec_output] {
|
|
return 1
|
|
} else {
|
|
send_log "$exec_output\n"
|
|
verbose "$exec_output"
|
|
return 0
|
|
}
|
|
}
|
|
|
|
#
|
|
# exe_ext
|
|
# Returns target executable extension, if any.
|
|
#
|
|
proc exe_ext {} {
|
|
if { [istarget *-*-mingw*] || [istarget *-*-cygwin*] } {
|
|
return ".exe"
|
|
} else {
|
|
return ""
|
|
}
|
|
}
|
|
|
|
proc verbose_eval { expr { level 1 } } {
|
|
global verbose
|
|
if $verbose>$level then { eval verbose "$expr" $level }
|
|
}
|