old-cross-binutils/ld/testsuite/config/default.exp

288 lines
7 KiB
Text
Raw Normal View History

1999-05-03 07:29:11 +00:00
# Basic expect script for LD Regression Tests
2009-09-02 07:25:43 +00:00
# Copyright 1993, 1994, 1995, 1997, 1998, 1999, 2001, 2003, 2005, 2007, 2009
# 2011, 2012 Free Software Foundation, Inc.
1999-05-03 07:29:11 +00:00
#
2007-07-06 14:09:45 +00:00
# This file is part of the GNU Binutils.
#
1999-05-03 07:29:11 +00:00
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
2007-07-06 14:09:45 +00:00
# the Free Software Foundation; either version 3 of the License, or
1999-05-03 07:29:11 +00:00
# (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
2007-07-06 14:09:45 +00:00
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
# MA 02110-1301, USA.
1999-05-03 07:29:11 +00:00
#
# Written by Jeffrey Wheat (cassidy@cygnus.com)
#
if ![info exists ld] then {
set ld [findfile $base_dir/ld-new $base_dir/ld-new [transform ld]]
}
if ![info exists as] then {
set as [findfile $base_dir/../gas/as-new $base_dir/../gas/as-new [transform as]]
}
if ![info exists nm] then {
set nm [findfile $base_dir/../binutils/nm-new $base_dir/../binutils/nm-new [transform nm]]
}
if ![info exists objdump] then {
set objdump [findfile $base_dir/../binutils/objdump]
}
if ![info exists objcopy] then {
set objcopy [findfile $base_dir/../binutils/objcopy]
}
if ![info exists ar] then {
set ar [findfile $base_dir/../binutils/ar]
}
if ![info exists strip] then {
set strip [findfile $base_dir/../binutils/strip-new $base_dir/../binutils/strip-new [transform strip]]
}
bfd: 2007-08-28 Mark Shinwell <shinwell@codesourcery.com> Joseph Myers <joseph@codesourcery.com> * elf32-arm.c (elf32_arm_compare_mapping): Compare first on vma, then on type. binutils/testsuite: 2007-08-28 Mark Shinwell <shinwell@codesourcery.com> Joseph Myers <joseph@codesourcery.com> * binutils-all/ar.exp (long_filenames): Delete temporary files on the host. * binutils-all/arm/objdump.exp: Only check "which $OBJDUMP" if host is local. * binutils-all/objcopy.exp: Use ${srecfile} to get the name of the srec file to be passed to binutils_run. (objcopy_test_readelf): Use remote_exec. * binutils-all/readelf.exp (readelf_find_size): Use remote_exec. (readelf_test): Likewise. (readelf_wi_test): Likewise. * lib/utils-lib.exp (run_dump_test): Only check "which $binary" if host is local. Use remote_exec. Use $tempfile not tmpdir/bintest.o. gas: 2007-08-28 Mark Shinwell <shinwell@codesourcery.com> Joseph Myers <joseph@codesourcery.com> * as.c (main): Flush stderr before printing listings to ensure consistent output order across platforms. gas/testsuite: 2007-08-28 Mark Shinwell <shinwell@codesourcery.com> Joseph Myers <joseph@codesourcery.com> * lib/gas-defs.exp (gas_version): Use remote_* functions instead of exec. (gas_host_run): New. (gas_run): Use gas_host_run. (gas_start): Likewise. (run_dump_test): Likewise. (objdump): Use gas_host_run. (objdump_start_no_subdir): Likewise. * lib/gas-dg.exp (gas-dg-test): Use "remote_file host delete". * lib/run: Remove. * gas/macros/macros.exp: Download app4b.s to host. * gas/i386/i386.exp (gas_64_check): Use gas_host_run. (gas_32_check): Likewise. * gas/maxq10/maxq10.exp (gas_64_check): Likewise (gas_32_check): Likewise. * gas/maxq20/maxq20.exp (gas_64_check): Likewise (gas_32_check): Likewise. * gas/sparc/sparc.exp (gas_64_check): Likewise. * gas/cfi/cfi.exp: Likewise. * gas/elf/elf.exp (run_list_test): Likewise. Use temporary file for readelf output in place of pipe. * gas/all/gas.exp: Download incbin.dat to host. (do_comment): Allow \r\r\n. ld: 2007-08-28 Mark Shinwell <shinwell@codesourcery.com> Joseph Myers <joseph@codesourcery.com> * ldlang.c (sort_sections_by_lma): Sort by internal id after lma for stable sort. ld/testsuite: 2007-08-28 Mark Shinwell <shinwell@codesourcery.com> Joseph Myers <joseph@codesourcery.com> * ld-elfcomm/elfcomm.exp: Use run_host_cmd. Only check "which $CC" if host is local. * ld-checks/checks.exp: Use run_host_cmd. * ld-elf/exclude.exp: Likewise. * ld-elf/elf.exp: Download merge.ld if host is remote. * ld-elf/binutils.exp (binutils_test): Use remote_exec. * ld-elf/tls_common.exp: Use run_host_cmd. * lib/ld-lib.exp (ld_version): Only check "which $ld" if host is local. Use remote_exec. (run_host_cmd): New. (run_host_cmd_yesno): New. (default_ld_relocate): Use run_host_cmd_yesno. (default_ld_link): Likewise. (default_ld_simple_link): Use run_host_cmd. (default_ld_compile): Only check "which $ccprog" if host is local. Use remote_file and remote_exec. (default_ld_assemble): Only check "which $as" if host is local. Use run_host_cmd. (default_ld_nm): Use remote_exec, remote_upload and remote_file. (run_dump_test): Use remote_exec, remote_upload and remote_file. Only check "which $binary" if host is local. (run_ld_link_tests): Use remote_exec, remote_upload and remote_file. * ld-selective/selective.exp: Only check "which $CXX" if host is local. Use remote_exec. * ld-scripts/phdrs.exp: Only check "which $objdump" if host is local. Use run_host_cmd. * ld-scripts/phdrs2.exp: Likewise. * ld-scripts/weak.exp: Likewise. * ld-undefined/weak-undef.exp: Likewise. * ld-scripts/crossref.exp: Only check "which $CC" if host is local. Use run_host_cmd. * ld-scripts/map-address.exp: Upload map_address.map if host is remote. * ld-srec/srec.exp (run_srec_tests): Use run_host_cmd. Only check "which $CC" and "which $CXX" if host is local. * ld-undefined/undefined.exp: Only check "which $CC" if host is local. Use remote_file and run_host_cmd. * config/default.exp: Use remote_exec to create tmpdir.
2007-08-28 13:21:58 +00:00
remote_exec host "mkdir -p tmpdir"
1999-05-03 07:29:11 +00:00
# Make a symlink from tmpdir/as to the assembler in the build tree, so
# that we can use a -B option to gcc to force it to use the newly
# built assembler.
if {![file isdirectory tmpdir/gas]} then {
catch "exec mkdir tmpdir/gas" status
catch "exec ln -s ../../../gas/as-new tmpdir/gas/as" status
}
set gcc_gas_flag "-B[pwd]/tmpdir/gas/"
# Make a symlink from tmpdir/ld to the linker in the build tree, so
# that we can use a -B option to gcc to force it to use the newly
# built linker.
if {![file isdirectory tmpdir/ld]} then {
catch "exec mkdir tmpdir/ld" status
catch "exec ln -s ../../ld-new tmpdir/ld/ld" status
catch "exec ln -s ld tmpdir/ld/collect-ld" status
}
set gcc_ld_flag "-B[pwd]/tmpdir/ld/"
# load the linker path
if {[file exists tmpdir/libpath.exp]} {
load_lib tmpdir/libpath.exp
foreach dir $libpath {
set gcc_ld_flag "$gcc_ld_flag -L$dir"
}
}
# The "make check" target in the Makefile passes in
# "CC=$(CC_FOR_TARGET)". But, if the user invokes runtest directly
# (as when testing an installed linker), these flags may not be set.
if {![info exists CC]} {
set CC [find_gcc]
}
if {![info exists CFLAGS]} {
set CFLAGS "-g -O2"
}
if {![info exists CXX]} {
set CXX [find_g++]
}
if {![info exists CXXFLAGS]} {
set CXXFLAGS ""
}
# The mips64-*-linux-gnu compiler defaults to the N32 ABI after
# installed, but to the O32 ABI in the build tree, because of some
# specs-file hacks. Make sure we use an ABI that is compatible with
# the one we expect.
if {[istarget mips64*-*-linux*] &&
(![board_info [target_info name] exists multilib_flags] ||
![string match "*-mabi" [board_info [target_info name] multilib_flags]])
} {
append gcc_gas_flag " -mabi=n32"
}
1999-05-03 07:29:11 +00:00
# load the utility procedures
load_lib ld-lib.exp
proc get_link_files {varname} {
global $varname
global target_triplet
global srcdir
global CC
if ![info exists $varname] {
#configure.host returns variables that can be substituted into
#makefile rules, with embedded shell variable expansions.
#make wants $$shell_var, we want $shell_var ...
set cmd "host='$target_triplet' && . $srcdir/../configure.host && sed -e 's,\\\$\\\$,\$,g' <<EOF\n\$$varname\nEOF"
set status [catch "exec sh -c [list $cmd]" result]
if $status { error "Error getting native link files: $result" }
set cmd "CC='$CC' && eval echo \"$result\""
set status [catch "exec sh -c [list $cmd]" result]
1999-05-03 07:29:11 +00:00
if $status { error "Error getting native link files: $result" }
set $varname $result
send_log "$varname = $result\n"
1999-05-03 07:29:11 +00:00
}
}
proc get_target_emul {} {
global target_triplet
global srcdir
set status [catch "exec sh -c \"targ='$target_triplet' && . $srcdir/../configure.tgt && echo \\\$targ_emul\"" result]
if $status { error "Error getting emulation name: $result" }
return $result
}
if [isnative] {
foreach x {HOSTING_CRT0 HOSTING_SCRT0 HOSTING_LIBS HOSTING_SLIBS} {
1999-05-03 07:29:11 +00:00
get_link_files $x
}
} else {
foreach x {HOSTING_CRT0 HOSTING_SCRT0 HOSTING_LIBS HOSTING_SLIBS} { set $x "" }
1999-05-03 07:29:11 +00:00
}
if ![info exists HOSTING_EMU] { set HOSTING_EMU "-m [get_target_emul]" }
#
# ld_version -- extract and print the version number of ld compiler (GCC)
#
proc ld_version {} {
global ld
default_ld_version $ld
}
#
# ld_exit -- just a stub for ld
#
proc ld_exit {} {
}
#
# ld_start
# relink the linker
#
proc ld_start { ld target } {
#
}
#
# ld_relocate
# link an object using relocation
#
proc ld_relocate { ld target objects } {
default_ld_relocate $ld $target $objects
}
#
# ld_link
# link a program using ld
#
proc ld_link { ld target objects } {
default_ld_link $ld $target $objects
}
#
# ld_simple_link
# link a program using ld, without including any libraries
#
proc ld_simple_link { ld target objects } {
default_ld_simple_link $ld $target $objects
}
#
# ld_compile
# compile an object using $cc
#
proc ld_compile { cc source object } {
default_ld_compile $cc $source $object
}
#
# ld_assemble
# assemble a file
#
proc ld_assemble { as source object } {
default_ld_assemble $as "" $source $object
}
#
# ld_assemble_flags
# assemble a file with extra flags
#
proc ld_assemble_flags { as flags source object } {
default_ld_assemble $as $flags $source $object
1999-05-03 07:29:11 +00:00
}
#
# ld_nm
# run nm on a file
#
proc ld_nm { nm nmflags object } {
default_ld_nm $nm $nmflags $object
1999-05-03 07:29:11 +00:00
}
#
# ld_exec
# execute ithe target
#
proc ld_exec { target output } {
default_ld_exec $target $output
}
# From gas-defs.exp, to support run_dump_test.
if ![info exists AS] then {
set AS $as
}
if ![info exists GASP] then {
set GASP [findfile $base_dir/../gas/gasp-new $base_dir/../gas/gasp-new [transform gasp]]
}
if ![info exists ASFLAGS] then {
set ASFLAGS ""
}
if ![info exists OBJDUMP] then {
set OBJDUMP $objdump
}
if ![info exists OBJDUMPFLAGS] then {
set OBJDUMPFLAGS {}
}
if ![info exists NM] then {
set NM $nm
}
if ![info exists NMFLAGS] then {
set NMFLAGS {}
}
if ![info exists OBJCOPY] then {
set OBJCOPY $objcopy
}
if ![info exists OBJCOPYFLAGS] then {
set OBJCOPYFLAGS {}
}
if ![info exists READELF] then {
set READELF [findfile $base_dir/../binutils/readelf]
}
if ![info exists READELFFLAGS] then {
set READELFFLAGS {}
}
if ![info exists LD] then {
set LD [findfile $base_dir/ld-new ./ld-new [transform ld]]
}
if ![info exists LDFLAGS] then {
set LDFLAGS {}
}