diff options
Diffstat (limited to 'ld/testsuite/lib')
-rw-r--r-- | ld/testsuite/lib/ld-lib.exp | 44 |
1 files changed, 42 insertions, 2 deletions
diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp index 6152065..b4f21fd 100644 --- a/ld/testsuite/lib/ld-lib.exp +++ b/ld/testsuite/lib/ld-lib.exp @@ -1093,6 +1093,22 @@ proc file_contents { filename } { return $contents } +# Create an archive using ar +# +proc ar_simple_create { ar target objects } { + remote_file host delete $target + + set exec_output [run_host_cmd "$ar" "rc $target $objects"] + set exec_output [prune_warnings $exec_output] + + if [string match "" $exec_output] then { + send_log "$exec_output\n" + return 1 + } else { + return 0 + } +} + # List contains test-items with 3 items followed by 2 lists, one item and # one optional item: # 0:name 1:ld options 2:assembler options @@ -1108,6 +1124,7 @@ proc run_ld_link_tests { ldtests } { global ld global as global nm + global ar global objdump global READELF global srcdir @@ -1161,10 +1178,21 @@ proc run_ld_link_tests { ldtests } { continue } - if ![ld_simple_link $ld $binfile "-L$srcdir/$subdir $ld_options $objfiles"] { + if [regexp ".*a$" $binfile] then { + if ![ar_simple_create $ar $binfile "$objfiles"] { + fail $testname + set failed 1 + } else { + set failed 0 + } + } elseif ![ld_simple_link $ld $binfile "-L$srcdir/$subdir $ld_options $objfiles"] { fail $testname + set failed 1 } else { set failed 0 + } + + if { $failed == 0 } { foreach actionlist $actions { set action [lindex $actionlist 0] set progopts [lindex $actionlist 1] @@ -1429,6 +1457,7 @@ proc run_cc_link_tests { ldtests } { global CXX global CFLAGS global CXXFLAGS + global ar foreach testitem $ldtests { set testname [lindex $testitem 0] @@ -1466,10 +1495,21 @@ proc run_cc_link_tests { ldtests } { set cc_cmd $CC } - if ![ld_simple_link $cc_cmd $binfile "-L$srcdir/$subdir $ldflags $objfiles"] { + if [regexp ".*a$" $binfile] then { + if ![ar_simple_create $ar $binfile "$objfiles"] { + fail $testname + set failed 1 + } else { + set failed 0 + } + } elseif ![ld_simple_link $cc_cmd $binfile "-L$srcdir/$subdir $ldflags $objfiles"] { fail $testname + set failed 1 } else { set failed 0 + } + + if { $failed == 0 } { foreach actionlist $actions { set action [lindex $actionlist 0] set progopts [lindex $actionlist 1] |