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.
This commit is contained in:
Nick Clifton 2011-05-18 14:04:32 +00:00
parent d0da06e2df
commit dd98f8d276
5 changed files with 45 additions and 12 deletions

View file

@ -1,3 +1,9 @@
2011-05-18 Nick Clifton <nickc@redhat.com>
PR ld/12761
* elflink.c (elf_link_add_object_symbols): Process .gnu.warning
sections when building shared libraries.
2011-05-18 Rafał Krypa <r.krypa@samsung.com>
PR ld/12778

View file

@ -3423,7 +3423,8 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
.gnu.warning.SYMBOL are treated as warning symbols for the given
symbol. This differs from .gnu.warning sections, which generate
warnings when they are included in an output file. */
if (info->executable)
/* PR 12761: Also generate this warning when building shared libraries. */
if (info->executable || info->shared)
{
asection *s;

View file

@ -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

View file

@ -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
}

View file

@ -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
}