Also track weak references

PR ld/15149
	* elflink.c (elf_link_add_object_symbols): Also track weak
	references.
This commit is contained in:
H.J. Lu 2013-02-16 17:48:57 +00:00
parent 983dc440fe
commit 313ed4a9b0
2 changed files with 18 additions and 9 deletions

View File

@ -1,3 +1,9 @@
2013-02-16 H.J. Lu <hongjiu.lu@intel.com>
PR ld/15149
* elflink.c (elf_link_add_object_symbols): Also track weak
references.
2013-02-15 H.J. Lu <hongjiu.lu@intel.com> 2013-02-15 H.J. Lu <hongjiu.lu@intel.com>
PR binutils/15151 PR binutils/15151

View File

@ -4002,15 +4002,17 @@ error_free_dyn:
bfd_boolean skip; bfd_boolean skip;
/* If this is a definition of a symbol which was previously /* If this is a definition of a symbol which was previously
referenced in a non-weak manner then make a note of the bfd referenced, then make a note of the bfd that contained the
that contained the reference. This is used if we need to reference. This is used if we need to refer to the source
refer to the source of the reference later on. */ of the reference later on. */
if (! bfd_is_und_section (sec)) if (! bfd_is_und_section (sec))
{ {
h = elf_link_hash_lookup (elf_hash_table (info), name, FALSE, FALSE, FALSE); h = elf_link_hash_lookup (elf_hash_table (info), name,
FALSE, FALSE, FALSE);
if (h != NULL if (h != NULL
&& h->root.type == bfd_link_hash_undefined && (h->root.type == bfd_link_hash_undefined
|| h->root.type == bfd_link_hash_undefweak)
&& h->root.u.undef.abfd) && h->root.u.undef.abfd)
undef_bfd = h->root.u.undef.abfd; undef_bfd = h->root.u.undef.abfd;
} }
@ -4123,14 +4125,15 @@ error_free_dyn:
} }
/* If necessary, make a second attempt to locate the bfd /* If necessary, make a second attempt to locate the bfd
containing an unresolved, non-weak reference to the containing an unresolved reference to the current symbol. */
current symbol. */
if (! bfd_is_und_section (sec) && undef_bfd == NULL) if (! bfd_is_und_section (sec) && undef_bfd == NULL)
{ {
h = elf_link_hash_lookup (elf_hash_table (info), name, FALSE, FALSE, FALSE); h = elf_link_hash_lookup (elf_hash_table (info), name,
FALSE, FALSE, FALSE);
if (h != NULL if (h != NULL
&& h->root.type == bfd_link_hash_undefined && (h->root.type == bfd_link_hash_undefined
|| h->root.type == bfd_link_hash_undefweak)
&& h->root.u.undef.abfd) && h->root.u.undef.abfd)
undef_bfd = h->root.u.undef.abfd; undef_bfd = h->root.u.undef.abfd;
} }