diff options
author | Alan Modra <amodra@gmail.com> | 2002-03-28 03:27:46 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2002-03-28 03:27:46 +0000 |
commit | e92d460e59b5271ec44858eecd5b0957eb75ea12 (patch) | |
tree | c875ac49157ba6262d0b0aceb8fa6ce6c688f1b4 | |
parent | 48b2f8d70e2630718ebc1a9b563c02aecc4e36ed (diff) | |
download | gdb-e92d460e59b5271ec44858eecd5b0957eb75ea12.zip gdb-e92d460e59b5271ec44858eecd5b0957eb75ea12.tar.gz gdb-e92d460e59b5271ec44858eecd5b0957eb75ea12.tar.bz2 |
* linker.c (link_action): Ignore duplicate warning syms.
(_bfd_generic_link_write_global_symbol): Follow warning symbol link.
* elflink.h (elf_adjust_dynstr_offsets): Likewise.
(elf_adjust_dynamic_symbol): Likewise.
(elf_export_symbol): Likewise.
(elf_link_find_version_dependencies): Likewise.
(elf_link_assign_sym_version): Likewise.
(elf_link_sec_merge_syms): Likewise.
(elf_link_output_extsym): Likewise.
(elf_gc_sweep_symbol): Likewise.
(elf_gc_propagate_vtable_entries_used): Likewise.
(elf_gc_smash_unused_vtentry_relocs): Likewise.
(elf_gc_allocate_got_offsets): Likewise.
(elf_collect_hash_codes): Likewise.
* elflink.c (elf_link_renumber_hash_table_dynsyms): Likewise.
* elf-hppa.h (elf_hppa_unmark_useless_dynamic_symbols): Likewise.
(elf_hppa_remark_useless_dynamic_symbols): Likewise.
* elf-m10300.c (elf32_mn10300_finish_hash_table_entry): Likewise.
* elf32-arm.h (elf32_arm_discard_copies): Likewise.
* elf32-cris.c (elf_cris_adjust_gotplt_to_got): Likewise.
(elf_cris_discard_excess_dso_dynamics): Likewise.
* elf32-hppa.c (clobber_millicode_symbols): Likewise.
(mark_PIC_calls): Likewise.
(allocate_plt_static): Likewise.
(allocate_dynrelocs): Likewise.
(readonly_dynrelocs): Likewise.
* elf32-i386.c (allocate_dynrelocs): Likewise.
(readonly_dynrelocs): Likewise.
* elf32-i370.c (i370_elf_adjust_dynindx): Likewise.
* elf32-m68k.c (elf_m68k_discard_copies): Likewise.
* elf32-mips.c (mips_elf_output_extsym): Likewise.
(mips_elf_sort_hash_table_f): Likewise.
(mips_elf_check_mips16_stubs): Likewise.
* elf32-s390.c (allocate_dynrelocs): Likewise.
(readonly_dynrelocs): Likewise.
* elf32-sh.c (sh_elf_discard_copies): Likewise.
* elf32-xstormy16.c (xstormy16_relax_plt_check): Likewise.
(xstormy16_relax_plt_realloc): Likewise.
* elf64-alpha.c (elf64_alpha_calc_got_offsets_for_symbol): Likewise.
(elf64_alpha_output_extsym): Likewise.
* elf64-hppa.c (elf64_hppa_mark_exported_functions): Likewise.
* elf64-mips.c (mips_elf64_sort_hash_table_f): Likewise.
(mips_elf64_check_mips16_stubs): Likewise.
(mips_elf64_output_extsym): Likewise.
* elf64-ppc.c (func_desc_adjust): Likewise.
(allocate_dynrelocs): Likewise.
(readonly_dynrelocs): Likewise.
* elf64-s390.c (allocate_dynrelocs): Likewise.
(readonly_dynrelocs): Likewise.
* elf64-sh64.c (sh64_elf64_discard_copies): Likewise.
* elf64-x86-64.c (allocate_dynrelocs): Likewise.
(readonly_dynrelocs): Likewise.
* elfxx-ia64.c (elfNN_ia64_global_dyn_sym_thunk): Likewise.
* aoutx.h (aout_link_write_other_symbol): Likewise.
* cofflink.c (_bfd_coff_write_task_globals): Likewise.
(_bfd_coff_write_global_sym): Likewise.
* i386linux.c (linux_tally_symbols): Likewise.
* m68klinux.c (linux_tally_symbols): Likewise.
* sparclinux.c (linux_tally_symbols): Likewise.
* pdp11.c (aout_link_write_other_symbol): Likewise.
* sunos.c (sunos_scan_dynamic_symbol): Likewise.
* xcofflink.c (xcoff_build_ldsyms): Likewise.
(xcoff_write_global_symbol): Likewise.
* cofflink.c (_bfd_coff_final_link): Formatting.
* cpu-mips.c (mips_compatible): Make static, prototype.
* elf32-i386.c (elf_i386_check_relocs): Formatting.
* elf32-sh.c (sh_elf_size_dynamic_sections): Likewise.
* elf64-alpha.c (elf64_alpha_output_extsym): Likewise.
* elf64-mips.c (mips_elf64_sort_hash_table): Likewise.
(mips_elf64_final_link): Likewise.
* elflink.h (elf_link_find_version_dependencies): Remove duplicate
prototype.
-rw-r--r-- | bfd/ChangeLog | 76 | ||||
-rw-r--r-- | bfd/aoutx.h | 15 | ||||
-rw-r--r-- | bfd/cofflink.c | 20 | ||||
-rw-r--r-- | bfd/cpu-mips.c | 5 | ||||
-rw-r--r-- | bfd/ecoff.c | 15 | ||||
-rw-r--r-- | bfd/elf-hppa.h | 6 | ||||
-rw-r--r-- | bfd/elf-m10300.c | 3 | ||||
-rw-r--r-- | bfd/elf32-arm.h | 3 | ||||
-rw-r--r-- | bfd/elf32-cris.c | 9 | ||||
-rw-r--r-- | bfd/elf32-hppa.c | 21 | ||||
-rw-r--r-- | bfd/elf32-i370.c | 5 | ||||
-rw-r--r-- | bfd/elf32-i386.c | 21 | ||||
-rw-r--r-- | bfd/elf32-m68k.c | 5 | ||||
-rw-r--r-- | bfd/elf32-mips.c | 9 | ||||
-rw-r--r-- | bfd/elf32-s390.c | 11 | ||||
-rw-r--r-- | bfd/elf32-sh.c | 7 | ||||
-rw-r--r-- | bfd/elf32-xstormy16.c | 6 | ||||
-rw-r--r-- | bfd/elf64-alpha.c | 113 | ||||
-rw-r--r-- | bfd/elf64-hppa.c | 5 | ||||
-rw-r--r-- | bfd/elf64-mips.c | 19 | ||||
-rw-r--r-- | bfd/elf64-ppc.c | 15 | ||||
-rw-r--r-- | bfd/elf64-s390.c | 11 | ||||
-rw-r--r-- | bfd/elf64-sh64.c | 3 | ||||
-rw-r--r-- | bfd/elf64-x86-64.c | 9 | ||||
-rw-r--r-- | bfd/elflink.c | 5 | ||||
-rw-r--r-- | bfd/elflink.h | 61 | ||||
-rw-r--r-- | bfd/elfxx-ia64.c | 3 | ||||
-rw-r--r-- | bfd/i386linux.c | 5 | ||||
-rw-r--r-- | bfd/linker.c | 5 | ||||
-rw-r--r-- | bfd/m68klinux.c | 5 | ||||
-rw-r--r-- | bfd/pdp11.c | 9 | ||||
-rw-r--r-- | bfd/sparclinux.c | 5 | ||||
-rw-r--r-- | bfd/sunos.c | 3 | ||||
-rw-r--r-- | bfd/xcofflink.c | 10 |
34 files changed, 407 insertions, 116 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 7ed6fe0..3fcd3e5 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,79 @@ +2002-03-28 Alan Modra <amodra@bigpond.net.au> + + * linker.c (link_action): Ignore duplicate warning syms. + (_bfd_generic_link_write_global_symbol): Follow warning symbol link. + * elflink.h (elf_adjust_dynstr_offsets): Likewise. + (elf_adjust_dynamic_symbol): Likewise. + (elf_export_symbol): Likewise. + (elf_link_find_version_dependencies): Likewise. + (elf_link_assign_sym_version): Likewise. + (elf_link_sec_merge_syms): Likewise. + (elf_link_output_extsym): Likewise. + (elf_gc_sweep_symbol): Likewise. + (elf_gc_propagate_vtable_entries_used): Likewise. + (elf_gc_smash_unused_vtentry_relocs): Likewise. + (elf_gc_allocate_got_offsets): Likewise. + (elf_collect_hash_codes): Likewise. + * elflink.c (elf_link_renumber_hash_table_dynsyms): Likewise. + * elf-hppa.h (elf_hppa_unmark_useless_dynamic_symbols): Likewise. + (elf_hppa_remark_useless_dynamic_symbols): Likewise. + * elf-m10300.c (elf32_mn10300_finish_hash_table_entry): Likewise. + * elf32-arm.h (elf32_arm_discard_copies): Likewise. + * elf32-cris.c (elf_cris_adjust_gotplt_to_got): Likewise. + (elf_cris_discard_excess_dso_dynamics): Likewise. + * elf32-hppa.c (clobber_millicode_symbols): Likewise. + (mark_PIC_calls): Likewise. + (allocate_plt_static): Likewise. + (allocate_dynrelocs): Likewise. + (readonly_dynrelocs): Likewise. + * elf32-i386.c (allocate_dynrelocs): Likewise. + (readonly_dynrelocs): Likewise. + * elf32-i370.c (i370_elf_adjust_dynindx): Likewise. + * elf32-m68k.c (elf_m68k_discard_copies): Likewise. + * elf32-mips.c (mips_elf_output_extsym): Likewise. + (mips_elf_sort_hash_table_f): Likewise. + (mips_elf_check_mips16_stubs): Likewise. + * elf32-s390.c (allocate_dynrelocs): Likewise. + (readonly_dynrelocs): Likewise. + * elf32-sh.c (sh_elf_discard_copies): Likewise. + * elf32-xstormy16.c (xstormy16_relax_plt_check): Likewise. + (xstormy16_relax_plt_realloc): Likewise. + * elf64-alpha.c (elf64_alpha_calc_got_offsets_for_symbol): Likewise. + (elf64_alpha_output_extsym): Likewise. + * elf64-hppa.c (elf64_hppa_mark_exported_functions): Likewise. + * elf64-mips.c (mips_elf64_sort_hash_table_f): Likewise. + (mips_elf64_check_mips16_stubs): Likewise. + (mips_elf64_output_extsym): Likewise. + * elf64-ppc.c (func_desc_adjust): Likewise. + (allocate_dynrelocs): Likewise. + (readonly_dynrelocs): Likewise. + * elf64-s390.c (allocate_dynrelocs): Likewise. + (readonly_dynrelocs): Likewise. + * elf64-sh64.c (sh64_elf64_discard_copies): Likewise. + * elf64-x86-64.c (allocate_dynrelocs): Likewise. + (readonly_dynrelocs): Likewise. + * elfxx-ia64.c (elfNN_ia64_global_dyn_sym_thunk): Likewise. + * aoutx.h (aout_link_write_other_symbol): Likewise. + * cofflink.c (_bfd_coff_write_task_globals): Likewise. + (_bfd_coff_write_global_sym): Likewise. + * i386linux.c (linux_tally_symbols): Likewise. + * m68klinux.c (linux_tally_symbols): Likewise. + * sparclinux.c (linux_tally_symbols): Likewise. + * pdp11.c (aout_link_write_other_symbol): Likewise. + * sunos.c (sunos_scan_dynamic_symbol): Likewise. + * xcofflink.c (xcoff_build_ldsyms): Likewise. + (xcoff_write_global_symbol): Likewise. + + * cofflink.c (_bfd_coff_final_link): Formatting. + * cpu-mips.c (mips_compatible): Make static, prototype. + * elf32-i386.c (elf_i386_check_relocs): Formatting. + * elf32-sh.c (sh_elf_size_dynamic_sections): Likewise. + * elf64-alpha.c (elf64_alpha_output_extsym): Likewise. + * elf64-mips.c (mips_elf64_sort_hash_table): Likewise. + (mips_elf64_final_link): Likewise. + * elflink.h (elf_link_find_version_dependencies): Remove duplicate + prototype. + 2002-03-27 Nick Clifton <nickc@cambridge.redhat.com> * coff-arm.c (SWAP_IN_RELOC_OFFSET): Define. diff --git a/bfd/aoutx.h b/bfd/aoutx.h index 0a3c05a..3c9cd4f 100644 --- a/bfd/aoutx.h +++ b/bfd/aoutx.h @@ -1,6 +1,6 @@ /* BFD semi-generic back-end for a.out binaries. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000, - 2001 + 2001, 2002 Free Software Foundation, Inc. Written by Cygnus Support. @@ -4577,6 +4577,13 @@ aout_link_write_other_symbol (h, data) bfd_size_type indx; bfd_size_type amt; + if (h->root.type == bfd_link_hash_warning) + { + h = (struct aout_link_hash_entry *) h->root.u.i.link; + if (h->root.type == bfd_link_hash_new) + return true; + } + output_bfd = finfo->output_bfd; if (aout_backend_info (output_bfd)->write_dynamic_symbol != NULL) @@ -4605,6 +4612,7 @@ aout_link_write_other_symbol (h, data) switch (h->root.type) { default: + case bfd_link_hash_warning: abort (); /* Avoid variable not initialized warnings. */ return true; @@ -4646,9 +4654,8 @@ aout_link_write_other_symbol (h, data) type = N_WEAKU; val = 0; case bfd_link_hash_indirect: - case bfd_link_hash_warning: - /* FIXME: Ignore these for now. The circumstances under which - they should be written out are not clear to me. */ + /* We ignore these symbols, since the indirected symbol is + already in the hash table. */ return true; } diff --git a/bfd/cofflink.c b/bfd/cofflink.c index 00a5289..8a80c14 100644 --- a/bfd/cofflink.c +++ b/bfd/cofflink.c @@ -1,5 +1,5 @@ /* COFF specific linker code. - Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 + Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. @@ -1005,7 +1005,8 @@ _bfd_coff_final_link (abfd, info) if (info->task_link) { finfo.failed = false; - coff_link_hash_traverse (coff_hash_table (info), _bfd_coff_write_task_globals, + coff_link_hash_traverse (coff_hash_table (info), + _bfd_coff_write_task_globals, (PTR) &finfo); if (finfo.failed) goto error_return; @@ -1013,7 +1014,8 @@ _bfd_coff_final_link (abfd, info) /* Write out the global symbols. */ finfo.failed = false; - coff_link_hash_traverse (coff_hash_table (info), _bfd_coff_write_global_sym, + coff_link_hash_traverse (coff_hash_table (info), + _bfd_coff_write_global_sym, (PTR) &finfo); if (finfo.failed) goto error_return; @@ -2497,6 +2499,13 @@ _bfd_coff_write_global_sym (h, data) output_bfd = finfo->output_bfd; + if (h->root.type == bfd_link_hash_warning) + { + h = (struct coff_link_hash_entry *) h->root.u.i.link; + if (h->root.type == bfd_link_hash_new) + return true; + } + if (h->indx >= 0) return true; @@ -2512,6 +2521,7 @@ _bfd_coff_write_global_sym (h, data) { default: case bfd_link_hash_new: + case bfd_link_hash_warning: abort (); return false; @@ -2544,7 +2554,6 @@ _bfd_coff_write_global_sym (h, data) break; case bfd_link_hash_indirect: - case bfd_link_hash_warning: /* Just ignore these. They can't be handled anyhow. */ return true; } @@ -2699,6 +2708,9 @@ _bfd_coff_write_task_globals (h, data) boolean rtnval = true; boolean save_global_to_static; + if (h->root.type == bfd_link_hash_warning) + h = (struct coff_link_hash_entry *) h->root.u.i.link; + if (h->indx < 0) { switch (h->root.type) diff --git a/bfd/cpu-mips.c b/bfd/cpu-mips.c index 10dd0b7..be8f97f 100644 --- a/bfd/cpu-mips.c +++ b/bfd/cpu-mips.c @@ -23,10 +23,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "sysdep.h" #include "libbfd.h" +static const bfd_arch_info_type *mips_compatible + PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *)); + /* The default routine tests bits_per_word, which is wrong on mips as mips word size doesn't correlate with reloc size. */ -const bfd_arch_info_type * +static const bfd_arch_info_type * mips_compatible (a, b) const bfd_arch_info_type *a; const bfd_arch_info_type *b; diff --git a/bfd/ecoff.c b/bfd/ecoff.c index 1e3b6a9..70224cb 100644 --- a/bfd/ecoff.c +++ b/bfd/ecoff.c @@ -1,5 +1,5 @@ /* Generic ECOFF (Extended-COFF) routines. - Copyright 1990, 1991, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 + Copyright 1990, 1991, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. Original version by Per Bothner. Full support added by Ian Lance Taylor, ian@cygnus.com. @@ -4393,6 +4393,13 @@ ecoff_link_write_external (h, data) bfd *output_bfd = einfo->abfd; boolean strip; + if (h->root.type == bfd_link_hash_warning) + { + h = (struct ecoff_link_hash_entry *) h->root.u.i.link; + if (h->root.type == bfd_link_hash_new) + return true; + } + /* We need to check if this symbol is being stripped. */ if (h->root.type == bfd_link_hash_undefined || h->root.type == bfd_link_hash_undefweak) @@ -4474,6 +4481,7 @@ ecoff_link_write_external (h, data) switch (h->root.type) { default: + case bfd_link_hash_warning: case bfd_link_hash_new: abort (); case bfd_link_hash_undefined: @@ -4502,9 +4510,8 @@ ecoff_link_write_external (h, data) h->esym.asym.value = h->root.u.c.size; break; case bfd_link_hash_indirect: - case bfd_link_hash_warning: - /* FIXME: Ignore these for now. The circumstances under which - they should be written out are not clear to me. */ + /* We ignore these symbols, since the indirected symbol is + already in the hash table. */ return true; } diff --git a/bfd/elf-hppa.h b/bfd/elf-hppa.h index 8e477bd..63d95c5 100644 --- a/bfd/elf-hppa.h +++ b/bfd/elf-hppa.h @@ -1079,6 +1079,9 @@ elf_hppa_unmark_useless_dynamic_symbols (h, data) { struct bfd_link_info *info = (struct bfd_link_info *)data; + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + /* If we are not creating a shared library, and this symbol is referenced by a shared library but is not defined anywhere, then the generic code will warn that it is undefined. @@ -1112,6 +1115,9 @@ elf_hppa_remark_useless_dynamic_symbols (h, data) { struct bfd_link_info *info = (struct bfd_link_info *)data; + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + /* If we are not creating a shared library, and this symbol is referenced by a shared library but is not defined anywhere, then the generic code will warn that it is undefined. diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c index e006ac2..a80060a 100644 --- a/bfd/elf-m10300.c +++ b/bfd/elf-m10300.c @@ -709,6 +709,9 @@ elf32_mn10300_finish_hash_table_entry (gen_entry, in_args) entry = (struct elf32_mn10300_link_hash_entry *) gen_entry; + if (entry->root.root.type == bfd_link_hash_warning) + entry = (struct elf32_mn10300_link_hash_entry *) entry->root.root.u.i.link; + /* If we already know we want to convert "call" to "calls" for calls to this symbol, then return now. */ if (entry->flags == MN10300_CONVERT_CALL_TO_CALLS) diff --git a/bfd/elf32-arm.h b/bfd/elf32-arm.h index 0496541..d420e5b 100644 --- a/bfd/elf32-arm.h +++ b/bfd/elf32-arm.h @@ -3288,6 +3288,9 @@ elf32_arm_discard_copies (h, ignore) { struct elf32_arm_pcrel_relocs_copied * s; + if (h->root.root.type == bfd_link_hash_warning) + h = (struct elf32_arm_link_hash_entry *) h->root.root.u.i.link; + /* We only discard relocs for symbols defined in a regular object. */ if ((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) return true; diff --git a/bfd/elf32-cris.c b/bfd/elf32-cris.c index ef8c951..30570ee 100644 --- a/bfd/elf32-cris.c +++ b/bfd/elf32-cris.c @@ -1930,6 +1930,9 @@ elf_cris_adjust_gotplt_to_got (h, p) BFD_ASSERT (dynobj != NULL); + if (h->root.root.type == bfd_link_hash_warning) + h = (struct elf_cris_link_hash_entry *) h->root.root.u.i.link; + /* If nobody wanted a GOTPLT with this symbol, we're done. */ if (h->gotplt_refcount <= 0) return true; @@ -2881,6 +2884,9 @@ elf_cris_discard_excess_dso_dynamics (h, inf) struct elf_cris_pcrel_relocs_copied *s; struct bfd_link_info *info = (struct bfd_link_info *) inf; + if (h->root.root.type == bfd_link_hash_warning) + h = (struct elf_cris_link_hash_entry *) h->root.root.u.i.link; + /* If a symbol has been forced local or we have found a regular definition for the symbolic link case, then we won't be needing any relocs. */ @@ -2906,6 +2912,9 @@ elf_cris_discard_excess_program_dynamics (h, inf) { struct bfd_link_info *info = (struct bfd_link_info *) inf; + if (h->root.root.type == bfd_link_hash_warning) + h = (struct elf_cris_link_hash_entry *) h->root.root.u.i.link; + /* If we're not creating a shared library and have a symbol which is referred to by .got references, but the symbol is defined locally, (or rather, not referred to by a DSO and not defined by a DSO) then diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c index 74482f3..a8d0a44 100644 --- a/bfd/elf32-hppa.c +++ b/bfd/elf32-hppa.c @@ -1982,6 +1982,9 @@ mark_PIC_calls (h, inf) struct elf_link_hash_entry *h; PTR inf ATTRIBUTE_UNUSED; { + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + if (! (h->plt.refcount > 0 && (h->root.type == bfd_link_hash_defined || h->root.type == bfd_link_hash_defweak) @@ -2011,10 +2014,12 @@ allocate_plt_static (h, inf) struct elf32_hppa_link_hash_table *htab; asection *s; - if (h->root.type == bfd_link_hash_indirect - || h->root.type == bfd_link_hash_warning) + if (h->root.type == bfd_link_hash_indirect) return true; + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + info = (struct bfd_link_info *) inf; htab = hppa_link_hash_table (info); if (((struct elf32_hppa_link_hash_entry *) h)->pic_call) @@ -2080,10 +2085,12 @@ allocate_dynrelocs (h, inf) struct elf32_hppa_link_hash_entry *eh; struct elf32_hppa_dyn_reloc_entry *p; - if (h->root.type == bfd_link_hash_indirect - || h->root.type == bfd_link_hash_warning) + if (h->root.type == bfd_link_hash_indirect) return true; + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + info = (struct bfd_link_info *) inf; htab = hppa_link_hash_table (info); if (htab->elf.dynamic_sections_created @@ -2213,6 +2220,9 @@ clobber_millicode_symbols (h, info) struct elf_link_hash_entry *h; struct bfd_link_info *info; { + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + if (h->type == STT_PARISC_MILLI && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) { @@ -2231,6 +2241,9 @@ readonly_dynrelocs (h, inf) struct elf32_hppa_link_hash_entry *eh; struct elf32_hppa_dyn_reloc_entry *p; + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + eh = (struct elf32_hppa_link_hash_entry *) h; for (p = eh->dyn_relocs; p != NULL; p = p->next) { diff --git a/bfd/elf32-i370.c b/bfd/elf32-i370.c index aa9cd39..07d5f9d 100644 --- a/bfd/elf32-i370.c +++ b/bfd/elf32-i370.c @@ -1,5 +1,5 @@ /* i370-specific support for 32-bit ELF - Copyright 1994, 1995, 1996, 1997, 1998, 2000, 2001 + Copyright 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. Hacked by Linas Vepstas for i370 linas@linas.org @@ -736,6 +736,9 @@ i370_elf_adjust_dynindx (h, cparg) h->dynindx, *cp); #endif + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + if (h->dynindx != -1) h->dynindx += *cp; diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index 7e6588c..d74f6ee 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -1,5 +1,5 @@ /* Intel 80386/80486-specific support for 32-bit ELF - Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 + Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -847,11 +847,10 @@ elf_i386_check_relocs (abfd, info, sec, relocs) { const char *name; bfd *dynobj; + unsigned int strndx = elf_elfheader (abfd)->e_shstrndx; + unsigned int shnam = elf_section_data (sec)->rel_hdr.sh_name; - name = (bfd_elf_string_from_elf_section - (abfd, - elf_elfheader (abfd)->e_shstrndx, - elf_section_data (sec)->rel_hdr.sh_name)); + name = bfd_elf_string_from_elf_section (abfd, strndx, shnam); if (name == NULL) return false; @@ -1251,10 +1250,15 @@ allocate_dynrelocs (h, inf) struct elf_i386_link_hash_entry *eh; struct elf_i386_dyn_relocs *p; - if (h->root.type == bfd_link_hash_indirect - || h->root.type == bfd_link_hash_warning) + if (h->root.type == bfd_link_hash_indirect) return true; + if (h->root.type == bfd_link_hash_warning) + /* When warning symbols are created, they **replace** the "real" + entry in the hash table, thus we never get to see the real + symbol in a hash traversal. So look at it now. */ + h = (struct elf_link_hash_entry *) h->root.u.i.link; + info = (struct bfd_link_info *) inf; htab = elf_i386_hash_table (info); @@ -1421,6 +1425,9 @@ readonly_dynrelocs (h, inf) struct elf_i386_link_hash_entry *eh; struct elf_i386_dyn_relocs *p; + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + eh = (struct elf_i386_link_hash_entry *) h; for (p = eh->dyn_relocs; p != NULL; p = p->next) { diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c index 1fb6844..19266b0 100644 --- a/bfd/elf32-m68k.c +++ b/bfd/elf32-m68k.c @@ -1,5 +1,5 @@ /* Motorola 68k series support for 32-bit ELF - Copyright 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001 + Copyright 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -1271,6 +1271,9 @@ elf_m68k_discard_copies (h, ignore) { struct elf_m68k_pcrel_relocs_copied *s; + if (h->root.root.type == bfd_link_hash_warning) + h = (struct elf_m68k_link_hash_entry *) h->root.root.u.i.link; + /* We only discard relocs for symbols defined in a regular object. */ if ((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) return true; diff --git a/bfd/elf32-mips.c b/bfd/elf32-mips.c index d52e5d20..65303d6 100644 --- a/bfd/elf32-mips.c +++ b/bfd/elf32-mips.c @@ -4779,6 +4779,9 @@ mips_elf_output_extsym (h, data) boolean strip; asection *sec, *output_section; + if (h->root.root.type == bfd_link_hash_warning) + h = (struct mips_elf_link_hash_entry *) h->root.root.u.i.link; + if (h->root.indx == -2) strip = false; else if (((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0 @@ -6089,6 +6092,9 @@ mips_elf_sort_hash_table_f (h, data) struct mips_elf_hash_sort_data *hsd = (struct mips_elf_hash_sort_data *) data; + if (h->root.root.type == bfd_link_hash_warning) + h = (struct mips_elf_link_hash_entry *) h->root.root.u.i.link; + /* Symbols without dynamic symbol table entries aren't interesting at all. */ if (h->root.dynindx == -1) @@ -8789,6 +8795,9 @@ mips_elf_check_mips16_stubs (h, data) struct mips_elf_link_hash_entry *h; PTR data ATTRIBUTE_UNUSED; { + if (h->root.root.type == bfd_link_hash_warning) + h = (struct mips_elf_link_hash_entry *) h->root.root.u.i.link; + if (h->fn_stub != NULL && ! h->need_fn_stub) { diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c index 1f197b5..1c11269 100644 --- a/bfd/elf32-s390.c +++ b/bfd/elf32-s390.c @@ -1,5 +1,5 @@ /* IBM S/390-specific support for 32-bit ELF - Copyright 2000, 2001 Free Software Foundation, Inc. + Copyright 2000, 2001, 2002 Free Software Foundation, Inc. Contributed by Carl B. Pedersen and Martin Schwidefsky. This file is part of BFD, the Binary File Descriptor library. @@ -1214,10 +1214,12 @@ allocate_dynrelocs (h, inf) struct elf_s390_link_hash_entry *eh; struct elf_s390_dyn_relocs *p; - if (h->root.type == bfd_link_hash_indirect - || h->root.type == bfd_link_hash_warning) + if (h->root.type == bfd_link_hash_indirect) return true; + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + info = (struct bfd_link_info *) inf; htab = elf_s390_hash_table (info); @@ -1384,6 +1386,9 @@ readonly_dynrelocs (h, inf) struct elf_s390_link_hash_entry *eh; struct elf_s390_dyn_relocs *p; + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + eh = (struct elf_s390_link_hash_entry *) h; for (p = eh->dyn_relocs; p != NULL; p = p->next) { diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c index d8d4a6a..74f276b 100644 --- a/bfd/elf32-sh.c +++ b/bfd/elf32-sh.c @@ -3899,8 +3899,8 @@ sh_elf_size_dynamic_sections (output_bfd, info) will not fill them in in the relocate_section routine. */ if (info->shared && info->symbolic) sh_elf_link_hash_traverse (sh_elf_hash_table (info), - sh_elf_discard_copies, - (PTR) NULL); + sh_elf_discard_copies, + (PTR) NULL); /* The check_relocs and adjust_dynamic_symbol entry points have determined the sizes of the various dynamic sections. Allocate @@ -4038,6 +4038,9 @@ sh_elf_discard_copies (h, ignore) { struct elf_sh_pcrel_relocs_copied *s; + if (h->root.root.type == bfd_link_hash_warning) + h = (struct elf_sh_link_hash_entry *) h->root.root.u.i.link; + /* We only discard relocs for symbols defined in a regular object. */ if ((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) return true; diff --git a/bfd/elf32-xstormy16.c b/bfd/elf32-xstormy16.c index bdb0279..484acdd 100644 --- a/bfd/elf32-xstormy16.c +++ b/bfd/elf32-xstormy16.c @@ -500,6 +500,9 @@ xstormy16_relax_plt_check (h, xdata) { struct relax_plt_data *data = (struct relax_plt_data *) xdata; + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + if (h->plt.offset != (bfd_vma) -1) { bfd_vma address; @@ -533,6 +536,9 @@ xstormy16_relax_plt_realloc (h, xdata) { bfd_vma *entry = (bfd_vma *) xdata; + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + if (h->plt.offset != (bfd_vma) -1) { h->plt.offset = *entry; diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c index 2c380d6..8cf68dd 100644 --- a/bfd/elf64-alpha.c +++ b/bfd/elf64-alpha.c @@ -2120,18 +2120,21 @@ elf64_alpha_output_extsym (h, data) boolean strip; asection *sec, *output_section; + if (h->root.root.type == bfd_link_hash_warning) + h = (struct alpha_elf_link_hash_entry *) h->root.root.u.i.link; + if (h->root.indx == -2) strip = false; else if (((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0 - || (h->root.elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) != 0) - && (h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0 - && (h->root.elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0) + || (h->root.elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) != 0) + && (h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0 + && (h->root.elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0) strip = true; else if (einfo->info->strip == strip_all - || (einfo->info->strip == strip_some - && bfd_hash_lookup (einfo->info->keep_hash, - h->root.root.root.string, - false, false) == NULL)) + || (einfo->info->strip == strip_some + && bfd_hash_lookup (einfo->info->keep_hash, + h->root.root.root.string, + false, false) == NULL)) strip = true; else strip = false; @@ -2150,44 +2153,44 @@ elf64_alpha_output_extsym (h, data) h->esym.asym.st = stGlobal; if (h->root.root.type != bfd_link_hash_defined - && h->root.root.type != bfd_link_hash_defweak) - h->esym.asym.sc = scAbs; + && h->root.root.type != bfd_link_hash_defweak) + h->esym.asym.sc = scAbs; else - { - const char *name; - - sec = h->root.root.u.def.section; - output_section = sec->output_section; - - /* When making a shared library and symbol h is the one from - the another shared library, OUTPUT_SECTION may be null. */ - if (output_section == NULL) - h->esym.asym.sc = scUndefined; - else - { - name = bfd_section_name (output_section->owner, output_section); - - if (strcmp (name, ".text") == 0) - h->esym.asym.sc = scText; - else if (strcmp (name, ".data") == 0) - h->esym.asym.sc = scData; - else if (strcmp (name, ".sdata") == 0) - h->esym.asym.sc = scSData; - else if (strcmp (name, ".rodata") == 0 - || strcmp (name, ".rdata") == 0) - h->esym.asym.sc = scRData; - else if (strcmp (name, ".bss") == 0) - h->esym.asym.sc = scBss; - else if (strcmp (name, ".sbss") == 0) - h->esym.asym.sc = scSBss; - else if (strcmp (name, ".init") == 0) - h->esym.asym.sc = scInit; - else if (strcmp (name, ".fini") == 0) - h->esym.asym.sc = scFini; - else - h->esym.asym.sc = scAbs; - } - } + { + const char *name; + + sec = h->root.root.u.def.section; + output_section = sec->output_section; + + /* When making a shared library and symbol h is the one from + the another shared library, OUTPUT_SECTION may be null. */ + if (output_section == NULL) + h->esym.asym.sc = scUndefined; + else + { + name = bfd_section_name (output_section->owner, output_section); + + if (strcmp (name, ".text") == 0) + h->esym.asym.sc = scText; + else if (strcmp (name, ".data") == 0) + h->esym.asym.sc = scData; + else if (strcmp (name, ".sdata") == 0) + h->esym.asym.sc = scSData; + else if (strcmp (name, ".rodata") == 0 + || strcmp (name, ".rdata") == 0) + h->esym.asym.sc = scRData; + else if (strcmp (name, ".bss") == 0) + h->esym.asym.sc = scBss; + else if (strcmp (name, ".sbss") == 0) + h->esym.asym.sc = scSBss; + else if (strcmp (name, ".init") == 0) + h->esym.asym.sc = scInit; + else if (strcmp (name, ".fini") == 0) + h->esym.asym.sc = scFini; + else + h->esym.asym.sc = scAbs; + } + } h->esym.asym.reserved = 0; h->esym.asym.index = indexNil; @@ -2199,18 +2202,18 @@ elf64_alpha_output_extsym (h, data) || h->root.root.type == bfd_link_hash_defweak) { if (h->esym.asym.sc == scCommon) - h->esym.asym.sc = scBss; + h->esym.asym.sc = scBss; else if (h->esym.asym.sc == scSCommon) - h->esym.asym.sc = scSBss; + h->esym.asym.sc = scSBss; sec = h->root.root.u.def.section; output_section = sec->output_section; if (output_section != NULL) - h->esym.asym.value = (h->root.root.u.def.value - + sec->output_offset - + output_section->vma); + h->esym.asym.value = (h->root.root.u.def.value + + sec->output_offset + + output_section->vma); else - h->esym.asym.value = 0; + h->esym.asym.value = 0; } else if ((h->root.elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0) { @@ -2232,8 +2235,8 @@ elf64_alpha_output_extsym (h, data) } if (! bfd_ecoff_debug_one_external (einfo->abfd, einfo->debug, einfo->swap, - h->root.root.root.string, - &h->esym)) + h->root.root.root.string, + &h->esym)) { einfo->failed = true; return false; @@ -2861,6 +2864,9 @@ elf64_alpha_calc_got_offsets_for_symbol (h, arg) { struct alpha_elf_got_entry *gotent; + if (h->root.root.type == bfd_link_hash_warning) + h = (struct alpha_elf_link_hash_entry *) h->root.root.u.i.link; + for (gotent = h->got_entries; gotent; gotent = gotent->next) if (gotent->use_count > 0) { @@ -3038,6 +3044,9 @@ elf64_alpha_calc_dynrel_sizes (h, info) struct alpha_elf_link_hash_entry *h; struct bfd_link_info *info; { + if (h->root.root.type == bfd_link_hash_warning) + h = (struct alpha_elf_link_hash_entry *) h->root.root.u.i.link; + /* If the symbol was defined as a common symbol in a regular object file, and there was no definition in any dynamic object, then the linker will have allocated space for the symbol in a common diff --git a/bfd/elf64-hppa.c b/bfd/elf64-hppa.c index defd72d..c6ea4f4 100644 --- a/bfd/elf64-hppa.c +++ b/bfd/elf64-hppa.c @@ -1,5 +1,5 @@ /* Support for HPPA 64-bit ELF - Copyright 1999, 2000, 2001 Free Software Foundation, Inc. + Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -1023,6 +1023,9 @@ elf64_hppa_mark_exported_functions (h, data) hppa_info = elf64_hppa_hash_table (info); + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + if (h && (h->root.type == bfd_link_hash_defined || h->root.type == bfd_link_hash_defweak) diff --git a/bfd/elf64-mips.c b/bfd/elf64-mips.c index 084e08a..c355b0d 100644 --- a/bfd/elf64-mips.c +++ b/bfd/elf64-mips.c @@ -3052,6 +3052,9 @@ mips_elf64_sort_hash_table_f (h, data) struct mips_elf64_hash_sort_data *hsd = (struct mips_elf64_hash_sort_data *) data; + if (h->root.root.type == bfd_link_hash_warning) + h = (struct mips_elf64_link_hash_entry *) h->root.root.u.i.link; + /* Symbols without dynamic symbol table entries aren't interesting at all. */ if (h->root.dynindx == -1) @@ -3090,9 +3093,9 @@ mips_elf64_sort_hash_table (info, max_local) hsd.min_got_dynindx = elf_hash_table (info)->dynsymcount; hsd.max_non_got_dynindx = max_local; mips_elf64_link_hash_traverse (((struct mips_elf64_link_hash_table *) - elf_hash_table (info)), - mips_elf64_sort_hash_table_f, - &hsd); + elf_hash_table (info)), + mips_elf64_sort_hash_table_f, + &hsd); /* There shoud have been enough room in the symbol table to accomodate both the GOT and non-GOT symbols. */ @@ -4685,6 +4688,9 @@ mips_elf64_check_mips16_stubs (h, data) struct mips_elf64_link_hash_entry *h; PTR data ATTRIBUTE_UNUSED; { + if (h->root.root.type == bfd_link_hash_warning) + h = (struct mips_elf64_link_hash_entry *) h->root.root.u.i.link; + if (h->fn_stub != NULL && ! h->need_fn_stub) { @@ -6129,6 +6135,9 @@ mips_elf64_output_extsym (h, data) boolean strip; asection *sec, *output_section; + if (h->root.root.type == bfd_link_hash_warning) + h = (struct mips_elf64_link_hash_entry *) h->root.root.u.i.link; + if (h->root.indx == -2) strip = false; else if (((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0 @@ -6619,8 +6628,8 @@ mips_elf64_final_link (abfd, info) einfo.swap = swap; einfo.failed = false; mips_elf64_link_hash_traverse (mips_elf64_hash_table (info), - mips_elf64_output_extsym, - (PTR) &einfo); + mips_elf64_output_extsym, + (PTR) &einfo); if (einfo.failed) return false; diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index 2e5933a..6adc202 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -2501,10 +2501,12 @@ func_desc_adjust (h, inf) struct bfd_link_info *info; struct ppc_link_hash_table *htab; - if (h->root.type == bfd_link_hash_indirect - || h->root.type == bfd_link_hash_warning) + if (h->root.type == bfd_link_hash_indirect) return true; + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + info = (struct bfd_link_info *) inf; htab = ppc_hash_table (info); @@ -2875,10 +2877,12 @@ allocate_dynrelocs (h, inf) struct ppc_link_hash_entry *eh; struct ppc_dyn_relocs *p; - if (h->root.type == bfd_link_hash_indirect - || h->root.type == bfd_link_hash_warning) + if (h->root.type == bfd_link_hash_indirect) return true; + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + info = (struct bfd_link_info *) inf; htab = ppc_hash_table (info); @@ -3034,6 +3038,9 @@ readonly_dynrelocs (h, inf) struct ppc_link_hash_entry *eh; struct ppc_dyn_relocs *p; + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + eh = (struct ppc_link_hash_entry *) h; for (p = eh->dyn_relocs; p != NULL; p = p->next) { diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c index 5be7928..23c1bfa 100644 --- a/bfd/elf64-s390.c +++ b/bfd/elf64-s390.c @@ -1,5 +1,5 @@ /* IBM S/390-specific support for 64-bit ELF - Copyright 2000, 2001 Free Software Foundation, Inc. + Copyright 2000, 2001, 2002 Free Software Foundation, Inc. Contributed Martin Schwidefsky (schwidefsky@de.ibm.com). This file is part of BFD, the Binary File Descriptor library. @@ -1169,10 +1169,12 @@ allocate_dynrelocs (h, inf) struct elf_s390_link_hash_entry *eh; struct elf_s390_dyn_relocs *p; - if (h->root.type == bfd_link_hash_indirect - || h->root.type == bfd_link_hash_warning) + if (h->root.type == bfd_link_hash_indirect) return true; + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + info = (struct bfd_link_info *) inf; htab = elf_s390_hash_table (info); @@ -1339,6 +1341,9 @@ readonly_dynrelocs (h, inf) struct elf_s390_link_hash_entry *eh; struct elf_s390_dyn_relocs *p; + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + eh = (struct elf_s390_link_hash_entry *) h; for (p = eh->dyn_relocs; p != NULL; p = p->next) { diff --git a/bfd/elf64-sh64.c b/bfd/elf64-sh64.c index 5b11aa8..dee4a44 100644 --- a/bfd/elf64-sh64.c +++ b/bfd/elf64-sh64.c @@ -3607,6 +3607,9 @@ sh64_elf64_discard_copies (h, ignore) { struct elf_sh64_pcrel_relocs_copied *s; + if (h->root.root.type == bfd_link_hash_warning) + h = (struct elf_sh64_link_hash_entry *) h->root.root.u.i.link; + /* We only discard relocs for symbols defined in a regular object. */ if ((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) return true; diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index f2d2e64..a82b99c 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -1075,10 +1075,12 @@ allocate_dynrelocs (h, inf) struct elf64_x86_64_link_hash_entry *eh; struct elf64_x86_64_dyn_relocs *p; - if (h->root.type == bfd_link_hash_indirect - || h->root.type == bfd_link_hash_warning) + if (h->root.type == bfd_link_hash_indirect) return true; + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + info = (struct bfd_link_info *) inf; htab = elf64_x86_64_hash_table (info); @@ -1245,6 +1247,9 @@ readonly_dynrelocs (h, inf) struct elf64_x86_64_link_hash_entry *eh; struct elf64_x86_64_dyn_relocs *p; + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + eh = (struct elf64_x86_64_link_hash_entry *) h; for (p = eh->dyn_relocs; p != NULL; p = p->next) { diff --git a/bfd/elflink.c b/bfd/elflink.c index 2032efa..e74fae9 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -1,5 +1,5 @@ /* ELF linking support for BFD. - Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001 + Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -330,6 +330,9 @@ elf_link_renumber_hash_table_dynsyms (h, data) { size_t *count = (size_t *) data; + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + if (h->dynindx != -1) h->dynindx = ++(*count); diff --git a/bfd/elflink.h b/bfd/elflink.h index 43abe17..d43d861 100644 --- a/bfd/elflink.h +++ b/bfd/elflink.h @@ -57,8 +57,6 @@ static boolean elf_adjust_dynamic_symbol PARAMS ((struct elf_link_hash_entry *, PTR)); static boolean elf_link_find_version_dependencies PARAMS ((struct elf_link_hash_entry *, PTR)); -static boolean elf_link_find_version_dependencies - PARAMS ((struct elf_link_hash_entry *, PTR)); static boolean elf_link_assign_sym_version PARAMS ((struct elf_link_hash_entry *, PTR)); static boolean elf_collect_hash_codes @@ -3687,6 +3685,9 @@ elf_adjust_dynstr_offsets (h, data) { struct elf_strtab_hash *dynstr = (struct elf_strtab_hash *) data; + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + if (h->dynindx != -1) h->dynstr_index = _bfd_elf_strtab_offset (dynstr, h->dynstr_index); return true; @@ -3966,6 +3967,17 @@ elf_adjust_dynamic_symbol (h, data) bfd *dynobj; struct elf_backend_data *bed; + if (h->root.type == bfd_link_hash_warning) + { + h->plt.offset = (bfd_vma) -1; + h->got.offset = (bfd_vma) -1; + + /* When warning symbols are created, they **replace** the "real" + entry in the hash table, thus we never get to see the real + symbol in a hash traversal. So look at it now. */ + h = (struct elf_link_hash_entry *) h->root.u.i.link; + } + /* Ignore indirect symbols. These are added by the versioning code. */ if (h->root.type == bfd_link_hash_indirect) return true; @@ -4082,6 +4094,9 @@ elf_export_symbol (h, data) if (h->root.type == bfd_link_hash_indirect) return true; + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + if (h->dynindx == -1 && (h->elf_link_hash_flags & (ELF_LINK_HASH_DEF_REGULAR | ELF_LINK_HASH_REF_REGULAR)) != 0) @@ -4139,6 +4154,9 @@ elf_link_find_version_dependencies (h, data) Elf_Internal_Vernaux *a; bfd_size_type amt; + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + /* We only care about symbols defined in shared objects with version information. */ if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0 @@ -4219,6 +4237,9 @@ elf_link_assign_sym_version (h, data) sinfo = (struct elf_assign_sym_version_info *) data; info = sinfo->info; + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + /* Fix the symbol flags. */ eif.failed = false; eif.info = info; @@ -5929,6 +5950,9 @@ elf_link_sec_merge_syms (h, data) { asection *sec; + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + if ((h->root.type == bfd_link_hash_defined || h->root.type == bfd_link_hash_defweak) && ((sec = h->root.u.def.section)->flags & SEC_MERGE) @@ -5964,6 +5988,13 @@ elf_link_output_extsym (h, data) Elf_Internal_Sym sym; asection *input_sec; + if (h->root.type == bfd_link_hash_warning) + { + h = (struct elf_link_hash_entry *) h->root.u.i.link; + if (h->root.type == bfd_link_hash_new) + return true; + } + /* Decide whether to output this symbol in this pass. */ if (eoinfo->localsyms) { @@ -6041,6 +6072,7 @@ elf_link_output_extsym (h, data) { default: case bfd_link_hash_new: + case bfd_link_hash_warning: abort (); return false; @@ -6101,16 +6133,6 @@ elf_link_output_extsym (h, data) foo which points to foo@@GNU_1.2. We ignore these symbols, since the indirected symbol is already in the hash table. */ return true; - - case bfd_link_hash_warning: - /* We can't represent these symbols in ELF, although a warning - symbol may have come from a .gnu.warning.SYMBOL section. We - just put the target symbol in the hash table. If the target - symbol does not really exist, don't do anything. */ - if (h->root.u.i.link->type == bfd_link_hash_new) - return true; - return (elf_link_output_extsym - ((struct elf_link_hash_entry *) h->root.u.i.link, data)); } /* Give the processor backend a chance to tweak the symbol value, @@ -7677,6 +7699,9 @@ elf_gc_sweep_symbol (h, idxptr) { int *idx = (int *) idxptr; + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + if (h->dynindx != -1 && ((h->root.type != bfd_link_hash_defined && h->root.type != bfd_link_hash_defweak) @@ -7694,6 +7719,9 @@ elf_gc_propagate_vtable_entries_used (h, okp) struct elf_link_hash_entry *h; PTR okp; { + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + /* Those that are not vtables. */ if (h->vtable_parent == NULL) return true; @@ -7756,6 +7784,9 @@ elf_gc_smash_unused_vtentry_relocs (h, okp) struct elf_backend_data *bed; int file_align; + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + /* Take care of both those symbols that do not describe vtables as well as those that are not loaded. */ if (h->vtable_parent == NULL) @@ -8043,6 +8074,9 @@ elf_gc_allocate_got_offsets (h, offarg) { bfd_vma *off = (bfd_vma *) offarg; + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + if (h->got.refcount > 0) { h->got.offset = off[0]; @@ -8083,6 +8117,9 @@ elf_collect_hash_codes (h, data) unsigned long ha; char *alc = NULL; + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + /* Ignore indirect symbols. These are added by the versioning code. */ if (h->dynindx == -1) return true; diff --git a/bfd/elfxx-ia64.c b/bfd/elfxx-ia64.c index 8d71def..aadb963 100644 --- a/bfd/elfxx-ia64.c +++ b/bfd/elfxx-ia64.c @@ -1710,6 +1710,9 @@ elfNN_ia64_global_dyn_sym_thunk (xentry, xdata) = (struct elfNN_ia64_dyn_sym_traverse_data *) xdata; struct elfNN_ia64_dyn_sym_info *dyn_i; + if (entry->root.root.type == bfd_link_hash_warning) + entry = (struct elfNN_ia64_link_hash_entry *) entry->root.root.u.i.link; + for (dyn_i = entry->info; dyn_i; dyn_i = dyn_i->next) if (! (*data->func) (dyn_i, data->data)) return false; diff --git a/bfd/i386linux.c b/bfd/i386linux.c index bb93650..755b456 100644 --- a/bfd/i386linux.c +++ b/bfd/i386linux.c @@ -1,5 +1,5 @@ /* BFD back-end for linux flavored i386 a.out binaries. - Copyright 1992, 1993, 1994, 1995, 1996, 1997, 2001 + Copyright 1992, 1993, 1994, 1995, 1996, 1997, 2001, 2002 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -438,6 +438,9 @@ linux_tally_symbols (h, data) struct linux_link_hash_entry *h1, *h2; boolean exists; + if (h->root.root.type == bfd_link_hash_warning) + h = (struct linux_link_hash_entry *) h->root.root.u.i.link; + if (h->root.root.type == bfd_link_hash_undefined && strncmp (h->root.root.root.string, NEEDS_SHRLIB, sizeof NEEDS_SHRLIB - 1) == 0) diff --git a/bfd/linker.c b/bfd/linker.c index 727be33..aa61f76 100644 --- a/bfd/linker.c +++ b/bfd/linker.c @@ -1419,7 +1419,7 @@ static const enum link_action link_action[8][8] = /* DEFW_ROW */ {DEFW, DEFW, DEFW, NOACT, NOACT, NOACT, NOACT, CYCLE }, /* COMMON_ROW */ {COM, COM, COM, CREF, COM, BIG, REFC, WARNC }, /* INDR_ROW */ {IND, IND, IND, MDEF, IND, CIND, MIND, CYCLE }, - /* WARN_ROW */ {MWARN, WARN, WARN, CWARN, CWARN, WARN, CWARN, MWARN }, + /* WARN_ROW */ {MWARN, WARN, WARN, CWARN, CWARN, WARN, CWARN, NOACT }, /* SET_ROW */ {SET, SET, SET, SET, SET, SET, CYCLE, CYCLE } }; @@ -2456,6 +2456,9 @@ _bfd_generic_link_write_global_symbol (h, data) (struct generic_write_global_symbol_info *) data; asymbol *sym; + if (h->root.type == bfd_link_hash_warning) + h = (struct generic_link_hash_entry *) h->root.u.i.link; + if (h->written) return true; diff --git a/bfd/m68klinux.c b/bfd/m68klinux.c index 931282c..9ce7d0a 100644 --- a/bfd/m68klinux.c +++ b/bfd/m68klinux.c @@ -1,5 +1,5 @@ /* BFD back-end for linux flavored m68k a.out binaries. - Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001 + Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -442,6 +442,9 @@ linux_tally_symbols (h, data) struct linux_link_hash_entry *h1, *h2; boolean exists; + if (h->root.root.type == bfd_link_hash_warning) + h = (struct linux_link_hash_entry *) h->root.root.u.i.link; + if (h->root.root.type == bfd_link_hash_undefined && strncmp (h->root.root.root.string, NEEDS_SHRLIB, sizeof NEEDS_SHRLIB - 1) == 0) diff --git a/bfd/pdp11.c b/bfd/pdp11.c index 2c08497..d4fe79e 100644 --- a/bfd/pdp11.c +++ b/bfd/pdp11.c @@ -1,5 +1,5 @@ /* BFD back-end for PDP-11 a.out binaries. - Copyright 2001 Free Software Foundation, Inc. + Copyright 2001, 2002 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -4305,6 +4305,13 @@ aout_link_write_other_symbol (h, data) bfd_size_type indx; bfd_size_type amt; + if (h->root.type == bfd_link_hash_warning) + { + h = (struct aout_link_hash_entry *) h->root.u.i.link; + if (h->root.type == bfd_link_hash_new) + return true; + } + output_bfd = finfo->output_bfd; if (aout_backend_info (output_bfd)->write_dynamic_symbol != NULL) diff --git a/bfd/sparclinux.c b/bfd/sparclinux.c index 28ff8c8..a8b4792 100644 --- a/bfd/sparclinux.c +++ b/bfd/sparclinux.c @@ -1,5 +1,5 @@ /* BFD back-end for linux flavored sparc a.out binaries. - Copyright 1992, 1993, 1994, 1995, 1996, 1997, 2000, 2001 + Copyright 1992, 1993, 1994, 1995, 1996, 1997, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -439,6 +439,9 @@ linux_tally_symbols (h, data) struct linux_link_hash_entry *h1, *h2; boolean exists; + if (h->root.root.type == bfd_link_hash_warning) + h = (struct linux_link_hash_entry *) h->root.root.u.i.link; + if (h->root.root.type == bfd_link_hash_undefined && strncmp (h->root.root.root.string, NEEDS_SHRLIB, sizeof NEEDS_SHRLIB - 1) == 0) diff --git a/bfd/sunos.c b/bfd/sunos.c index 30fd019..cb23fe1 100644 --- a/bfd/sunos.c +++ b/bfd/sunos.c @@ -2052,6 +2052,9 @@ sunos_scan_dynamic_symbol (h, data) { struct bfd_link_info *info = (struct bfd_link_info *) data; + if (h->root.root.type == bfd_link_hash_warning) + h = (struct sunos_link_hash_entry *) h->root.root.u.i.link; + /* Set the written flag for symbols we do not want to write out as part of the regular symbol table. This is all symbols which are not defined in a regular object file. For some reason symbols diff --git a/bfd/xcofflink.c b/bfd/xcofflink.c index c122aef..aff6293 100644 --- a/bfd/xcofflink.c +++ b/bfd/xcofflink.c @@ -3253,6 +3253,9 @@ xcoff_build_ldsyms (h, p) struct xcoff_loader_info *ldinfo = (struct xcoff_loader_info *) p; bfd_size_type amt; + if (h->root.type == bfd_link_hash_warning) + h = (struct xcoff_link_hash_entry *) h->root.u.i.link; + /* __rtinit, this symbol has special handling. */ if (h->flags & XCOFF_RTINIT) return true; @@ -5374,6 +5377,13 @@ xcoff_write_global_symbol (h, inf) output_bfd = finfo->output_bfd; outsym = finfo->outsyms; + if (h->root.type == bfd_link_hash_warning) + { + h = (struct xcoff_link_hash_entry *) h->root.u.i.link; + if (h->root.type == bfd_link_hash_new) + return true; + } + /* If this symbol was garbage collected, just skip it. */ if (xcoff_hash_table (finfo->info)->gc && (h->flags & XCOFF_MARK) == 0) |