aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2018-01-29 04:54:57 -0800
committerH.J. Lu <hjl.tools@gmail.com>2018-01-29 04:55:23 -0800
commit98d72909f8f216fb9fc4d7c2c8e48dbe2823cd0b (patch)
treee357718d8f39db126db36a047097f42c3467f68a /ld/testsuite/lib/ld-lib.exp
parentPR22741, objcopy segfault on fuzzed COFF object (diff)
downloadbinutils-gdb-98d72909f8f216fb9fc4d7c2c8e48dbe2823cd0b.tar.gz
binutils-gdb-98d72909f8f216fb9fc4d7c2c8e48dbe2823cd0b.tar.bz2
binutils-gdb-98d72909f8f216fb9fc4d7c2c8e48dbe2823cd0b.zip
ld: Skip unsupported static executable tests
Skip static executable tests if static executable is unsupported. Tested on Linux/x86 without libc.a. PR ld/22732 * testsuite/config/default.exp (STATIC_LDFLAGS): New. Set to "-static" if target compiler supports it. * testsuite/ld-bootstrap/bootstrap.exp: Skip static executable tests if target compiler doesn't support it. * testsuite/ld-ifunc/ifunc.exp: Likewise. * testsuite/lib/ld-lib.exp (run_ld_link_exec_tests): Likewise. (run_cc_link_tests): Likewise.
Diffstat (limited to 'ld/testsuite/lib/ld-lib.exp')
-rw-r--r--ld/testsuite/lib/ld-lib.exp18
1 files changed, 16 insertions, 2 deletions
diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp
index a892b763984..3d645baccaa 100644
--- a/ld/testsuite/lib/ld-lib.exp
+++ b/ld/testsuite/lib/ld-lib.exp
@@ -1401,6 +1401,7 @@ proc run_ld_link_exec_tests { ldtests args } {
global errcnt
global exec_output
global board_cflags
+ global STATIC_LDFLAGS
# When using GCC as the linker driver, we need to specify board cflags when
# linking because cflags may contain linker options. For example when
@@ -1468,8 +1469,15 @@ proc run_ld_link_exec_tests { ldtests args } {
# compile only
pass $testname
continue;
- } elseif ![$link_proc $link_cmd $binfile "$board_cflags -L$srcdir/$subdir $ld_options $objfiles $ld_after"] {
- set failed 1
+ } else {
+ if { [string match "" $STATIC_LDFLAGS] \
+ && [regexp -- ".* \[-\]+static .*" " $board_cflags $ld_options $objfiles $ld_after "] } {
+ untested $testname
+ continue
+ }
+ if ![$link_proc $link_cmd $binfile "$board_cflags -L$srcdir/$subdir $ld_options $objfiles $ld_after"] {
+ set failed 1
+ }
}
# Check if exec_output is expected.
@@ -1549,6 +1557,7 @@ proc run_cc_link_tests { ldtests } {
global ar
global exec_output
global board_cflags
+ global STATIC_LDFLAGS
if [board_info [target_info name] exists cflags] {
set board_cflags " [board_info [target_info name] cflags]"
@@ -1646,6 +1655,11 @@ proc run_cc_link_tests { ldtests } {
set failed 1
}
} else {
+ if { [string match "" $STATIC_LDFLAGS] \
+ && [regexp -- ".* \[-\]+static .*" " $board_cflags $ldflags $objfiles "] } {
+ untested $testname
+ continue
+ }
ld_link $cc_cmd $binfile "$board_cflags -L$srcdir/$subdir $ldflags $objfiles"
set ld_output "$exec_output"