aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2014-07-05 11:59:53 +0930
committerAlan Modra <amodra@gmail.com>2014-07-05 12:54:40 +0930
commitabc868c6090192b9bf3059da81e518bd744b8da3 (patch)
tree31f7da024f989c7ae138efff67d937f99dbd0e91 /ld
parent878f7dc7d15cd4f47943bef53c8201f4781d1807 (diff)
downloadgdb-abc868c6090192b9bf3059da81e518bd744b8da3.zip
gdb-abc868c6090192b9bf3059da81e518bd744b8da3.tar.gz
gdb-abc868c6090192b9bf3059da81e518bd744b8da3.tar.bz2
Rid libdummy.a from lto.exp
libdummy.a is used to make run_cc_link_tests compile objects and archive them. libdummy.a isn't used. What we're really doing is preventing a final link. So do that directly. * lib/ld-lib.exp (run_ld_link_tests): Stop after assembling objects if binfile is empty. (run_ld_link_exec_tests, run_cc_link_tests): Likewise. Tidy status checks. * ld-plugin/lto.exp: Don't use libdummy.a trick to compile objects. Instead use an empty output file.
Diffstat (limited to 'ld')
-rw-r--r--ld/testsuite/ChangeLog9
-rw-r--r--ld/testsuite/ld-plugin/lto.exp98
-rw-r--r--ld/testsuite/lib/ld-lib.exp33
3 files changed, 74 insertions, 66 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 7d3a6e4..f95fcbd 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,12 @@
+2014-07-05 Alan Modra <amodra@gmail.com>
+
+ * lib/ld-lib.exp (run_ld_link_tests): Stop after assembling objects
+ if binfile is empty.
+ (run_ld_link_exec_tests, run_cc_link_tests): Likewise. Tidy
+ status checks.
+ * ld-plugin/lto.exp: Don't use libdummy.a trick to compile objects.
+ Instead use an empty output file.
+
2014-07-03 Alan Modra <amodra@gmail.com>
* ld-elf/pr17068.s: New.
diff --git a/ld/testsuite/ld-plugin/lto.exp b/ld/testsuite/ld-plugin/lto.exp
index 6ff474e..e7f4427 100644
--- a/ld/testsuite/ld-plugin/lto.exp
+++ b/ld/testsuite/ld-plugin/lto.exp
@@ -43,81 +43,81 @@ set lto_link_tests {
{"LTO 1"
"-O2 -flto -fuse-linker-plugin" "-flto -fuse-linker-plugin"
{lto-1a.c lto-1b.c} {} "lto-1.exe"}
- {"Build libdummy.a 2"
+ {"Compile 2"
"" "-O2 -flto -fuse-linker-plugin"
- {lto-2.c} {} "libdummy.a"}
+ {lto-2.c} {} ""}
{"LTO 2"
"-static -O2 -flto -fuse-linker-plugin tmpdir/lto-2.o -lm" ""
{dummy.c} {} "lto-2.exe"}
- {"Build libdummy.a 3a"
+ {"Compile 3a"
"" "-flto"
- {lto-3a.c} {} "libdummy.a"}
- {"Build libdummy.a 3c"
+ {lto-3a.c} {} ""}
+ {"Compile 3c"
"" "-O2"
- {lto-3c.c} {} "libdummy.a"}
+ {lto-3c.c} {} ""}
{"Build liblto-3.a"
"" "-flto -ffat-lto-objects"
{lto-3b.c} {} "liblto-3.a"}
- {"Build libdummy.a 5a"
+ {"Compile 5a"
"" "-flto"
- {lto-5a.c} {} "libdummy.a"}
- {"Build libdummy.a 5b"
+ {lto-5a.c} {} ""}
+ {"Compile 5b"
"" "-flto"
- {lto-5b.c} {} "libdummy.a"}
+ {lto-5b.c} {} ""}
{"LTO 6"
"-O2 -flto -fuse-linker-plugin" ""
{lto-6.c} {} "lto-6.exe" "c"}
- {"Build libdummy.a 9"
+ {"Compile 9"
"" "-O2 -finline -flto"
- {lto-9.cc} {} "libdummy.a" "c++"}
- {"Build libdummy.a 11a"
+ {lto-9.cc} {} "" "c++"}
+ {"Compile 11a"
"" "-O -flto"
- {lto-11a.c} {} "libdummy.a"}
- {"Build libdummy.a 11b"
+ {lto-11a.c} {} ""}
+ {"Compile 11b"
"" "-O -flto"
- {lto-11b.c} {} "libdummy.a"}
- {"Build libdummy.a 11c"
+ {lto-11b.c} {} ""}
+ {"Compile 11c"
"" "-O"
- {lto-11c.c} {} "libdummy.a"}
+ {lto-11c.c} {} ""}
{"Build liblto-12.a"
"" "-O2 -flto"
{lto-12c.c} {} "liblto-12.a"}
- {"Build libdummy.a 12"
+ {"Compile 12"
"" "-O2 -flto"
- {lto-12a.c lto-12b.c} {} "libdummy.a"}
- {"Build libdummy.a 13"
+ {lto-12a.c lto-12b.c} {} ""}
+ {"Compile 13"
"" "-O2 -flto"
- {lto-13a.c lto-13b.c} {} "libdummy.a"}
+ {lto-13a.c lto-13b.c} {} ""}
{"Build liblto-13.a"
"" "-O2"
{lto-13c.c} {} "liblto-13.a"}
- {"Build libdummy.a 14a"
+ {"Compile 14a"
"" "-flto"
- {lto-14a.c lto-14b.c} {} "libdummy.a"}
+ {lto-14a.c lto-14b.c} {} ""}
{"Build liblto-14.a"
"" "-flto"
{lto-14c.c} {} "liblto-14.a"}
- {"Build libdummy.a 15a"
+ {"Compile 15a"
"" "-flto"
- {lto-15a.c} {} "libdummy.a"}
+ {lto-15a.c} {} ""}
{"Build liblto-15.a"
"" "-flto"
{lto-15b.c} {} "liblto-15.a"}
{"PR ld/12696"
"-O2 -flto -fuse-linker-plugin -r -nostdlib" "-O2 -flto"
{pr12696-1.cc} {} "pr12696-1r.o" "c++"}
- {"Build libdummy.a PR ld/12758"
+ {"Compile PR ld/12758"
"" ""
- {pr12758a.s} {} "libdummy.a"}
+ {pr12758a.s} {} ""}
{"Build libpr12758.a"
"" "-flto -O2 -ffat-lto-objects"
{pr12758b.c} {} "libpr12758.a"}
{"PR ld/12758"
"-O2 -Wl,-e,foo -nostdlib -flto -fuse-linker-plugin tmpdir/pr12758a.o -Wl,--start-group tmpdir/libpr12758.a -Wl,--end-group" ""
{dummy.c} {} "pr12758.exe"}
- {"Build libdummy.a PR ld/12760"
+ {"Compile PR ld/12760"
"" "-g -O0"
- {pr12760a.c} {} "libdummy.a"}
+ {pr12760a.c} {} ""}
{"Build libpr12760.a"
"" "-flto -O2 -ffat-lto-objects"
{pr12760b.c} {} "libpr12760.a"}
@@ -127,24 +127,24 @@ set lto_link_tests {
{"Build libpr13183.a"
"-T" "-flto -O2 -ffat-lto-objects"
{pr13183a.c} {} "libpr13183.a"}
- {"Build libdummy.a PR ld/13183"
+ {"Compile PR ld/13183"
"" "-flto -O2"
- {pr13183b.c} {} "libdummy.a"}
- {"Build libdummy.a PR ld/13201"
+ {pr13183b.c} {} ""}
+ {"Compile PR ld/13201"
"" "-flto -O2"
- {pr13201.c} {} "libdummy.a"}
+ {pr13201.c} {} ""}
{"PR ld/13287"
"-flto -fuse-linker-plugin -Wl,--as-needed" "-flto"
{pr13287.cc} {} "pr13287.exe" "c++"}
{"PR ld/15323"
"" "-O2"
- {pr15323a.c} {} "libdummy.a" "c"}
- {"Build libdummy.a(1) PR ld/pr16846"
+ {pr15323a.c} {} "" "c"}
+ {"Compile(1) PR ld/pr16846"
"" "-flto"
- {pr16846a.c pr16846b.c} {} "libdummy.a"}
- {"Build libdummy.a(2) PR ld/pr16846"
+ {pr16846a.c pr16846b.c} {} ""}
+ {"Compile(2) PR ld/pr16846"
"" ""
- {pr16846c.c} {} "libdummy.a"}
+ {pr16846c.c} {} ""}
{"PR ld/pr16846(1)"
"-flto -fuse-linker-plugin tmpdir/pr16846a.o tmpdir/pr16846b.o tmpdir/pr16846c.o" ""
{dummy.c} {} "pr16846a.exe"}
@@ -155,29 +155,29 @@ set lto_link_tests {
if { [at_least_gcc_version 4 7] } {
set lto_link_tests [concat $lto_link_tests {
- {"Build libdummy.a PR ld/12942 (1)"
+ {"Compile PR ld/12942 (1)"
"" "-flto -O2"
- {pr12942a.cc pr12942c.cc} {} "libdummy.a" "c++"}
- {"Build libdummy.a PR ld/12942 (2)"
+ {pr12942a.cc pr12942c.cc} {} "" "c++"}
+ {"Compile PR ld/12942 (2)"
"" "-O0"
- {pr12942b.cc} {} "libdummy.a" "c++"}
+ {pr12942b.cc} {} "" "c++"}
}]
}
# Generate input files for complex LTO tests for ELF.
set lto_link_elf_tests {
- {"Build libdummy.a 7"
+ {"Compile 7"
"" "-flto -O2"
- {lto-7a.c lto-7b.c lto-7c.c} {} "libdummy.a"}
+ {lto-7a.c lto-7b.c lto-7c.c} {} ""}
{"Build liblto-7.so"
"-shared" "-O2 -fpic"
{lto-7d.c} {} "liblto-7.so" "c"}
- {"Build libdummy.a 8a"
+ {"Compile 8a"
"" "-O2"
- {lto-8a.c} {} "libdummy.a"}
- {"Build libdummy.a 8b"
+ {lto-8a.c} {} ""}
+ {"Compile 8b"
"" "-flto -O2"
- {lto-8b.c} {} "libdummy.a"}
+ {lto-8b.c} {} ""}
{"Build liblto-17a.so"
"-shared -O2 -fpic -flto -fuse-linker-plugin" "-O2 -fpic -flto"
{lto-17a.c} {{"nm" {} "lto-17a.d"}} "liblto-17a.so" "c"}
diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp
index 27bfc08..5b3e01d 100644
--- a/ld/testsuite/lib/ld-lib.exp
+++ b/ld/testsuite/lib/ld-lib.exp
@@ -1131,7 +1131,9 @@ proc run_ld_link_tests { ldtests } {
continue
}
- if { [regexp ".*\\.a$" $binfile] } {
+ if { $binfile eq "tmpdir/" } {
+ # compile only
+ } elseif { [regexp ".*\\.a$" $binfile] } {
if { ![ar_simple_create $ar $ld_options $binfile "$objfiles $ld_after"] } {
set failed 1
}
@@ -1334,10 +1336,12 @@ proc run_ld_link_exec_tests { targets_to_xfail ldtests } {
set link_cmd $ld
}
- if ![$link_proc $link_cmd $binfile "-L$srcdir/$subdir $ld_options $objfiles"] {
+ if { $binfile eq "tmpdir/" } {
+ # compile only
+ pass $testname
+ continue;
+ } elseif ![$link_proc $link_cmd $binfile "-L$srcdir/$subdir $ld_options $objfiles"] {
set failed 1
- } else {
- set failed 0
}
# Check if exec_output is expected.
@@ -1450,18 +1454,16 @@ proc run_cc_link_tests { ldtests } {
set cc_cmd $CC
}
- if { [regexp ".*\\.a$" $binfile] } {
+ if { $binfile eq "tmpdir/" } {
+ # compile only
+ } elseif { [regexp ".*\\.a$" $binfile] } {
if { ![ar_simple_create $ar $ldflags $binfile "$objfiles"] } {
fail $testname
set failed 1
- } else {
- set failed 0
}
} else {
if { ![ld_simple_link $cc_cmd $binfile "-L$srcdir/$subdir $ldflags $objfiles"] } {
set failed 1
- } else {
- set failed 0
}
# Check if exec_output is expected.
@@ -1535,16 +1537,13 @@ proc run_cc_link_tests { ldtests } {
}
}
}
-
- if { $failed != 0 } {
- fail $testname
- } else { if { $is_unresolved == 0 } {
- pass $testname
- } }
}
- # Catch action errors.
- if { $is_unresolved != 0 } {
+ if { $failed != 0 } {
+ fail $testname
+ } elseif { $is_unresolved == 0 } {
+ pass $testname
+ } else {
unresolved $testname
continue
}