diff options
Diffstat (limited to 'bfd/elflink.c')
-rw-r--r-- | bfd/elflink.c | 68 |
1 files changed, 47 insertions, 21 deletions
diff --git a/bfd/elflink.c b/bfd/elflink.c index d2cc31a..5bbe820 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -30,6 +30,32 @@ #include "libiberty.h" #include "objalloc.h" +/* This struct is used to pass information to routines called via + elf_link_hash_traverse which must return failure. */ + +struct elf_info_failed +{ + struct bfd_link_info *info; + struct bfd_elf_version_tree *verdefs; + bfd_boolean failed; +}; + +/* This structure is used to pass information to + _bfd_elf_link_find_version_dependencies. */ + +struct elf_find_verdep_info +{ + /* General link information. */ + struct bfd_link_info *info; + /* The number of dependencies. */ + unsigned int vers; + /* Whether we had a failure. */ + bfd_boolean failed; +}; + +static bfd_boolean _bfd_elf_fix_symbol_flags + (struct elf_link_hash_entry *, struct elf_info_failed *); + /* Define a symbol in a dynamic linkage section. */ struct elf_link_hash_entry * @@ -438,7 +464,7 @@ bfd_elf_link_record_dynamic_symbol (struct bfd_link_info *info, /* Mark a symbol dynamic. */ -void +static void bfd_elf_link_mark_dynamic_symbol (struct bfd_link_info *info, struct elf_link_hash_entry *h, Elf_Internal_Sym *sym) @@ -1538,7 +1564,7 @@ _bfd_elf_merge_symbol (bfd *abfd, symbol is described by H, NAME, SYM, PSEC, VALUE, and OVERRIDE. We set DYNSYM if the new indirect symbol is dynamic. */ -bfd_boolean +static bfd_boolean _bfd_elf_add_default_symbol (bfd *abfd, struct bfd_link_info *info, struct elf_link_hash_entry *h, @@ -1775,7 +1801,7 @@ nondefault: /* This routine is used to export all defined symbols into the dynamic symbol table. It is called via elf_link_hash_traverse. */ -bfd_boolean +static bfd_boolean _bfd_elf_export_symbol (struct elf_link_hash_entry *h, void *data) { struct elf_info_failed *eif = data; @@ -1834,7 +1860,7 @@ _bfd_elf_export_symbol (struct elf_link_hash_entry *h, void *data) dependencies. This will be put into the .gnu.version_r section. This function is called via elf_link_hash_traverse. */ -bfd_boolean +static bfd_boolean _bfd_elf_link_find_version_dependencies (struct elf_link_hash_entry *h, void *data) { @@ -1855,7 +1881,9 @@ _bfd_elf_link_find_version_dependencies (struct elf_link_hash_entry *h, return TRUE; /* See if we already know about this version. */ - for (t = elf_tdata (rinfo->output_bfd)->verref; t != NULL; t = t->vn_nextref) + for (t = elf_tdata (rinfo->info->output_bfd)->verref; + t != NULL; + t = t->vn_nextref) { if (t->vn_bfd != h->verinfo.verdef->vd_bfd) continue; @@ -1872,7 +1900,7 @@ _bfd_elf_link_find_version_dependencies (struct elf_link_hash_entry *h, if (t == NULL) { amt = sizeof *t; - t = bfd_zalloc (rinfo->output_bfd, amt); + t = bfd_zalloc (rinfo->info->output_bfd, amt); if (t == NULL) { rinfo->failed = TRUE; @@ -1880,12 +1908,12 @@ _bfd_elf_link_find_version_dependencies (struct elf_link_hash_entry *h, } t->vn_bfd = h->verinfo.verdef->vd_bfd; - t->vn_nextref = elf_tdata (rinfo->output_bfd)->verref; - elf_tdata (rinfo->output_bfd)->verref = t; + t->vn_nextref = elf_tdata (rinfo->info->output_bfd)->verref; + elf_tdata (rinfo->info->output_bfd)->verref = t; } amt = sizeof *a; - a = bfd_zalloc (rinfo->output_bfd, amt); + a = bfd_zalloc (rinfo->info->output_bfd, amt); if (a == NULL) { rinfo->failed = TRUE; @@ -1916,10 +1944,10 @@ _bfd_elf_link_find_version_dependencies (struct elf_link_hash_entry *h, files, so until that point we don't know which symbols should be local. This function is called via elf_link_hash_traverse. */ -bfd_boolean +static bfd_boolean _bfd_elf_link_assign_sym_version (struct elf_link_hash_entry *h, void *data) { - struct elf_assign_sym_version_info *sinfo; + struct elf_info_failed *sinfo; struct bfd_link_info *info; const struct elf_backend_data *bed; struct elf_info_failed eif; @@ -1947,7 +1975,7 @@ _bfd_elf_link_assign_sym_version (struct elf_link_hash_entry *h, void *data) if (!h->def_regular) return TRUE; - bed = get_elf_backend_data (sinfo->output_bfd); + bed = get_elf_backend_data (info->output_bfd); p = strchr (h->root.root.string, ELF_VER_CHR); if (p != NULL && h->verinfo.vertree == NULL) { @@ -2030,7 +2058,7 @@ _bfd_elf_link_assign_sym_version (struct elf_link_hash_entry *h, void *data) return TRUE; amt = sizeof *t; - t = bfd_zalloc (sinfo->output_bfd, amt); + t = bfd_zalloc (info->output_bfd, amt); if (t == NULL) { sinfo->failed = TRUE; @@ -2059,7 +2087,7 @@ _bfd_elf_link_assign_sym_version (struct elf_link_hash_entry *h, void *data) generating a shared archive. Return an error. */ (*_bfd_error_handler) (_("%B: version node not found for symbol %s"), - sinfo->output_bfd, h->root.root.string); + info->output_bfd, h->root.root.string); bfd_set_error (bfd_error_bad_value); sinfo->failed = TRUE; return FALSE; @@ -2323,7 +2351,7 @@ _bfd_elf_link_read_relocs (bfd *abfd, /* Compute the size of, and allocate space for, REL_HDR which is the section header for a section containing relocations for O. */ -bfd_boolean +static bfd_boolean _bfd_elf_link_size_reloc_section (bfd *abfd, Elf_Internal_Shdr *rel_hdr, asection *o) @@ -2462,7 +2490,7 @@ _bfd_elf_link_hash_fixup_symbol (struct bfd_link_info *info, assign_sym_version, which is unnecessary but perhaps more robust in the face of future changes. */ -bfd_boolean +static bfd_boolean _bfd_elf_fix_symbol_flags (struct elf_link_hash_entry *h, struct elf_info_failed *eif) { @@ -2605,7 +2633,7 @@ _bfd_elf_fix_symbol_flags (struct elf_link_hash_entry *h, called via elf_link_hash_traverse, and also calls itself recursively. */ -bfd_boolean +static bfd_boolean _bfd_elf_adjust_dynamic_symbol (struct elf_link_hash_entry *h, void *data) { struct elf_info_failed *eif = data; @@ -2775,7 +2803,7 @@ _bfd_elf_adjust_dynamic_copy (struct elf_link_hash_entry *h, /* Adjust all external symbols pointing into SEC_MERGE sections to reflect the object merging within the sections. */ -bfd_boolean +static bfd_boolean _bfd_elf_link_sec_merge_syms (struct elf_link_hash_entry *h, void *data) { asection *sec; @@ -5448,7 +5476,7 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, bfd_size_type soname_indx; bfd *dynobj; const struct elf_backend_data *bed; - struct elf_assign_sym_version_info asvinfo; + struct elf_info_failed asvinfo; *sinterpptr = NULL; @@ -5659,7 +5687,6 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, } /* Attach all the symbols to their version information. */ - asvinfo.output_bfd = output_bfd; asvinfo.info = info; asvinfo.verdefs = verdefs; asvinfo.failed = FALSE; @@ -6064,7 +6091,6 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, { struct elf_find_verdep_info sinfo; - sinfo.output_bfd = output_bfd; sinfo.info = info; sinfo.vers = elf_tdata (output_bfd)->cverdefs; if (sinfo.vers == 0) |