diff options
-rw-r--r-- | bfd/ChangeLog | 18 | ||||
-rw-r--r-- | bfd/elf-bfd.h | 70 | ||||
-rw-r--r-- | bfd/elflink.c | 68 |
3 files changed, 65 insertions, 91 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 3f70af7..3efcb94 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,21 @@ +2009-01-23 Alan Modra <amodra@bigpond.net.au> + + * elf-bfd.h (struct elf_assign_sym_version_info): Delete. + (struct elf_info_failed, struct elf_find_verdep_info): Move to.. + * elflink.c: ..here, somewhat modified. + * elf-bfd.h (_bfd_elf_add_default_symbol, _bfd_elf_export_symbol, + _bfd_elf_link_find_version_dependencies, + _bfd_elf_link_assign_sym_version, _bfd_elf_link_size_reloc_section, + _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, + _bfd_elf_link_sec_merge_syms, bfd_elf_link_mark_dynamic_symbol): Don't + declare.. + * elflink.c: ..and make static here. + (_bfd_elf_link_find_version_dependencies): Adjust for removal + of output_bfd from struct elf_find_verdep_info. + (_bfd_elf_link_assign_sym_version): Similarly adjust to use + struct elf_info_failed. + (bfd_elf_size_dynamic_sections): Adjust. + 2009-01-22 Alan Modra <amodra@bigpond.net.au> PR 6832 diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index 35dc018..c1cc63e 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -1334,46 +1334,6 @@ struct bfd_elf_section_data #define get_elf_backend_data(abfd) \ xvec_get_elf_backend_data ((abfd)->xvec) -/* This struct is used to pass information to routines called via - elf_link_hash_traverse which must return failure. */ - -struct elf_info_failed -{ - bfd_boolean failed; - struct bfd_link_info *info; - struct bfd_elf_version_tree *verdefs; -}; - -/* This structure is used to pass information to - _bfd_elf_link_assign_sym_version. */ - -struct elf_assign_sym_version_info -{ - /* Output BFD. */ - bfd *output_bfd; - /* General link information. */ - struct bfd_link_info *info; - /* Version tree. */ - struct bfd_elf_version_tree *verdefs; - /* Whether we had a failure. */ - bfd_boolean failed; -}; - -/* This structure is used to pass information to - _bfd_elf_link_find_version_dependencies. */ - -struct elf_find_verdep_info -{ - /* Output BFD. */ - bfd *output_bfd; - /* General link information. */ - struct bfd_link_info *info; - /* The number of dependencies. */ - unsigned int vers; - /* Whether we had a failure. */ - bfd_boolean failed; -}; - /* The maximum number of known object attributes for any target. */ #define NUM_KNOWN_OBJ_ATTRIBUTES 71 @@ -1887,20 +1847,6 @@ extern bfd_boolean _bfd_elf_merge_symbol extern bfd_boolean _bfd_elf_hash_symbol (struct elf_link_hash_entry *); -extern bfd_boolean _bfd_elf_add_default_symbol - (bfd *, struct bfd_link_info *, struct elf_link_hash_entry *, - const char *, Elf_Internal_Sym *, asection **, bfd_vma *, - bfd_boolean *, bfd_boolean); - -extern bfd_boolean _bfd_elf_export_symbol - (struct elf_link_hash_entry *, void *); - -extern bfd_boolean _bfd_elf_link_find_version_dependencies - (struct elf_link_hash_entry *, void *); - -extern bfd_boolean _bfd_elf_link_assign_sym_version - (struct elf_link_hash_entry *, void *); - extern long _bfd_elf_link_lookup_local_dynindx (struct bfd_link_info *, bfd *, long); extern bfd_boolean _bfd_elf_compute_section_file_positions @@ -1936,25 +1882,13 @@ extern char *_bfd_elfcore_strndup extern Elf_Internal_Rela *_bfd_elf_link_read_relocs (bfd *, asection *, void *, Elf_Internal_Rela *, bfd_boolean); -extern bfd_boolean _bfd_elf_link_size_reloc_section - (bfd *, Elf_Internal_Shdr *, asection *); - extern bfd_boolean _bfd_elf_link_output_relocs (bfd *, asection *, Elf_Internal_Shdr *, Elf_Internal_Rela *, struct elf_link_hash_entry **); -extern bfd_boolean _bfd_elf_fix_symbol_flags - (struct elf_link_hash_entry *, struct elf_info_failed *); - -extern bfd_boolean _bfd_elf_adjust_dynamic_symbol - (struct elf_link_hash_entry *, void *); - extern bfd_boolean _bfd_elf_adjust_dynamic_copy (struct elf_link_hash_entry *, asection *); -extern bfd_boolean _bfd_elf_link_sec_merge_syms - (struct elf_link_hash_entry *, void *); - extern bfd_boolean _bfd_elf_dynamic_symbol_p (struct elf_link_hash_entry *, struct bfd_link_info *, bfd_boolean); @@ -2076,10 +2010,6 @@ extern bfd_boolean bfd_elf_link_record_dynamic_symbol extern int bfd_elf_link_record_local_dynamic_symbol (struct bfd_link_info *, bfd *, long); -extern void bfd_elf_link_mark_dynamic_symbol - (struct bfd_link_info *, struct elf_link_hash_entry *, - Elf_Internal_Sym *); - extern bfd_boolean _bfd_elf_close_and_cleanup (bfd *); 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) |