aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2011-05-18 14:04:32 +0000
committerNick Clifton <nickc@redhat.com>2011-05-18 14:04:32 +0000
commitdd98f8d276fb5538228255c4da43dd755738d151 (patch)
treecc041c39a61d0cbd8b5c9d31b7ac6098383bf235 /ld
parentd0da06e2dfbebf62eef7a2ec510240844972dbdb (diff)
downloadgdb-dd98f8d276fb5538228255c4da43dd755738d151.zip
gdb-dd98f8d276fb5538228255c4da43dd755738d151.tar.gz
gdb-dd98f8d276fb5538228255c4da43dd755738d151.tar.bz2
PR ld/12761
* elflink.c (elf_link_add_object_symbols): Process .gnu.warning sections when building shared libraries. * lib/ld-lib.exp (run_cc_link_tests): Add an optional 8th parameter - an expected warning message from the linker. * ld-elf/shared.exp (build_tests): Expect a warning message when building the libbarw.so library. * ld-elf/shared.exp: Run library building tests even when not building a native toolchain.
Diffstat (limited to 'ld')
-rw-r--r--ld/testsuite/ChangeLog11
-rw-r--r--ld/testsuite/ld-elf/shared.exp20
-rw-r--r--ld/testsuite/lib/ld-lib.exp17
3 files changed, 37 insertions, 11 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 0874ab4..356151a 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,14 @@
+2011-05-18 Nick Clifton <nickc@redhat.com>
+
+ PR ld/12761
+ * lib/ld-lib.exp (run_cc_link_tests): Add an optional 8th
+ parameter - an expected warning message from the linker.
+ * ld-elf/shared.exp (build_tests): Expect a warning message when
+ building the libbarw.so library.
+
+ * ld-elf/shared.exp: Run library building tests even when not
+ building a native toolchain.
+
2011-05-16 H.J. Lu <hongjiu.lu@intel.com>
* ld-scripts/phdrs.exp: Replace --private with
diff --git a/ld/testsuite/ld-elf/shared.exp b/ld/testsuite/ld-elf/shared.exp
index d0c3478..016d270 100644
--- a/ld/testsuite/ld-elf/shared.exp
+++ b/ld/testsuite/ld-elf/shared.exp
@@ -25,12 +25,7 @@ if ![is_elf_format] {
return
}
-# The following tests require running the executable generated by ld.
-if ![isnative] {
- return
-}
-
-# Check if compiler works
+# Check to see if the C compiler works
if { [which $CC] == 0 } {
return
}
@@ -47,7 +42,8 @@ set build_tests {
{begin.c end.c} {} "libbar.so"}
{"Build warn libbar.so"
"-shared" "-fPIC"
- {beginwarn.c end.c} {} "libbarw.so"}
+ {beginwarn.c end.c} {} "libbarw.so"
+ "C" "^.*\\\): warning: function foo is deprecated$"}
{"Build hidden libbar.so"
"-shared" "-fPIC"
{begin.c endhidden.c} {} "libbarh.so"}
@@ -156,6 +152,13 @@ set build_tests {
{pr11138-2.c} {} "libpr11138-2.o"}
}
+run_cc_link_tests $build_tests
+
+# The following tests require running the executable generated by ld.
+if ![isnative] {
+ return
+}
+
set run_tests {
{"Run normal with libfoo.so"
"tmpdir/begin.o tmpdir/libfoo.so tmpdir/end.o" ""
@@ -280,11 +283,10 @@ set run_tests {
{dummy.c} "pr11138b" "pr11138.out"}
}
-run_cc_link_tests $build_tests
# NetBSD ELF systems do not currently support the .*_array sections.
run_ld_link_exec_tests [list "*-*-netbsdelf*"] $run_tests
-# Check if compiler works
+# Check to see if the C++ compiler works
if { [which $CXX] == 0 } {
return
}
diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp
index 34de7c8..62e0ff7 100644
--- a/ld/testsuite/lib/ld-lib.exp
+++ b/ld/testsuite/lib/ld-lib.exp
@@ -1243,6 +1243,7 @@ proc run_ld_link_exec_tests { targets_to_xfail ldtests } {
# 4:action and options.
# 5:name of output file
# 6:language (optional)
+# 7:linker warnings (optional)
#
# Actions:
# objdump: Apply objdump options on result. Compare with regex (last arg).
@@ -1261,6 +1262,7 @@ proc run_cc_link_tests { ldtests } {
global CFLAGS
global CXXFLAGS
global ar
+ global exec_output
foreach testitem $ldtests {
set testname [lindex $testitem 0]
@@ -1270,6 +1272,7 @@ proc run_cc_link_tests { ldtests } {
set actions [lindex $testitem 4]
set binfile tmpdir/[lindex $testitem 5]
set lang [lindex $testitem 6]
+ set warnings [lindex $testitem 7]
set objfiles {}
set is_unresolved 0
set failed 0
@@ -1306,8 +1309,18 @@ proc run_cc_link_tests { ldtests } {
set failed 0
}
} elseif { ![ld_simple_link $cc_cmd $binfile "-L$srcdir/$subdir $ldflags $objfiles"] } {
- fail $testname
- set failed 1
+ # Check if exec_output is expected.
+ if { $warnings != "" } then {
+ verbose -log "returned with: <$exec_output>, expected: <$warnings>"
+ if { [regexp $warnings $exec_output] } then {
+ set failed 0
+ } else {
+ set failed 1
+ }
+ } else {
+ fail $testname
+ set failed 1
+ }
} else {
set failed 0
}