aboutsummaryrefslogtreecommitdiff
path: root/bfd/elflink.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2011-06-13 00:59:15 +0000
committerAlan Modra <amodra@gmail.com>2011-06-13 00:59:15 +0000
commit7686d77de353217f4a1d50e07ccb5aecd2579e67 (patch)
treea3911c32c699f2b4b293e298b420cd713573d68b /bfd/elflink.c
parent49d4323bfbccf9527a43b4a6214f2cad27176aa1 (diff)
downloadgdb-7686d77de353217f4a1d50e07ccb5aecd2579e67.zip
gdb-7686d77de353217f4a1d50e07ccb5aecd2579e67.tar.gz
gdb-7686d77de353217f4a1d50e07ccb5aecd2579e67.tar.bz2
* linker.c (bfd_link_hash_traverse): Follow warning symbol link.
(_bfd_generic_link_write_global_symbol, fix_syms): Don't handle warning symbols here. * elf-m10300.c (elf32_mn10300_finish_hash_table_entry): Likewise. * elf32-arm.c (allocate_dynrelocs_for_symbol, elf32_arm_readonly_dynrelocs): Likewise. * elf32-bfin.c (bfin_discard_copies): Likewise. * elf32-cris.c (elf_cris_adjust_gotplt_to_got, elf_cris_discard_excess_dso_dynamics, elf_cris_discard_excess_program_dynamics): Likewise. * elf32-hppa.c (allocate_plt_static, allocate_dynrelocs, clobber_millicode_symbols, readonly_dynrelocs): Likewise. * elf32-i370.c (i370_elf_adjust_dynindx): Likewise. * elf32-i386.c (elf_i386_allocate_dynrelocs, elf_i386_readonly_dynrelocs): Likewise. * elf32-lm32.c (allocate_dynrelocs, readonly_dynrelocs): Likewise. * elf32-m32c.c (m32c_relax_plt_check, m32c_relax_plt_realloc): Likewise. * elf32-m32r.c (allocate_dynrelocs, readonly_dynrelocs): Likewise. * elf32-m68k.c (elf_m68k_discard_copies): Likewise. * elf32-microblaze.c (allocate_dynrelocs): Likewise. * elf32-ppc.c (allocate_dynrelocs, maybe_set_textrel): Likewise. * elf32-s390.c (allocate_dynrelocs, readonly_dynrelocs): Likewise. * elf32-score.c (score_elf_sort_hash_table_f): Likewise. * elf32-score7.c (score_elf_sort_hash_table_f): Likewise. * elf32-sh.c (allocate_dynrelocs, readonly_dynrelocs): Likewise. * elf32-tic6x.c (elf32_tic6x_allocate_dynrelocs, elf32_tic6x_readonly_dynrelocs): Likewise. * elf32-vax.c (elf_vax_discard_copies): Likewise. * elf32-xstormy16.c (xstormy16_relax_plt_check, xstormy16_relax_plt_realloc): Likewise. * elf32-xtensa.c (elf_xtensa_allocate_dynrelocs): Likewise. * elf64-alpha.c (elf64_alpha_output_extsym, elf64_alpha_calc_got_offsets_for_symbol, elf64_alpha_calc_dynrel_sizes, elf64_alpha_size_rela_got_1): Likewise. * elf64-hppa.c (elf64_hppa_mark_exported_functions, allocate_global_data_opd, elf64_hppa_mark_milli_and_exported_functions, elf_hppa_unmark_useless_dynamic_symbols, elf_hppa_remark_useless_dynamic_symbols): Likewise. * elf64-ppc.c (ppc64_elf_gc_mark_dynamic_ref, func_desc_adjust, adjust_opd_syms, adjust_toc_syms, allocate_dynrelocs, readonly_dynrelocs, merge_global_got, reallocate_got, undo_symbol_twiddle): Likewise. * elf64-s390.c (allocate_dynrelocs, readonly_dynrelocs): Likewise. * elf64-sh64.c (sh64_elf64_discard_copies): Likewise. * elf64-x86-64.c (elf_x86_64_allocate_dynrelocs, elf_x86_64_readonly_dynrelocs): Likewise. * elflink.c (elf_link_renumber_hash_table_dynsyms, elf_link_renumber_local_hash_table_dynsyms, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms, elf_adjust_dynstr_offsets, elf_collect_hash_codes, elf_collect_gnu_hash_codes, elf_renumber_gnu_hash_syms, elf_gc_sweep_symbol, elf_gc_propagate_vtable_entries_used, elf_gc_smash_unused_vtentry_relocs, bfd_elf_gc_mark_dynamic_ref_symbol, elf_gc_allocate_got_offsets): Likewise. * elfnn-ia64.c (elfNN_ia64_global_dyn_info_free, elfNN_ia64_global_dyn_sym_thunk): Likewise. * elfxx-mips.c (mips_elf_check_symbols, mips_elf_output_extsym, mips_elf_sort_hash_table_f, allocate_dynrelocs): Likewise. * elfxx-sparc.c (allocate_dynrelocs, readonly_dynrelocs): Likewise. * i386linux.c (linux_tally_symbols): Likewise. * m68klinux.c (linux_tally_symbols): Likewise. * sparclinux.c (linux_tally_symbols): Likewise. * sunos.c (sunos_scan_dynamic_symbol): Likewise. * xcofflink.c (xcoff_post_gc_symbol): Likewise. * elflink.c (elf_link_output_extsym): Make it a bfd_hash_traverse function. Update all callers. * aoutx.h (aout_link_write_other_symbol): Likewise. * pdp11.c (aout_link_write_other_symbol): Likewise. * cofflink.c (_bfd_coff_write_global_sym): Likewise. * ecoff.c (ecoff_link_write_external): Likewise. * xcofflink.c (xcoff_write_global_symbol): Likewise. * vms-alpha.c (alpha_vms_link_output_symbol): Likewise. Handle warning symbols. * ecoff.c (ecoff_link_hash_traverse): Delete. * coff-ppc.c (ppc_bfd_coff_final_link): Use bfd_hash_traverse for _bfd_coff_write_global_sym. * libcoff-in.h (_bfd_coff_write_global_sym): Update prototype. * libcoff.h: Regenerate.
Diffstat (limited to 'bfd/elflink.c')
-rw-r--r--bfd/elflink.c71
1 files changed, 7 insertions, 64 deletions
diff --git a/bfd/elflink.c b/bfd/elflink.c
index ef7a524..9d2d68a 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -722,9 +722,6 @@ elf_link_renumber_hash_table_dynsyms (struct elf_link_hash_entry *h,
{
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->forced_local)
return TRUE;
@@ -744,9 +741,6 @@ elf_link_renumber_local_hash_table_dynsyms (struct elf_link_hash_entry *h,
{
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->forced_local)
return TRUE;
@@ -1812,16 +1806,13 @@ _bfd_elf_export_symbol (struct elf_link_hash_entry *h, void *data)
{
struct elf_info_failed *eif = (struct elf_info_failed *) data;
- /* Ignore this if we won't export it. */
- if (!eif->info->export_dynamic && !h->dynamic)
- return TRUE;
-
/* Ignore indirect symbols. These are added by the versioning code. */
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;
+ /* Ignore this if we won't export it. */
+ if (!eif->info->export_dynamic && !h->dynamic)
+ return TRUE;
if (h->dynindx == -1
&& (h->def_regular
@@ -1858,9 +1849,6 @@ _bfd_elf_link_find_version_dependencies (struct elf_link_hash_entry *h,
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->def_dynamic
@@ -1946,9 +1934,6 @@ _bfd_elf_link_assign_sym_version (struct elf_link_hash_entry *h, void *data)
sinfo = (struct elf_info_failed *) 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;
@@ -2564,17 +2549,6 @@ _bfd_elf_adjust_dynamic_symbol (struct elf_link_hash_entry *h, void *data)
if (! is_elf_hash_table (eif->info->hash))
return FALSE;
- if (h->root.type == bfd_link_hash_warning)
- {
- h->got = elf_hash_table (eif->info)->init_got_offset;
- h->plt = elf_hash_table (eif->info)->init_plt_offset;
-
- /* 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;
@@ -2730,9 +2704,6 @@ _bfd_elf_link_sec_merge_syms (struct elf_link_hash_entry *h, void *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)
@@ -3180,9 +3151,6 @@ elf_adjust_dynstr_offsets (struct elf_link_hash_entry *h, void *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;
@@ -5175,9 +5143,6 @@ elf_collect_hash_codes (struct elf_link_hash_entry *h, void *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;
@@ -5246,9 +5211,6 @@ elf_collect_gnu_hash_codes (struct elf_link_hash_entry *h, void *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;
@@ -5299,9 +5261,6 @@ elf_renumber_gnu_hash_syms (struct elf_link_hash_entry *h, void *data)
unsigned long int bucket;
unsigned long int val;
- if (h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
/* Ignore indirect symbols. */
if (h->dynindx == -1)
return TRUE;
@@ -8605,8 +8564,9 @@ elf_link_check_versioned_symbol (struct bfd_link_info *info,
global symbols. */
static bfd_boolean
-elf_link_output_extsym (struct elf_link_hash_entry *h, void *data)
+elf_link_output_extsym (struct bfd_hash_entry *bh, void *data)
{
+ struct elf_link_hash_entry *h = (struct elf_link_hash_entry *) bh;
struct elf_outext_info *eoinfo = (struct elf_outext_info *) data;
struct elf_final_link_info *finfo = eoinfo->finfo;
bfd_boolean strip;
@@ -10822,8 +10782,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
eoinfo.failed = FALSE;
eoinfo.finfo = &finfo;
eoinfo.localsyms = TRUE;
- elf_link_hash_traverse (elf_hash_table (info), elf_link_output_extsym,
- &eoinfo);
+ bfd_hash_traverse (&info->hash->table, elf_link_output_extsym, &eoinfo);
if (eoinfo.failed)
return FALSE;
@@ -10932,8 +10891,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
eoinfo.failed = FALSE;
eoinfo.localsyms = FALSE;
eoinfo.finfo = &finfo;
- elf_link_hash_traverse (elf_hash_table (info), elf_link_output_extsym,
- &eoinfo);
+ bfd_hash_traverse (&info->hash->table, elf_link_output_extsym, &eoinfo);
if (eoinfo.failed)
return FALSE;
@@ -11687,9 +11645,6 @@ struct elf_gc_sweep_symbol_info
static bfd_boolean
elf_gc_sweep_symbol (struct elf_link_hash_entry *h, void *data)
{
- 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)
&& !h->root.u.def.section->gc_mark
@@ -11801,9 +11756,6 @@ elf_gc_sweep (bfd *abfd, struct bfd_link_info *info)
static bfd_boolean
elf_gc_propagate_vtable_entries_used (struct elf_link_hash_entry *h, void *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 == NULL || h->vtable->parent == NULL)
return TRUE;
@@ -11865,9 +11817,6 @@ elf_gc_smash_unused_vtentry_relocs (struct elf_link_hash_entry *h, void *okp)
const struct elf_backend_data *bed;
unsigned int log_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 == NULL || h->vtable->parent == NULL)
@@ -11915,9 +11864,6 @@ bfd_elf_gc_mark_dynamic_ref_symbol (struct elf_link_hash_entry *h, void *inf)
{
struct bfd_link_info *info = (struct bfd_link_info *) inf;
- 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)
&& (h->ref_dynamic
@@ -12190,9 +12136,6 @@ elf_gc_allocate_got_offsets (struct elf_link_hash_entry *h, void *arg)
bfd *obfd = gofarg->info->output_bfd;
const struct elf_backend_data *bed = get_elf_backend_data (obfd);
- 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 = gofarg->gotoff;