aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2010-01-26 13:21:36 +0000
committerH.J. Lu <hjl.tools@gmail.com>2010-01-26 13:21:36 +0000
commit98da7939e10a50f3efdac438c8f1af77bb602688 (patch)
tree22eb9f886c5470893af2e9ef30cdb1cf4bd1f07c /bfd
parent571f7b5e511481d23a7bfd05aef16b7213b8691c (diff)
downloadgdb-98da7939e10a50f3efdac438c8f1af77bb602688.zip
gdb-98da7939e10a50f3efdac438c8f1af77bb602688.tar.gz
gdb-98da7939e10a50f3efdac438c8f1af77bb602688.tar.bz2
Properly check undefined symbols when gc_sections is active.
bfd/ 2010-01-26 Alan Modra <amodra@gmail.com> H.J. Lu <hongjiu.lu@intel.com> PR ld/11218 * elflink.c (elf_link_output_extsym): Do not ignore undefined symbols with ref_regular set when gc_sections is active. ld/testsuite/ 2010-01-26 H.J. Lu <hongjiu.lu@intel.com> PR ld/11218 * ld-gc/dummy.s: New. * ld-gc/pr11218-1.c: Likewise. * ld-gc/pr11218-2.c: Likewise. * ld-gc/pr11218.d: Likewise.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog7
-rw-r--r--bfd/elflink.c9
2 files changed, 13 insertions, 3 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index c9c2d3a..75118cb 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,10 @@
+2010-01-26 Alan Modra <amodra@gmail.com>
+ H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/11218
+ * elflink.c (elf_link_output_extsym): Do not ignore undefined
+ symbols with ref_regular set when gc_sections is active.
+
2010-01-25 Alan Modra <amodra@gmail.com>
PR ld/11217
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 6576252..cca2d53 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -8579,7 +8579,9 @@ elf_link_output_extsym (struct elf_link_hash_entry *h, void *data)
{
/* If we have an undefined symbol reference here then it must have
come from a shared library that is being linked in. (Undefined
- references in regular files have already been handled). */
+ references in regular files have already been handled unless
+ they are in unreferenced sections which are removed by garbage
+ collection). */
bfd_boolean ignore_undef = FALSE;
/* Some symbols may be special in that the fact that they're
@@ -8590,12 +8592,13 @@ elf_link_output_extsym (struct elf_link_hash_entry *h, void *data)
/* If we are reporting errors for this situation then do so now. */
if (ignore_undef == FALSE
&& h->ref_dynamic
- && ! h->ref_regular
+ && (!h->ref_regular || finfo->info->gc_sections)
&& ! elf_link_check_versioned_symbol (finfo->info, bed, h)
&& finfo->info->unresolved_syms_in_shared_libs != RM_IGNORE)
{
if (! (finfo->info->callbacks->undefined_symbol
- (finfo->info, h->root.root.string, h->root.u.undef.abfd,
+ (finfo->info, h->root.root.string,
+ h->ref_regular ? NULL : h->root.u.undef.abfd,
NULL, 0, finfo->info->unresolved_syms_in_shared_libs == RM_GENERATE_ERROR)))
{
eoinfo->failed = TRUE;