* 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 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.
(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)
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;
+ }
}
}
&& 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;
+}
(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 [];
#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
#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
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,