aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2020-07-07 12:58:12 +0930
committerAlan Modra <amodra@gmail.com>2020-07-07 18:26:34 +0930
commit231b7382c061721f291d850a7a075d47e97de13c (patch)
tree480bd99be2d24b5930371e3fd946c7029b5d8024 /ld
parent7193487fa8d496a1df20eb8ea5007e9b43ac07cb (diff)
downloadgdb-231b7382c061721f291d850a7a075d47e97de13c.zip
gdb-231b7382c061721f291d850a7a075d47e97de13c.tar.gz
gdb-231b7382c061721f291d850a7a075d47e97de13c.tar.bz2
Use is_pecoff_format in ld testsuite
--image-base 0 is not just for x86_64 mingw. This patch fixes that, and a case where a changed LDFLAGS leaked out of one script to the next. * testsuite/ld-scripts/align.exp: Use is_pecoff_format. * testsuite/ld-scripts/defined.exp: Likewise. * testsuite/ld-scripts/provide.exp: Likewise. * testsuite/ld-scripts/weak.exp: Likewise. * testsuite/ld-scripts/empty-address.exp: Likewise. Reset LDFLAGS on exit. * testsuite/ld-scripts/expr.exp: Set LDFLAGS earlier, and with --image-base for PE. * testsuite/ld-scripts/include.exp: Set LDFLAGS for PE. * testsuite/ld-scripts/script.exp: Use is_pecoff_format, and set LDFLAGS as well as flags.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog14
-rw-r--r--ld/testsuite/ld-scripts/align.exp6
-rw-r--r--ld/testsuite/ld-scripts/defined.exp4
-rw-r--r--ld/testsuite/ld-scripts/empty-address.exp7
-rw-r--r--ld/testsuite/ld-scripts/expr.exp15
-rw-r--r--ld/testsuite/ld-scripts/include.exp4
-rw-r--r--ld/testsuite/ld-scripts/provide.exp4
-rw-r--r--ld/testsuite/ld-scripts/script.exp13
-rw-r--r--ld/testsuite/ld-scripts/weak.exp4
9 files changed, 46 insertions, 25 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 67bf035..ce29d72 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,5 +1,19 @@
2020-07-07 Alan Modra <amodra@gmail.com>
+ * testsuite/ld-scripts/align.exp: Use is_pecoff_format.
+ * testsuite/ld-scripts/defined.exp: Likewise.
+ * testsuite/ld-scripts/provide.exp: Likewise.
+ * testsuite/ld-scripts/weak.exp: Likewise.
+ * testsuite/ld-scripts/empty-address.exp: Likewise. Reset LDFLAGS
+ on exit.
+ * testsuite/ld-scripts/expr.exp: Set LDFLAGS earlier, and with
+ --image-base for PE.
+ * testsuite/ld-scripts/include.exp: Set LDFLAGS for PE.
+ * testsuite/ld-scripts/script.exp: Use is_pecoff_format, and
+ set LDFLAGS as well as flags.
+
+2020-07-07 Alan Modra <amodra@gmail.com>
+
* testsuite/ld-checks/checks.exp: Use is_xcoff_format.
* testsuite/ld-powerpc/powerpc.exp: Likewise.
* testsuite/ld-scripts/print-memory-usage.exp: Likewise.
diff --git a/ld/testsuite/ld-scripts/align.exp b/ld/testsuite/ld-scripts/align.exp
index 1520fa3..3817251 100644
--- a/ld/testsuite/ld-scripts/align.exp
+++ b/ld/testsuite/ld-scripts/align.exp
@@ -31,10 +31,10 @@ if ![ld_assemble $as $srcdir/$subdir/align.s tmpdir/align.o] {
return
}
-# mingw on x86_64 targets need to set the image base to 0 to avoid auto image-basing.
+# Avoid auto image-basing.
set saved_LDFLAGS "$LDFLAGS"
-if [istarget "x86_64-*-mingw*"] then {
- set LDFLAGS "$LDFLAGS --image-base 0"
+if { [is_pecoff_format] } then {
+ set LDFLAGS "$LDFLAGS --image-base 0"
}
if ![ld_link $ld tmpdir/align "$LDFLAGS -T $srcdir/$subdir/align.t tmpdir/align.o"] {
diff --git a/ld/testsuite/ld-scripts/defined.exp b/ld/testsuite/ld-scripts/defined.exp
index 6889f04..7a47030 100644
--- a/ld/testsuite/ld-scripts/defined.exp
+++ b/ld/testsuite/ld-scripts/defined.exp
@@ -28,8 +28,8 @@ if ![ld_assemble $as $srcdir/$subdir/defined.s tmpdir/def.o] {
}
set saved_LDFLAGS "$LDFLAGS"
-if [istarget "x86_64-*-mingw*"] then {
- set LDFLAGS "$LDFLAGS --image-base 0"
+if { [is_pecoff_format] } then {
+ set LDFLAGS "$LDFLAGS --image-base 0"
}
if { ![ld_link $ld tmpdir/def "$LDFLAGS -T $srcdir/$subdir/defined.t tmpdir/def.o"] } {
diff --git a/ld/testsuite/ld-scripts/empty-address.exp b/ld/testsuite/ld-scripts/empty-address.exp
index a505e57..d71202a 100644
--- a/ld/testsuite/ld-scripts/empty-address.exp
+++ b/ld/testsuite/ld-scripts/empty-address.exp
@@ -19,8 +19,9 @@
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
# MA 02110-1301, USA.
-if [istarget "x86_64-*-mingw*"] then {
- set LDFLAGS "$LDFLAGS --image-base 0"
+set old_LDFLAGS $LDFLAGS
+if { [is_pecoff_format] } then {
+ set LDFLAGS "$LDFLAGS --image-base 0"
}
run_dump_test empty-address-1
@@ -29,3 +30,5 @@ run_dump_test empty-address-2b
run_dump_test empty-address-3a
run_dump_test empty-address-3b
run_dump_test empty-address-3c
+
+set LDFLAGS $old_LDFLAGS
diff --git a/ld/testsuite/ld-scripts/expr.exp b/ld/testsuite/ld-scripts/expr.exp
index 08bf0ab..7b1c627 100644
--- a/ld/testsuite/ld-scripts/expr.exp
+++ b/ld/testsuite/ld-scripts/expr.exp
@@ -19,17 +19,20 @@
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
# MA 02110-1301, USA.
+set old_LDFLAGS $LDFLAGS
+if { [istarget spu*-*-*] } then {
+ set LDFLAGS "$LDFLAGS --no-overlays --local-store 0:0"
+} elseif { [is_pecoff_format] } then {
+ set LDFLAGS "$LDFLAGS --image-base 0"
+}
+
run_dump_test expr1
run_dump_test expr2
run_dump_test sane1
run_dump_test assign-loc
run_dump_test pr14962
run_dump_test pr14962-2
+run_dump_test pr18963
run_dump_test pr22267
-set old_ldflags $LDFLAGS
-if { [istarget spu*-*-*] } {
- set LDFLAGS "$LDFLAGS --no-overlays --local-store 0:0"
-}
-run_dump_test pr18963
-set LDFLAGS $old_ldflags
+set LDFLAGS $old_LDFLAGS
diff --git a/ld/testsuite/ld-scripts/include.exp b/ld/testsuite/ld-scripts/include.exp
index d74f30e..c7e2ee5 100644
--- a/ld/testsuite/ld-scripts/include.exp
+++ b/ld/testsuite/ld-scripts/include.exp
@@ -23,8 +23,10 @@ if [is_aout_format] {
}
set old_ldflags $LDFLAGS
-if { [istarget spu*-*-*] } {
+if { [istarget spu*-*-*] } then {
set LDFLAGS "$LDFLAGS --local-store 0:0 --no-overlays"
+} elseif { [is_pecoff_format] } then {
+ set LDFLAGS "$LDFLAGS --image-base 0"
}
set test_list [lsort [glob -nocomplain $srcdir/$subdir/include*.d]]
diff --git a/ld/testsuite/ld-scripts/provide.exp b/ld/testsuite/ld-scripts/provide.exp
index a4aee52..34aed40 100644
--- a/ld/testsuite/ld-scripts/provide.exp
+++ b/ld/testsuite/ld-scripts/provide.exp
@@ -31,8 +31,8 @@ if {[istarget "powerpc*-*-aix*"] || [istarget "rs6000-*-aix*"] || [is_aout_forma
}
set saved_LDFLAGS "$LDFLAGS"
-if [istarget "x86_64-*-mingw*"] then {
- set LDFLAGS "$LDFLAGS --image-base 0"
+if { [is_pecoff_format] } then {
+ set LDFLAGS "$LDFLAGS --image-base 0"
}
set test_list [lsort [glob -nocomplain $srcdir/$subdir/provide-*.d]]
diff --git a/ld/testsuite/ld-scripts/script.exp b/ld/testsuite/ld-scripts/script.exp
index 42bd452..108e539 100644
--- a/ld/testsuite/ld-scripts/script.exp
+++ b/ld/testsuite/ld-scripts/script.exp
@@ -183,13 +183,10 @@ proc extract_symbol_test { testfile testname } {
# PE targets need to set the image base to 0 to avoid complications from nm.
set flags ""
-if {[istarget "*-*-pe*"] \
- || [istarget "*-*-cygwin*"] \
- || [istarget "*-*-mingw*"] \
- || [istarget "*-*-winnt*"] \
- || [istarget "*-*-nt"] \
- || [istarget "*-*-interix*"] } then {
- set flags "--image-base 0"
+set old_LDFLAGS $LDFLAGS
+if { [is_pecoff_format] } then {
+ set flags "--image-base 0"
+ set LDFLAGS "$LDFLAGS --image-base 0"
}
if ![ld_link $ld tmpdir/script "$flags -T $srcdir/$subdir/script.t tmpdir/script.o"] {
@@ -235,3 +232,5 @@ run_dump_test "pr20302"
run_dump_test "segment-start" {{name (default)}}
run_dump_test "segment-start" {{name (overridden)} \
{ld -Ttext-segment=0x10000000}}
+
+set LDFLAGS $old_LDFLAGS
diff --git a/ld/testsuite/ld-scripts/weak.exp b/ld/testsuite/ld-scripts/weak.exp
index b0ca4ab..57986a3 100644
--- a/ld/testsuite/ld-scripts/weak.exp
+++ b/ld/testsuite/ld-scripts/weak.exp
@@ -44,8 +44,8 @@ if {! [ld_assemble $as $srcdir/$subdir/weak1.s tmpdir/weak1.o]
}
set saved_LDFLAGS "$LDFLAGS"
-if [istarget "x86_64-*-mingw*"] then {
- set LDFLAGS "$LDFLAGS --image-base 0"
+if { [is_pecoff_format] } then {
+ set LDFLAGS "$LDFLAGS --image-base 0"
}
set weak_regexp_big \