aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2007-08-28 13:21:58 +0000
committerJoseph Myers <joseph@codesourcery.com>2007-08-28 13:21:58 +0000
commit7f6a71ffb6ce85438f442a992e2def6eda2e1554 (patch)
treeb0cab57986aed86fe6234c0ad4a205191c031c4b /ld
parentad71ef64ac2a85db4cdcf06706db646792ba094a (diff)
downloadfsf-binutils-gdb-7f6a71ffb6ce85438f442a992e2def6eda2e1554.zip
fsf-binutils-gdb-7f6a71ffb6ce85438f442a992e2def6eda2e1554.tar.gz
fsf-binutils-gdb-7f6a71ffb6ce85438f442a992e2def6eda2e1554.tar.bz2
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.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog6
-rw-r--r--ld/ldlang.c4
-rw-r--r--ld/testsuite/ChangeLog43
-rw-r--r--ld/testsuite/config/default.exp4
-rw-r--r--ld/testsuite/ld-checks/checks.exp3
-rw-r--r--ld/testsuite/ld-elf/binutils.exp12
-rw-r--r--ld/testsuite/ld-elf/elf.exp4
-rw-r--r--ld/testsuite/ld-elf/exclude.exp4
-rw-r--r--ld/testsuite/ld-elf/tls_common.exp3
-rw-r--r--ld/testsuite/ld-elfcomm/elfcomm.exp5
-rw-r--r--ld/testsuite/ld-scripts/crossref.exp15
-rw-r--r--ld/testsuite/ld-scripts/map-address.exp9
-rw-r--r--ld/testsuite/ld-scripts/phdrs.exp6
-rw-r--r--ld/testsuite/ld-scripts/phdrs2.exp5
-rw-r--r--ld/testsuite/ld-scripts/weak.exp5
-rw-r--r--ld/testsuite/ld-selective/selective.exp17
-rw-r--r--ld/testsuite/ld-srec/srec.exp9
-rw-r--r--ld/testsuite/ld-undefined/undefined.exp7
-rw-r--r--ld/testsuite/ld-undefined/weak-undef.exp5
-rw-r--r--ld/testsuite/lib/ld-lib.exp217
20 files changed, 218 insertions, 165 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 9575934..a2bee5f 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,9 @@
+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.
+
2007-08-28 Robert Sebastian Gerus <arachnist@gmail.com>
* configure.host: Add support for i[3-7]86-*-dragonfly*.
diff --git a/ld/ldlang.c b/ld/ldlang.c
index decfc5f..1fcb991 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -4103,6 +4103,10 @@ sort_sections_by_lma (const void *arg1, const void *arg2)
else if (bfd_section_lma (sec1->owner, sec1)
> bfd_section_lma (sec2->owner, sec2))
return 1;
+ else if (sec1->id < sec2->id)
+ return -1;
+ else if (sec1->id > sec2->id)
+ return 1;
return 0;
}
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index ecd896c..ec3cf04 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,46 @@
+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-24 H.J. Lu <hongjiu.lu@intel.com>
* ld-i386/i386.exp (i386tests): Add a test for TLS IE->LE
diff --git a/ld/testsuite/config/default.exp b/ld/testsuite/config/default.exp
index dfae71a..ab35ecf 100644
--- a/ld/testsuite/config/default.exp
+++ b/ld/testsuite/config/default.exp
@@ -50,9 +50,7 @@ if ![info exists strip] then {
set strip [findfile $base_dir/../binutils/strip-new $base_dir/../binutils/strip-new [transform strip]]
}
-if {![file isdirectory tmpdir]} then {
- catch "exec mkdir tmpdir" status
-}
+remote_exec host "mkdir -p tmpdir"
# 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
diff --git a/ld/testsuite/ld-checks/checks.exp b/ld/testsuite/ld-checks/checks.exp
index d0ace09..39e9ac7 100644
--- a/ld/testsuite/ld-checks/checks.exp
+++ b/ld/testsuite/ld-checks/checks.exp
@@ -57,8 +57,7 @@ proc section_check {} {
# Perform the equivalent of invoking ld_simple_link
# except that we need to massage the output futher.
- verbose -log "$ld -o tmpdir/asm.x $ldflags tmpdir/asm.o"
- catch "exec $ld -o tmpdir/asm.x $ldflags tmpdir/asm.o" exec_output
+ set exec_output [run_host_cmd "$ld" "-o tmpdir/asm.x $ldflags tmpdir/asm.o"]
set exec_output [prune_warnings $exec_output]
# Make sure that we got some output from the linker
diff --git a/ld/testsuite/ld-elf/binutils.exp b/ld/testsuite/ld-elf/binutils.exp
index 52ac03b..ba7ac36 100644
--- a/ld/testsuite/ld-elf/binutils.exp
+++ b/ld/testsuite/ld-elf/binutils.exp
@@ -62,24 +62,24 @@ proc binutils_test { prog_name ld_options test } {
}
send_log "$READELF -l --wide tmpdir/$test > tmpdir/$test.exp\n"
- catch "exec $READELF -l --wide tmpdir/$test > tmpdir/$test.exp" got
- if ![string match "" $got] then {
+ set got [remote_exec host "$READELF -l --wide tmpdir/$test" "" "/dev/null" "tmpdir/$test.exp"]
+ if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
send_log "$got\n"
unresolved "$test_name"
return
}
send_log "$prog tmpdir/$test\n"
- catch "exec $prog tmpdir/$test" got
- if ![string match "" $got] then {
+ set got [remote_exec host "$prog tmpdir/$test"]
+ if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
send_log "$got\n"
fail "$test_name"
return
}
send_log "$READELF -l --wide tmpdir/$test > tmpdir/$test.out\n"
- catch "exec $READELF -l --wide tmpdir/$test > tmpdir/$test.out" got
- if ![string match "" $got] then {
+ set got [remote_exec host "$READELF -l --wide tmpdir/$test" "" "/dev/null" "tmpdir/$test.out"]
+ if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
send_log "$got\n"
unresolved "$test_name"
return
diff --git a/ld/testsuite/ld-elf/elf.exp b/ld/testsuite/ld-elf/elf.exp
index 20e9980..dc6a3a6 100644
--- a/ld/testsuite/ld-elf/elf.exp
+++ b/ld/testsuite/ld-elf/elf.exp
@@ -29,6 +29,10 @@ if { [istarget spu*-*-*] } {
set LDFLAGS "$LDFLAGS --local-store 0:0"
}
+if { [is_remote host] } then {
+ remote_download host merge.ld
+}
+
set test_list [lsort [glob -nocomplain $srcdir/$subdir/*.d]]
foreach t $test_list {
# We need to strip the ".d", but can leave the dirname.
diff --git a/ld/testsuite/ld-elf/exclude.exp b/ld/testsuite/ld-elf/exclude.exp
index 2bb8cf6..264c138 100644
--- a/ld/testsuite/ld-elf/exclude.exp
+++ b/ld/testsuite/ld-elf/exclude.exp
@@ -53,8 +53,8 @@ if { ![ld_assemble $as $srcdir/$subdir/exclude1.s tmpdir/exclude1.o ]
return
}
-catch "exec rm -f tmpdir/libexclude.a" catch_output
-catch "exec $ar cq tmpdir/libexclude.a tmpdir/exclude2.o" catch_output
+remote_file host delete "tmpdir/libexclude.a"
+set catch_output [run_host_cmd "$ar" "cq tmpdir/libexclude.a tmpdir/exclude2.o"]
if {![string match "" $catch_output]} {
unresolved $test1
return
diff --git a/ld/testsuite/ld-elf/tls_common.exp b/ld/testsuite/ld-elf/tls_common.exp
index edeedbe..66a550c 100644
--- a/ld/testsuite/ld-elf/tls_common.exp
+++ b/ld/testsuite/ld-elf/tls_common.exp
@@ -62,8 +62,7 @@ if { ![ld_simple_link $ld tmpdir/tls_common "tmpdir/tls_common1.o"] } {
return
}
-send_log "$READELF -l --wide tmpdir/tls_common\n"
-catch "exec $READELF -l --wide tmpdir/tls_common" readelf_output
+set readelf_output [run_host_cmd "$READELF" "-l --wide tmpdir/tls_common"]
if ![regexp ".*TLS.*0x0+ 0x0+4 R .*" $readelf_output] then {
send_log "$readelf_output\n"
fail "tls_common"
diff --git a/ld/testsuite/ld-elfcomm/elfcomm.exp b/ld/testsuite/ld-elfcomm/elfcomm.exp
index fcfdf92..bed5258 100644
--- a/ld/testsuite/ld-elfcomm/elfcomm.exp
+++ b/ld/testsuite/ld-elfcomm/elfcomm.exp
@@ -34,7 +34,7 @@ set test1w2 "$test1 (warning 2)"
set test1c1 "$test1 (change 1)"
set test1c2 "$test1 (change 2)"
-if { [which $CC] == 0 } {
+if { ![is_remote host] && [which $CC] == 0 } {
untested $test1w1
untested $test1w2
untested $test1c1
@@ -54,7 +54,8 @@ proc dump_common1 { testname } {
global READELF
send_log "$READELF -s tmpdir/common1.o | grep foo\n"
- catch "exec $READELF -s tmpdir/common1.o | grep foo" exec_output
+ set exec_output [run_host_cmd "readelf" "-s tmpdir/common1.o | grep foo"]
+
if { ![regexp "(\[ \]*)(\[0-9\]+):(\[ \]*)(\[0\]*)80(\[ \]+)4(\[ \]+)OBJECT(\[ \]+)GLOBAL(\[ \]+)DEFAULT(\[ \]+)(PRC\\\[0xff03\\\]|COM|SCOM)(\[ \]+)_?foo2" $exec_output]
|| ![regexp "(\[ \]*)(\[0-9\]+):(\[ \]*)(\[0-9\]+)(\[ \]+)21(\[ \]+)OBJECT(\[ \]+)GLOBAL(\[ \]+)DEFAULT(\[ \]+)(\[0-9\]+)(\[ \]+)_?foo1" $exec_output] } {
send_log "$exec_output\n"
diff --git a/ld/testsuite/ld-scripts/crossref.exp b/ld/testsuite/ld-scripts/crossref.exp
index 4d43ecf..6d0420b 100644
--- a/ld/testsuite/ld-scripts/crossref.exp
+++ b/ld/testsuite/ld-scripts/crossref.exp
@@ -24,7 +24,7 @@ set test1 "NOCROSSREFS 1"
set test2 "NOCROSSREFS 2"
set test3 "NOCROSSREFS 3"
-if { [which $CC] == 0 } {
+if { ![is_remote host] && [which $CC] == 0 } {
untested $test1
untested $test2
untested $test3
@@ -62,9 +62,7 @@ if [istarget sh64*-*-elf] {
# IA64 has both ordered and unordered sections in an input file.
setup_xfail ia64-*-*
-verbose -log "$ld $flags -o tmpdir/cross1 -T $srcdir/$subdir/cross1.t tmpdir/cross1.o tmpdir/cross2.o"
-
-catch "exec $ld $flags -o tmpdir/cross1 -T $srcdir/$subdir/cross1.t tmpdir/cross1.o tmpdir/cross2.o" exec_output
+set exec_output [run_host_cmd "$ld" "$flags -o tmpdir/cross1 -T $srcdir/$subdir/cross1.t tmpdir/cross1.o tmpdir/cross2.o"]
set exec_output [prune_warnings $exec_output]
@@ -88,10 +86,7 @@ if { ![ld_compile $CC "$srcdir/$subdir/cross3.c" tmpdir/cross3.o] } {
return
}
-verbose -log "$ld $flags -o tmpdir/cross2 -T $srcdir/$subdir/cross2.t tmpdir/cross3.o"
-
-catch "exec $ld $flags -o tmpdir/cross2 -T $srcdir/$subdir/cross2.t tmpdir/cross3.o" exec_output
-
+set exec_output [run_host_cmd "$ld" "$flags -o tmpdir/cross2 -T $srcdir/$subdir/cross2.t tmpdir/cross3.o"]
set exec_output [prune_warnings $exec_output]
regsub -all "(^|\n)($ld: warning: cannot find entry symbol\[^\n\]*\n?)" $exec_output "\\1" exec_output
@@ -119,9 +114,7 @@ if ![ld_relocate $ld tmpdir/cross3-partial.o "tmpdir/cross1.o tmpdir/cross4.o"]
return
}
-verbose -log "$ld $flags -o tmpdir/cross3 -T $srcdir/$subdir/cross3.t tmpdir/cross3-partial.o tmpdir/cross2.o"
-
-catch "exec $ld $flags -o tmpdir/cross3 -T $srcdir/$subdir/cross3.t tmpdir/cross3-partial.o tmpdir/cross2.o" exec_output
+set exec_output [run_host_cmd "$ld" "$flags -o tmpdir/cross3 -T $srcdir/$subdir/cross3.t tmpdir/cross3-partial.o tmpdir/cross2.o"]
set exec_output [prune_warnings $exec_output]
diff --git a/ld/testsuite/ld-scripts/map-address.exp b/ld/testsuite/ld-scripts/map-address.exp
index 6ddad41..c8fe653 100644
--- a/ld/testsuite/ld-scripts/map-address.exp
+++ b/ld/testsuite/ld-scripts/map-address.exp
@@ -31,7 +31,14 @@ if {![ld_simple_link $ld tmpdir/map-address \
tmpdir/map-address.o \
-Map tmpdir/map-address.map"]} {
fail $testname
-} elseif {[regexp_diff \
+ return
+}
+
+if [is_remote host] then {
+ remote_upload host "tmpdir/map_address.map"
+}
+
+if {[regexp_diff \
"tmpdir/map-address.map" \
"$srcdir/$subdir/map-address.d"]} {
fail $testname
diff --git a/ld/testsuite/ld-scripts/phdrs.exp b/ld/testsuite/ld-scripts/phdrs.exp
index bde4f10..ad59cd1 100644
--- a/ld/testsuite/ld-scripts/phdrs.exp
+++ b/ld/testsuite/ld-scripts/phdrs.exp
@@ -52,13 +52,11 @@ set ldopt "$ldopt -T $srcdir/$subdir/phdrs.t tmpdir/phdrs.o"
if ![ld_simple_link $ld tmpdir/phdrs $ldopt] {
fail $testname
} else {
- if {[which $objdump] == 0} {
+ if {![is_remote host] && [which $objdump] == 0} {
unresolved $testname
return
}
-
- verbose -log "$objdump --private tmpdir/phdrs"
- catch "exec $objdump --private tmpdir/phdrs" exec_output
+ set exec_output [run_host_cmd "$objdump" "--private tmpdir/phdrs"]
set exec_output [prune_warnings $exec_output]
verbose -log $exec_output
diff --git a/ld/testsuite/ld-scripts/phdrs2.exp b/ld/testsuite/ld-scripts/phdrs2.exp
index 654a8be..5a4a8cc 100644
--- a/ld/testsuite/ld-scripts/phdrs2.exp
+++ b/ld/testsuite/ld-scripts/phdrs2.exp
@@ -57,13 +57,12 @@ set ldopt "$ldopt -T $srcdir/$subdir/phdrs2.t tmpdir/phdrs2.o"
if ![ld_simple_link $ld tmpdir/phdrs2 $ldopt] {
fail $testname
} else {
- if {[which $objdump] == 0} {
+ if {![is_remote host] && [which $objdump] == 0} {
unresolved $testname
return
}
- verbose -log "$objdump --private tmpdir/phdrs2"
- catch "exec $objdump --private tmpdir/phdrs2" exec_output
+ set exec_output [run_host_cmd "$objdump" "--private tmpdir/phdrs2"]
set exec_output [prune_warnings $exec_output]
verbose -log $exec_output
diff --git a/ld/testsuite/ld-scripts/weak.exp b/ld/testsuite/ld-scripts/weak.exp
index de28755..5b5c00c 100644
--- a/ld/testsuite/ld-scripts/weak.exp
+++ b/ld/testsuite/ld-scripts/weak.exp
@@ -60,14 +60,13 @@ set weak_regexp_little \
if {! [ld_simple_link $ld tmpdir/weak "$flags -T $srcdir/$subdir/weak.t tmpdir/weak1.o tmpdir/weak2.o"] } then {
fail $testname
} else {
- if {[which $objdump] == 0} then {
+ if {![is_remote host] && [which $objdump] == 0} then {
unresolved $testname
set LDFLAGS "$saved_LDFLAGS"
return
}
- verbose -log "$objdump -s tmpdir/weak"
- catch "exec $objdump -s tmpdir/weak" exec_output
+ set exec_output [run_host_cmd "$objdump" "-s tmpdir/weak"]
set exec_output [prune_warnings $exec_output]
verbose -log $exec_output
diff --git a/ld/testsuite/ld-selective/selective.exp b/ld/testsuite/ld-selective/selective.exp
index dc7e9b8..bae4372 100644
--- a/ld/testsuite/ld-selective/selective.exp
+++ b/ld/testsuite/ld-selective/selective.exp
@@ -71,7 +71,7 @@ if [istarget sh64*-*-elf] {
}
# If we don't have g++ for the target, mark all tests as untested.
-if { [which $CXX] == 0 } {
+if { ![is_remote host] && [which $CXX] == 0 } {
foreach testitem $seltests {
untested "[lindex $testitem 0]"
}
@@ -103,7 +103,8 @@ foreach testitem $seltests {
if [string match "*gcc*" [lindex $CC 0]] {
# Starting with 3.4.0, -fvtable-gc is no longer supported and thus
# the functionality we try to test for cannot be expected to work.
- catch "exec -- $CC -dumpversion" version
+ set version [remote_exec host "$CC -dumpversion"]
+ set version [lindex $version 1]
if [regexp "^(\[1-9\]\[0-9\]+|\[4-9\]|3.(\[1-9\]\[0-9\]+|\[4-9\]))\\." $version] {
setup_xfail {*-*-*}
}
@@ -122,19 +123,25 @@ foreach testitem $seltests {
# V850 targets need libgcc.a
if [istarget v850*-*-elf] {
- catch "exec $CC -print-libgcc-file-name" libgcc
+ set libgcc [remote_exec host "$CC -print-libgcc-file-name"]
+ set libgcc [lindex $libgcc 1]
+ regsub -all "\[\r\n\]" $libgcc "" libgcc
set objfile "$objfile $libgcc"
}
# ARM targets need libgcc.a in THUMB mode so that __call_via_r3 is provided
if {[istarget arm-*-*] || [istarget xscale-*-*]} {
- catch "exec $CC -print-libgcc-file-name" libgcc
+ set libgcc [remote_exec host "$CC -print-libgcc-file-name"]
+ set libgcc [lindex $libgcc 1]
+ regsub -all "\[\r\n\]" $libgcc "" libgcc
set objfile "$objfile $libgcc"
}
# HPPA linux targets need libgcc.a for millicode routines ($$dyncall).
if [istarget hppa*-*-linux*] {
- catch "exec $CC -print-libgcc-file-name" libgcc
+ set libgcc [remote_exec host "$CC -print-libgcc-file-name"]
+ set libgcc [lindex $libgcc 1]
+ regsub -all "\[\r\n\]" $libgcc "" libgcc
set objfile "$objfile $libgcc"
}
diff --git a/ld/testsuite/ld-srec/srec.exp b/ld/testsuite/ld-srec/srec.exp
index c40161a..c75b57c 100644
--- a/ld/testsuite/ld-srec/srec.exp
+++ b/ld/testsuite/ld-srec/srec.exp
@@ -305,8 +305,7 @@ proc run_srec_test { test objs } {
}
send_log "$objcopy -O srec tmpdir/sr1 tmpdir/sr1.sr\n"
- verbose "$objcopy -O srec tmpdir/sr1 tmpdir/sr1.sr"
- catch "exec $objcopy -O srec tmpdir/sr1 tmpdir/sr1.sr" exec_output
+ set exec_output [run_host_cmd "$objcopy" "-O srec tmpdir/sr1 tmpdir/sr1.sr"]
set exec_output [prune_warnings $exec_output]
if ![string match "" $exec_output] {
send_log "$exec_output\n"
@@ -330,7 +329,7 @@ set test1 "S-records"
set test2 "S-records with constructors"
# See whether the default linker script uses SIZEOF_HEADERS.
-catch "exec $ld --verbose" exec_output
+set exec_output [run_host_cmd "$ld" "--verbose"]
set sizeof_headers [string match "*SIZEOF_HEADERS*" $exec_output]
# First test linking a C program. We don't require any libraries. We
@@ -338,7 +337,7 @@ set sizeof_headers [string match "*SIZEOF_HEADERS*" $exec_output]
# directly to the S-record format, and require that the two files
# contain the same data.
-if { [which $CC] == 0 } {
+if { ![is_remote host] && [which $CC] == 0 } {
untested $test1
untested $test2
return
@@ -400,7 +399,7 @@ run_srec_test $test1 "tmpdir/sr1.o tmpdir/sr2.o"
# destructors. Note that since we are not linking against any
# libraries, this program won't actually work or anything.
-if { [which $CXX] == 0 } {
+if { ![is_remote host] && [which $CXX] == 0 } {
untested $test2
return
}
diff --git a/ld/testsuite/ld-undefined/undefined.exp b/ld/testsuite/ld-undefined/undefined.exp
index e6bf359..d546fd8 100644
--- a/ld/testsuite/ld-undefined/undefined.exp
+++ b/ld/testsuite/ld-undefined/undefined.exp
@@ -25,7 +25,7 @@ set testund "undefined"
set testfn "undefined function"
set testline "undefined line"
-if { [which $CC] == 0 } {
+if { ![is_remote host] && [which $CC] == 0 } {
verbose "Could not find C compiler!" 1
untested $testund
untested $testfn
@@ -41,16 +41,15 @@ if ![ld_compile "$CC -g" $srcdir/$subdir/undefined.c tmpdir/undefined.o] {
return
}
-catch "exec rm -f tmpdir/undefined" exec_output
+remote_file host delete "tmpdir/undefined"
set flags [big_or_little_endian]
# Using -e start prevents the SunOS linker from trying to build a
# shared library.
send_log "$ld -e start $flags -o tmpdir/undefined tmpdir/undefined.o\n"
-verbose "$ld -e start $flags -o tmpdir/undefined tmpdir/undefined.o"
+set exec_output [run_host_cmd "$ld" "-e start $flags -o tmpdir/undefined tmpdir/undefined.o"]
-catch "exec $ld -e start $flags -o tmpdir/undefined tmpdir/undefined.o" exec_output
send_log "$exec_output\n"
verbose "$exec_output"
diff --git a/ld/testsuite/ld-undefined/weak-undef.exp b/ld/testsuite/ld-undefined/weak-undef.exp
index 00c016a..e3f109b 100644
--- a/ld/testsuite/ld-undefined/weak-undef.exp
+++ b/ld/testsuite/ld-undefined/weak-undef.exp
@@ -66,13 +66,12 @@ set output_regexp \
if {! [ld_simple_link $ld tmpdir/weak-undef "$flags tmpdir/weak-undef.o -T $srcdir/$subdir/weak-undef.t"] } then {
fail $testname
} else {
- if {[which $objdump] == 0} then {
+ if {![is_remote host] && [which $objdump] == 0} then {
unresolved $testname
return
}
- verbose -log "$objdump -s tmpdir/weak-undef"
- catch "exec $objdump -s tmpdir/weak-undef" exec_output
+ set exec_output [run_host_cmd "$objdump" "-s tmpdir/weak-undef"]
set exec_output [prune_warnings $exec_output]
verbose -log $exec_output
diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp
index 878af0c..5518a72 100644
--- a/ld/testsuite/lib/ld-lib.exp
+++ b/ld/testsuite/lib/ld-lib.exp
@@ -24,43 +24,67 @@
proc default_ld_version { ld } {
global host_triplet
- if { [which $ld] == 0 } then {
+ if { ![is_remote host] && [which $ld] == 0 } then {
perror "$ld does not exist"
exit 1
}
- catch "exec $ld --version" tmp
- set tmp [prune_warnings $tmp]
+ remote_exec host "$ld --version" "" "/dev/null" "ld.version"
+ remote_upload host "ld.version"
+ set tmp [prune_warnings [file_contents "ld.version"]]
+ remote_file build delete "ld.version"
+ remote_file host delete "ld.version"
+
regexp "\[^\n\]* (cygnus-|)(\[-0-9.a-zA-Z-\]+)\[\r\n\].*" $tmp version cyg number
if [info exists number] then {
clone_output "$ld $number\n"
}
}
-# Link an object using relocation.
-#
-proc default_ld_relocate { ld target objects } {
- global HOSTING_EMU
- global host_triplet
- global exec_output
+proc run_host_cmd { prog command } {
+ global link_output
- if { [which $ld] == 0 } then {
- perror "$ld does not exist"
+ if { ![is_remote host] && [which "$prog"] == 0 } then {
+ perror "$prog does not exist"
return 0
}
- catch "exec rm -f $target" exec_output
+ verbose -log "$prog $command"
+ set status [remote_exec host [concat sh -c [list "$prog $command 2>&1"]] "" "/dev/null" "ld.tmp"]
+ remote_upload host "ld.tmp"
+ set link_output [file_contents "ld.tmp"]
+ regsub "\n$" $link_output "" link_output
+ if { [lindex $status 0] != 0 && [string match "" $link_output] } then {
+ append link_output "child process exited abnormally"
+ }
+ remote_file build delete ld.tmp
+ remote_file host delete ld.tmp
- verbose -log "$ld $HOSTING_EMU -o $target -r $objects"
+ if [string match "" $link_output] then {
+ return ""
+ }
- catch "exec $ld $HOSTING_EMU -o $target -r $objects" exec_output
- set exec_output [prune_warnings $exec_output]
+ verbose -log "$link_output"
+ return "$link_output"
+}
+
+proc run_host_cmd_yesno { prog command } {
+ global exec_output
+
+ set exec_output [prune_warnings [run_host_cmd "$prog" "$command"]]
if [string match "" $exec_output] then {
- return 1
- } else {
- verbose -log "$exec_output"
- return 0
+ return 1;
}
+ return 0;
+}
+
+# Link an object using relocation.
+#
+proc default_ld_relocate { ld target objects } {
+ global HOSTING_EMU
+
+ remote_file host delete $target
+ return [run_host_cmd_yesno "$ld" "$HOSTING_EMU -o $target -r $objects"]
}
# Check to see if ld is being invoked with a non-endian output format
@@ -126,44 +150,24 @@ proc default_ld_link { ld target objects } {
set objs "$HOSTING_CRT0 $objects"
set libs "$LIBS $HOSTING_LIBS"
- if { [which $ld] == 0 } then {
- perror "$ld does not exist"
- return 0
- }
-
if [is_endian_output_format $objects] then {
set flags [big_or_little_endian]
} else {
set flags ""
}
- catch "exec rm -f $target" exec_output
-
- verbose -log "$ld $HOSTING_EMU $flags -o $target $objs $libs"
+ remote_file host delete $target
- catch "exec $ld $HOSTING_EMU $flags -o $target $objs $libs" link_output
- set exec_output [prune_warnings $link_output]
- if [string match "" $exec_output] then {
- return 1
- } else {
- verbose -log "$exec_output"
- return 0
- }
+ return [run_host_cmd_yesno "$ld" "$HOSTING_EMU $flags -o $target $objs $libs"]
}
# Link a program using ld, without including any libraries.
#
proc default_ld_simple_link { ld target objects } {
global host_triplet
- global link_output
global gcc_ld_flag
global exec_output
- if { [which $ld] == 0 } then {
- perror "$ld does not exist"
- return 0
- }
-
if [is_endian_output_format $objects] then {
set flags [big_or_little_endian]
} else {
@@ -183,12 +187,10 @@ proc default_ld_simple_link { ld target objects } {
set flags "$gcc_ld_flag $flags"
}
- catch "exec rm -f $target" exec_output
+ remote_file host delete $target
- verbose -log "$ld $flags -o $target $objects"
-
- catch "exec $ld $flags -o $target $objects" link_output
- set exec_output [prune_warnings $link_output]
+ set exec_output [run_host_cmd "$ld" "$flags -o $target $objects"]
+ set exec_output [prune_warnings $exec_output]
# We don't care if we get a warning about a non-existent start
# symbol, since the default linker script might use ENTRY.
@@ -197,7 +199,6 @@ proc default_ld_simple_link { ld target objects } {
if [string match "" $exec_output] then {
return 1
} else {
- verbose -log "$exec_output"
return 0
}
}
@@ -215,12 +216,13 @@ proc default_ld_compile { cc source object } {
if {[llength $cc_prog] > 1} then {
set cc_prog [lindex $cc_prog 0]
}
- if {[which $cc_prog] == 0} then {
+ if {![is_remote host] && [which $cc_prog] == 0} then {
perror "$cc_prog does not exist"
return 0
}
- catch "exec rm -f $object" exec_output
+ remote_file build delete "$object"
+ remote_file host delete "$object"
set flags "-I$srcdir/$subdir $CFLAGS"
@@ -246,22 +248,20 @@ proc default_ld_compile { cc source object } {
verbose -log "$cc $flags $ccflags -c $source -o $object"
- catch "exec $cc $flags $ccflags -c $source -o $object" exec_output
+ set status [remote_exec host [concat sh -c [list "$cc $flags $ccflags -c $source -o $object 2>&1"]] "" "/dev/null" "ld.tmp"]
+ remote_upload host "ld.tmp"
+ set exec_output [file_contents "ld.tmp"]
+ remote_file build delete "ld.tmp"
+ remote_file host delete "ld.tmp"
set exec_output [prune_warnings $exec_output]
if [string match "" $exec_output] then {
if {![file exists $object]} then {
regexp ".*/(\[^/\]*)$" $source all dobj
regsub "\\.c" $dobj ".o" realobj
verbose "looking for $realobj"
- if {[file exists $realobj]} then {
+ if {[remote_file host exists $realobj]} then {
verbose -log "mv $realobj $object"
- catch "exec mv $realobj $object" exec_output
- set exec_output [prune_warnings $exec_output]
- if {![string match "" $exec_output]} then {
- verbose -log "$exec_output"
- perror "could not move $realobj to $object"
- return 0
- }
+ remote_upload "$realobj" "$object"
} else {
perror "$object not found after compilation"
return 0
@@ -281,23 +281,14 @@ proc default_ld_assemble { as source object } {
global ASFLAGS
global host_triplet
- if {[which $as] == 0} then {
- perror "$as does not exist"
- return 0
- }
-
if ![info exists ASFLAGS] { set ASFLAGS "" }
set flags [big_or_little_endian]
-
- verbose -log "$as $flags $ASFLAGS -o $object $source"
-
- catch "exec $as $flags $ASFLAGS -o $object $source" exec_output
+ set exec_output [run_host_cmd "$as" "$flags $ASFLAGS -o $object $source"]
set exec_output [prune_warnings $exec_output]
if [string match "" $exec_output] then {
return 1
} else {
- verbose -log "$exec_output"
perror "$source: assembly failed"
return 0
}
@@ -310,11 +301,6 @@ proc default_ld_nm { nm nmflags object } {
global nm_output
global host_triplet
- if {[which $nm] == 0} then {
- perror "$nm does not exist"
- return 0
- }
-
if {[info exists nm_output]} {
unset nm_output
}
@@ -326,15 +312,20 @@ proc default_ld_nm { nm nmflags object } {
set old_lc_all $env(LC_ALL)
}
set env(LC_ALL) "C"
+
verbose -log "$nm $NMFLAGS $nmflags $object >tmpdir/nm.out"
- catch "exec $nm $NMFLAGS $nmflags $object >tmpdir/nm.out" exec_output
+ set status [remote_exec host [concat sh -c [list "$nm $NMFLAGS $nmflags $object 2>ld.stderr"]] "" "/dev/null" "tmpdir/nm.out"]
if {[info exists old_lc_all]} {
set env(LC_ALL) $old_lc_all
} else {
unset env(LC_ALL)
}
- set exec_output [prune_warnings $exec_output]
+ remote_upload host "ld.stderr"
+ remote_upload host "tmpdir/nm.out" "tmpdir/nm.out"
+ set exec_output [prune_warnings [file_contents "ld.stderr"]]
+ remote_file host delete "ld.stderr"
+ remote_file build delete "ld.stderr"
if [string match "" $exec_output] then {
set file [open tmpdir/nm.out r]
while { [gets $file line] != -1 } {
@@ -706,6 +697,9 @@ proc run_dump_test { name } {
}
}
}
+ if { $opt_name == "as" || $opt_name == "ld" } {
+ set opt_val [subst $opt_val]
+ }
set opts($opt_name) [concat $opts($opt_name) $opt_val]
}
foreach opt { as ld } {
@@ -805,10 +799,13 @@ proc run_dump_test { name } {
set cmd "$AS $ASFLAGS $opts(as) $asflags($sourcefile) -o $objfile $sourcefile"
send_log "$cmd\n"
- set cmdret [catch "exec $cmd" comp_output]
- set comp_output [prune_warnings $comp_output]
+ set cmdret [remote_exec host [concat sh -c [list "$cmd 2>&1"]] "" "/dev/null" "ld.tmp"]
+ remote_upload host "ld.tmp"
+ set comp_output [prune_warnings [file_contents "ld.tmp"]]
+ remote_file host delete "ld.tmp"
+ remote_file build delete "ld.tmp"
- if { $cmdret != 0 || ![string match "" $comp_output] } then {
+ if { [lindex $cmdret 0] != 0 || ![string match "" $comp_output] } then {
send_log "$comp_output\n"
verbose "$comp_output" 3
@@ -840,43 +837,32 @@ proc run_dump_test { name } {
$opts(ld) -o $objfile $objfiles"
send_log "$cmd\n"
- set cmdret [catch "exec $cmd" comp_output]
- set comp_output [prune_warnings $comp_output]
-
- if { $cmdret != 0 } then {
- # If the executed program writes to stderr and stderr is not
- # redirected, exec *always* returns failure, regardless of the
- # program exit code. Thankfully, we can retrieve the true
- # return status from a special variable. Redirection would
- # cause a Tcl-specific message to be appended, and we'd rather
- # not deal with that if we can help it.
- global errorCode
- if { [lindex $errorCode 0] == "NONE" } {
- set cmdret 0
- }
- }
+ set cmdret [remote_exec host [concat sh -c [list "$cmd 2>&1"]] "" "/dev/null" "ld.tmp"]
+ remote_upload host "ld.tmp"
+ set comp_output [prune_warnings [file_contents "ld.tmp"]]
+ remote_file host delete "ld.tmp"
+ remote_file build delete "ld.tmp"
+ set cmdret [lindex $cmdret 0]
if { $cmdret == 0 && $run_objcopy } {
set infile $objfile
set objfile "tmpdir/dump1"
- catch "exec rm -f $objfile" exec_output
+ remote_file host delete $objfile
# Note that we don't use OBJCOPYFLAGS here; any flags must be
# explicitly specified.
set cmd "$OBJCOPY $opts(objcopy_linked_file) $infile $objfile"
send_log "$cmd\n"
- set cmdret [catch "exec $cmd" comp_output]
- append comp_output [prune_warnings $comp_output]
-
- if { $cmdret != 0 } then {
- global errorCode
- if { [lindex $errorCode 0] == "NONE" } {
- set cmdret 0
- }
- }
+ set cmdret [remote_exec host [concat sh -c [list "$cmd 2>&1"]] "" "/dev/null" "ld.tmp"]
+ remote_upload host "ld.tmp"
+ append comp_output [prune_warnings [file_contents "ld.tmp"]]
+ remote_file host delete "ld.tmp"
+ remote_file build delete "ld.tmp"
+ set cmdret [lindex $cmdret 0]
}
+ regsub "\n$" $comp_output "" comp_output
if { $cmdret != 0 || $comp_output != "" || $expmsg != "" } then {
set exitstat "succeeded"
if { $cmdret != 0 } { set exitstat "failed" }
@@ -911,7 +897,7 @@ proc run_dump_test { name } {
eval set progopts \$[string toupper $program]FLAGS
eval set binary \$[string toupper $program]
- if { [which $binary] == 0 } {
+ if { ![is_remote host] && [which $binary] == 0 } {
untested $testname
return
}
@@ -932,13 +918,16 @@ proc run_dump_test { name } {
}
set env(LC_ALL) "C"
send_log "$cmd\n"
- catch "exec $cmd" comp_output
+ set cmdret [remote_exec host [concat sh -c [list "$cmd 2>ld.tmp"]] "" "/dev/null"]
+ remote_upload host "ld.tmp"
+ set comp_output [prune_warnings [file_contents "ld.tmp"]]
+ remote_file host delete "ld.tmp"
+ remote_file build delete "ld.tmp"
if {[info exists old_lc_all]} {
set env(LC_ALL) $old_lc_all
} else {
unset env(LC_ALL)
}
- set comp_output [prune_warnings $comp_output]
if ![string match "" $comp_output] then {
send_log "$comp_output\n"
fail $testname
@@ -1196,15 +1185,19 @@ proc run_ld_link_tests { ldtests } {
set old_lc_all $env(LC_ALL)
}
set env(LC_ALL) "C"
- set cmd "$binary $progopts $binfile > dump.out"
+ set cmd "$binary $progopts $binfile"
+ set status [remote_exec host [concat sh -c [list "$cmd >dump.out 2>ld.stderr"]] "" "/dev/null"]
send_log "$cmd\n"
- catch "exec $cmd" comp_output
+ remote_upload host "ld.stderr"
+ set comp_output [prune_warnings [file_contents "ld.stderr"]]
+ remote_file host delete "ld.stderr"
+ remote_file build delete "ld.stderr"
+
if {[info exists old_lc_all]} {
set env(LC_ALL) $old_lc_all
} else {
unset env(LC_ALL)
}
- set comp_output [prune_warnings $comp_output]
if ![string match "" $comp_output] then {
send_log "$comp_output\n"
@@ -1212,11 +1205,17 @@ proc run_ld_link_tests { ldtests } {
break
}
+ remote_upload host "dump.out"
+
if { [regexp_diff "dump.out" "$srcdir/$subdir/$dumpfile"] } then {
verbose "output is [file_contents "dump.out"]" 2
set failed 1
+ remote_file build delete "dump.out"
+ remote_file host delete "dump.out"
break
}
+ remote_file build delete "dump.out"
+ remote_file host delete "dump.out"
}
}