This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: glibc built without .gnu.warning.symbol sections
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Binutils <binutils at sourceware dot org>
- Date: Wed, 24 Jul 2013 10:26:59 -0700
- Subject: Re: glibc built without .gnu.warning.symbol sections
- References: <20130720094728 dot GB3294 at bubble dot grove dot modra dot org>
On Sat, Jul 20, 2013 at 2:47 AM, Alan Modra <amodra@gmail.com> wrote:
> The fix for PR 12761 results in glibc libc.so.6 being built without
> warning sections. Fixed as follows.
>
> PR ld/15762
> * elflink.c (elf_link_add_object_symbols): Don't clobber
> .gnu.warning.symbol sections when shared.
>
> Index: bfd/elflink.c
> ===================================================================
> RCS file: /cvs/src/src/bfd/elflink.c,v
> retrieving revision 1.494
> diff -u -p -r1.494 elflink.c
> --- bfd/elflink.c 8 May 2013 23:31:38 -0000 1.494
> +++ bfd/elflink.c 20 Jul 2013 09:34:39 -0000
> @@ -3444,7 +3445,7 @@ elf_link_add_object_symbols (bfd *abfd,
> FALSE, bed->collect, NULL)))
> goto error_return;
>
> - if (! info->relocatable)
> + if (!info->relocatable && !info->shared)
This looks wrong. It will generate .gnu.warning.symbol sections in PIE.
Shouldn't the check be if (info->executable)?
> {
> /* Clobber the section size so that the warning does
> not get copied into the output file. */
>
I checked in this patch to add a testcase.
--
H.J.
---
2013-07-24 H.J. Lu <hongjiu.lu@intel.com>
PR ld/15762
* ld-elf/shared.exp (build_tests): Check .gnu.warning section
in the libbarw.so library.
* ld-elf/libbarw.rd: New.
* lib/ld-lib.exp (run_cc_link_tests): Support checking on
output with warning message.
diff --git a/ld/testsuite/ld-elf/libbarw.rd b/ld/testsuite/ld-elf/libbarw.rd
new file mode 100644
index 0000000..c650c17
--- /dev/null
+++ b/ld/testsuite/ld-elf/libbarw.rd
@@ -0,0 +1,3 @@
+#...
+ \[[ 0-9]+\] \.gnu.warning.foo[ \t]+PROGBITS[ \t0-9a-f]+.*
+#pass
diff --git a/ld/testsuite/ld-elf/shared.exp b/ld/testsuite/ld-elf/shared.exp
index 89409fa..56c724f 100644
--- a/ld/testsuite/ld-elf/shared.exp
+++ b/ld/testsuite/ld-elf/shared.exp
@@ -50,7 +50,7 @@ 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} {{readelf {-S --wide} libbarw.rd}} "libbarw.so"
"C" "^.*\\\): warning: function foo is deprecated$"}
{"Build hidden libbar.so"
"-shared" "-fPIC"
diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp
index ffbfd8b..256d826 100644
--- a/ld/testsuite/lib/ld-lib.exp
+++ b/ld/testsuite/lib/ld-lib.exp
@@ -1424,7 +1424,7 @@ proc run_cc_link_tests { ldtests } {
if { $warnings != "" } then {
verbose -log "returned with: <$exec_output>, expected: <$warnings>"
if { [regexp $warnings $exec_output] } then {
- set failed 2
+ set failed 0
} else {
set failed 1
}