aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2005-12-23 12:29:36 +0000
committerNick Clifton <nickc@redhat.com>2005-12-23 12:29:36 +0000
commit12ac1cf5374e06e54207ad961bcd4b721d5843b5 (patch)
treeb5ed8c6fdd5845c4aec07eaa58e39620ef87a8fe
parent69d246d9338a35e64b2244835ac6e77164be668a (diff)
downloadgdb-12ac1cf5374e06e54207ad961bcd4b721d5843b5.zip
gdb-12ac1cf5374e06e54207ad961bcd4b721d5843b5.tar.gz
gdb-12ac1cf5374e06e54207ad961bcd4b721d5843b5.tar.bz2
PR 1150
* elf-bfd.h (struct elf_backend_data): New field 'elf_backend_ignore_undef_symbol'. * elfxx-target.h (elf_backend_ignore_undef_symbol): Define to NULL if not already defined. (elfNN_bed): Initialise the elf_backend_ignore_undef_symbol field. * elfxx-mips.c (_bfd_mips_elf_ignore_undef_symbol): New function. * elfxx-mips.h (elf_backend_ignore_undef_symbol): Define and prototype. * elflink.c (elf_link_output_extsym): Check elf_backend_ignore_undef_symbol before reporting an undefined symbol in a shared library.
-rw-r--r--bfd/ChangeLog15
-rw-r--r--bfd/elf-bfd.h5
-rw-r--r--bfd/elflink.c42
-rw-r--r--bfd/elfxx-mips.c8
-rw-r--r--bfd/elfxx-mips.h3
-rw-r--r--bfd/elfxx-target.h4
6 files changed, 61 insertions, 16 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index a7efbca..521d51b 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,18 @@
+2005-12-23 Michael Weiser <michael@weiser.dinsnail.net>
+
+ PR 1150
+ * elf-bfd.h (struct elf_backend_data): New field
+ 'elf_backend_ignore_undef_symbol'.
+ * elfxx-target.h (elf_backend_ignore_undef_symbol): Define to NULL
+ if not already defined.
+ (elfNN_bed): Initialise the elf_backend_ignore_undef_symbol field.
+ * elfxx-mips.c (_bfd_mips_elf_ignore_undef_symbol): New function.
+ * elfxx-mips.h (elf_backend_ignore_undef_symbol): Define and
+ prototype.
+ * elflink.c (elf_link_output_extsym): Check
+ elf_backend_ignore_undef_symbol before reporting an undefined
+ symbol in a shared library.
+
2005-12-23 Joel Brobecker <brobecker@adacore.com>
* corefile.c (generic_core_file_matches_executable_p): New function.
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index f957283..18ccdb5 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -883,6 +883,11 @@ struct elf_backend_data
(struct elf_link_hash_entry *, const Elf_Internal_Sym *, bfd_boolean,
bfd_boolean);
+ /* Decide whether an undefined symbol is special and can be ignored.
+ This is the case for OPTIONAL symbols on IRIX. */
+ bfd_boolean (*elf_backend_ignore_undef_symbol)
+ (struct elf_link_hash_entry *);
+
/* Emit relocations. Overrides default routine for emitting relocs,
except during a relocatable link, or if all relocs are being emitted. */
bfd_boolean (*elf_backend_emit_relocs)
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 127f002..a065dca 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -6346,22 +6346,32 @@ elf_link_output_extsym (struct elf_link_hash_entry *h, void *data)
bed = get_elf_backend_data (finfo->output_bfd);
- /* 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). If we
- are reporting errors for this situation then do so now. */
- if (h->root.type == bfd_link_hash_undefined
- && h->ref_dynamic
- && !h->ref_regular
- && ! 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,
- NULL, 0, finfo->info->unresolved_syms_in_shared_libs == RM_GENERATE_ERROR)))
- {
- eoinfo->failed = TRUE;
- return FALSE;
+ if (h->root.type == bfd_link_hash_undefined)
+ {
+ /* 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). */
+ bfd_boolean ignore_undef = FALSE;
+
+ /* Some symbols may be special in that the fact that they're
+ undefined can be safely ignored - let backend determine that. */
+ if (bed->elf_backend_ignore_undef_symbol)
+ ignore_undef = bed->elf_backend_ignore_undef_symbol (h);
+
+ /* If we are reporting errors for this situation then do so now. */
+ if (ignore_undef == FALSE
+ && h->ref_dynamic
+ && ! h->ref_regular
+ && ! 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,
+ NULL, 0, finfo->info->unresolved_syms_in_shared_libs == RM_GENERATE_ERROR)))
+ {
+ eoinfo->failed = TRUE;
+ return FALSE;
+ }
}
}
diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
index af8f3c7..6849048 100644
--- a/bfd/elfxx-mips.c
+++ b/bfd/elfxx-mips.c
@@ -10012,3 +10012,11 @@ _bfd_mips_elf_merge_symbol_attribute (struct elf_link_hash_entry *h,
&& ELF_MIPS_IS_OPTIONAL (isym->st_other))
h->other |= STO_OPTIONAL;
}
+
+/* Decide whether an undefined symbol is special and can be ignored.
+ This is the case for OPTIONAL symbols on IRIX. */
+bfd_boolean
+_bfd_mips_elf_ignore_undef_symbol (struct elf_link_hash_entry *h)
+{
+ return ELF_MIPS_IS_OPTIONAL (h->other) ? TRUE : FALSE;
+}
diff --git a/bfd/elfxx-mips.h b/bfd/elfxx-mips.h
index 3af342a..07e661d 100644
--- a/bfd/elfxx-mips.h
+++ b/bfd/elfxx-mips.h
@@ -129,6 +129,8 @@ extern bfd_vma _bfd_mips_elf_sign_extend
(bfd_vma, int);
extern void _bfd_mips_elf_merge_symbol_attribute
(struct elf_link_hash_entry *, const Elf_Internal_Sym *, bfd_boolean, bfd_boolean);
+extern bfd_boolean _bfd_mips_elf_ignore_undef_symbol
+ (struct elf_link_hash_entry *);
extern const struct bfd_elf_special_section _bfd_mips_elf_special_sections [];
@@ -137,3 +139,4 @@ extern const struct bfd_elf_special_section _bfd_mips_elf_special_sections [];
#define elf_backend_special_sections _bfd_mips_elf_special_sections
#define elf_backend_eh_frame_address_size _bfd_mips_elf_eh_frame_address_size
#define elf_backend_merge_symbol_attribute _bfd_mips_elf_merge_symbol_attribute
+#define elf_backend_ignore_undef_symbol _bfd_mips_elf_ignore_undef_symbol
diff --git a/bfd/elfxx-target.h b/bfd/elfxx-target.h
index 2c9aa19..d8a15cf 100644
--- a/bfd/elfxx-target.h
+++ b/bfd/elfxx-target.h
@@ -420,6 +420,9 @@
#ifndef elf_backend_merge_symbol_attribute
#define elf_backend_merge_symbol_attribute NULL
#endif
+#ifndef elf_backend_ignore_undef_symbol
+#define elf_backend_ignore_undef_symbol NULL
+#endif
#ifndef elf_backend_emit_relocs
#define elf_backend_emit_relocs _bfd_elf_link_output_relocs
#endif
@@ -592,6 +595,7 @@ static const struct elf_backend_data elfNN_bed =
elf_backend_copy_indirect_symbol,
elf_backend_hide_symbol,
elf_backend_merge_symbol_attribute,
+ elf_backend_ignore_undef_symbol,
elf_backend_emit_relocs,
elf_backend_count_relocs,
elf_backend_grok_prstatus,