aboutsummaryrefslogtreecommitdiff
path: root/bfd/elflink.h
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2002-03-28 03:27:46 +0000
committerAlan Modra <amodra@gmail.com>2002-03-28 03:27:46 +0000
commite92d460e59b5271ec44858eecd5b0957eb75ea12 (patch)
treec875ac49157ba6262d0b0aceb8fa6ce6c688f1b4 /bfd/elflink.h
parent48b2f8d70e2630718ebc1a9b563c02aecc4e36ed (diff)
downloadgdb-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.
Diffstat (limited to 'bfd/elflink.h')
-rw-r--r--bfd/elflink.h61
1 files changed, 49 insertions, 12 deletions
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;