PATCH: PR ld/9676: link-failure: could not read symbols: Bad value
H.J. Lu
hjl.tools@gmail.com
Mon Dec 22 07:37:00 GMT 2008
A symbol, foo, is defined in a DSO first. And then it was defined
in a relocatable file. When we merge those 2, set to def_regular
to 1. But we didn't update def_dynamic. Later we we load it from a
discarded section, we set its st_shndx to SHN_UNDEF. If it has hidden
visibility, we think it is undefined and will try to resolve it from
archive again. This patch will update def_dynamic ref_dynamic and
dynamic_def fields when setting def_regular to 1. OK to install?
There is a small testcase in
http://sourceware.org/bugzilla/show_bug.cgi?id=9676
But linker test framework doesn't support AR.
Thanks.
H.J.
----
2008-12-21 H.J. Lu <hongjiu.lu@intel.com>
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.
--- bfd/elflink.c.hidden 2008-12-21 10:19:06.000000000 -0800
+++ bfd/elflink.c 2008-12-21 16:37:12.000000000 -0800
@@ -4346,7 +4346,15 @@ elf_link_add_object_symbols (bfd *abfd,
h->ref_regular_nonweak = 1;
}
else
- h->def_regular = 1;
+ {
+ h->def_regular = 1;
+ if (h->def_dynamic)
+ {
+ h->def_dynamic = 0;
+ h->ref_dynamic = 1;
+ h->dynamic_def = 1;
+ }
+ }
/* If the indirect symbol has been forced local, don't
make the real symbol dynamic. */
More information about the Binutils
mailing list