From d88805311b781c162446afb8d31c2bb854b024cc Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Fri, 2 Jan 2009 16:48:11 +0000 Subject: bfd/ 2009-01-02 H.J. Lu PR ld/9676 * elflink.c (elf_link_add_object_symbols): Update def_dynamic, ref_dynamic and dynamic_def fields when setting def_regular to 1. ld/testsuite/ 2009-01-02 H.J. Lu PR ld/9676 * ld-elf/pr9676-1.c: New. * ld-elf/pr9676-2.c: Likewiswe. * ld-elf/pr9676-3.c: Likewiswe. * ld-elf/pr9676-4.c: Likewiswe. * ld-elf/pr9676.rd: Likewiswe. * ld-elf/shared.exp (build_tests): Add tests for libpr9676-1.a, libpr9676-2.a, libpr9676-3.so, libpr9676-4.so and libpr9676-4a.so. * lib/ld-lib.exp (ar_simple_create): New. (run_ld_link_tests): Support archive. (run_cc_link_tests): Likewiswe. --- ld/testsuite/lib/ld-lib.exp | 44 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) (limited to 'ld/testsuite/lib') 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] -- cgit v1.1