From ddb4b64d0264e1e26908deac60f75aecdd0e8eac Mon Sep 17 00:00:00 2001 From: rth Date: Fri, 18 Feb 2000 09:23:06 +0000 Subject: [PATCH] * elf-bfd.h (struct elf_link_hash_table): Remove copy_indirect and hide_symbol members. (elf_link_hash_copy_indirect): Remove. (elf_link_hash_hide_symbol): Remove. (struct elf_backend_data): Add elf_backend_copy_indirect_symbol and elf_backend_hide_symbol. (_bfd_elf_link_hash_copy_indirect): Declare. (_bfd_elf_link_hash_hide_symbol): Declare. * elf.c (_bfd_elf_link_hash_copy_indirect): Remove table argument. (_bfd_elf_link_hash_hide_symbol): Likewise. (_bfd_elf_link_hash_table_init): Don't init killed members. * elflink.h (elf_link_add_object_symbols): Use the bed function pointers not elf_link_hash_{copy_indirect,hide_symbol}. (elf_link_assign_sym_version): Likewise. * elfxx-target.h (elf_backend_copy_indirect_symbol): Default. (elf_backend_hide_symbol): Likewise. (elfNN_bed): Update for new members. --- bfd/ChangeLog | 20 ++++++++++++++++++++ bfd/elf-bfd.h | 30 ++++++++++++++---------------- bfd/elf.c | 12 ++++-------- bfd/elflink.h | 21 +++++++++++---------- bfd/elfxx-target.h | 9 +++++++++ 5 files changed, 58 insertions(+), 34 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 45bf1eaa63..fd6bd809d1 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,23 @@ +2000-02-18 Richard Henderson + + * elf-bfd.h (struct elf_link_hash_table): Remove copy_indirect + and hide_symbol members. + (elf_link_hash_copy_indirect): Remove. + (elf_link_hash_hide_symbol): Remove. + (struct elf_backend_data): Add elf_backend_copy_indirect_symbol + and elf_backend_hide_symbol. + (_bfd_elf_link_hash_copy_indirect): Declare. + (_bfd_elf_link_hash_hide_symbol): Declare. + * elf.c (_bfd_elf_link_hash_copy_indirect): Remove table argument. + (_bfd_elf_link_hash_hide_symbol): Likewise. + (_bfd_elf_link_hash_table_init): Don't init killed members. + * elflink.h (elf_link_add_object_symbols): Use the bed function + pointers not elf_link_hash_{copy_indirect,hide_symbol}. + (elf_link_assign_sym_version): Likewise. + * elfxx-target.h (elf_backend_copy_indirect_symbol): Default. + (elf_backend_hide_symbol): Likewise. + (elfNN_bed): Update for new members. + 2000-02-17 Kevin Buettner * rs6000-core.c (CORE_DATA_SIZE_FIELD, CORE_COMM_FIELD, SAVE_FIELD, diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index 0a438ef3f1..0dcecdf588 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -243,12 +243,6 @@ struct elf_link_hash_table PTR stab_info; /* A linked list of local symbols to be added to .dynsym. */ struct elf_link_local_dynamic_entry *dynlocal; - - void (*copy_indirect) PARAMS ((struct elf_link_hash_table *, - struct elf_link_hash_entry *, - struct elf_link_hash_entry *)); - void (*hide_symbol) PARAMS ((struct elf_link_hash_table *, - struct elf_link_hash_entry *)); }; /* Look up an entry in an ELF linker hash table. */ @@ -269,16 +263,6 @@ struct elf_link_hash_table /* Get the ELF linker hash table from a link_info structure. */ #define elf_hash_table(p) ((struct elf_link_hash_table *) ((p)->hash)) - -/* Call the copy_indirect method. */ - -#define elf_link_hash_copy_indirect(TABLE,DIR,IND) \ - ((*(TABLE)->copy_indirect) ((TABLE), (DIR), (IND))) - -/* Call the hide_symbol method. */ - -#define elf_link_hash_hide_symbol(TABLE,SYM) \ - ((*(TABLE)->hide_symbol) ((TABLE), (SYM))) /* Constant information held for an ELF backend. */ @@ -609,6 +593,16 @@ struct elf_backend_data boolean (*) PARAMS ((PTR, const char *, Elf_Internal_Sym *, asection *)))); + /* Copy any information related to dynamic linking from a pre-existing + symbol IND to a newly created symbol DIR. */ + void (*elf_backend_copy_indirect_symbol) + PARAMS ((struct elf_link_hash_entry *, struct elf_link_hash_entry *)); + + /* Modify any information related to dynamic linking such that the + symbol is not exported. */ + void (*elf_backend_hide_symbol) + PARAMS ((struct elf_link_hash_entry *)); + /* The swapping table to use when dealing with ECOFF information. Used for the MIPS ELF .mdebug section. */ const struct ecoff_debug_swap *elf_backend_ecoff_debug_swap; @@ -973,6 +967,10 @@ extern struct bfd_hash_entry *_bfd_elf_link_hash_newfunc PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); extern struct bfd_link_hash_table *_bfd_elf_link_hash_table_create PARAMS ((bfd *)); +extern void _bfd_elf_link_hash_copy_indirect + PARAMS ((struct elf_link_hash_entry *, struct elf_link_hash_entry *)); +extern void _bfd_elf_link_hash_hide_symbol + PARAMS ((struct elf_link_hash_entry *)); extern boolean _bfd_elf_link_hash_table_init PARAMS ((struct elf_link_hash_table *, bfd *, struct bfd_hash_entry *(*) (struct bfd_hash_entry *, diff --git a/bfd/elf.c b/bfd/elf.c index 654d651710..6a40068460 100644 --- a/bfd/elf.c +++ b/bfd/elf.c @@ -909,9 +909,8 @@ _bfd_elf_link_hash_newfunc (entry, table, string) /* Copy data from an indirect symbol to its direct symbol, hiding the old indirect symbol. */ -static void -_bfd_elf_link_hash_copy_indirect (table, dir, ind) - struct elf_link_hash_table *table; +void +_bfd_elf_link_hash_copy_indirect (dir, ind) struct elf_link_hash_entry *dir, *ind; { /* Copy down any references that we may have already seen to the @@ -950,9 +949,8 @@ _bfd_elf_link_hash_copy_indirect (table, dir, ind) BFD_ASSERT (ind->dynindx == -1); } -static void -_bfd_elf_link_hash_hide_symbol(table, h) - struct elf_link_hash_table *table; +void +_bfd_elf_link_hash_hide_symbol(h) struct elf_link_hash_entry *h; { h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; @@ -979,8 +977,6 @@ _bfd_elf_link_hash_table_init (table, abfd, newfunc) table->needed = NULL; table->hgot = NULL; table->stab_info = NULL; - table->copy_indirect = _bfd_elf_link_hash_copy_indirect; - table->hide_symbol = _bfd_elf_link_hash_hide_symbol; return _bfd_link_hash_table_init (&table->root, abfd, newfunc); } diff --git a/bfd/elflink.h b/bfd/elflink.h index 5bce1356a8..78a5e3413e 100644 --- a/bfd/elflink.h +++ b/bfd/elflink.h @@ -890,9 +890,11 @@ elf_link_add_object_symbols (abfd, info) struct elf_link_hash_entry *weaks; Elf_External_Sym *esym; Elf_External_Sym *esymend; + struct elf_backend_data *bed; - add_symbol_hook = get_elf_backend_data (abfd)->elf_add_symbol_hook; - collect = get_elf_backend_data (abfd)->collect; + bed = get_elf_backend_data (abfd); + add_symbol_hook = bed->elf_add_symbol_hook; + collect = bed->collect; if ((abfd->flags & DYNAMIC) == 0) dynamic = false; @@ -1734,8 +1736,7 @@ elf_link_add_object_symbols (abfd, info) == 0); ht = (struct elf_link_hash_entry *) hi->root.u.i.link; - elf_link_hash_copy_indirect (elf_hash_table (info), - ht, hi); + (*bed->elf_backend_copy_indirect_symbol) (ht, hi); /* See if the new flags lead us to realize that the symbol must be dynamic. */ @@ -1808,8 +1809,7 @@ elf_link_add_object_symbols (abfd, info) | ELF_LINK_HASH_DEF_REGULAR)) == 0); - elf_link_hash_copy_indirect (elf_hash_table (info), - h, hi); + (*bed->elf_backend_copy_indirect_symbol) (h, hi); /* See if the new flags lead us to realize that the symbol must be dynamic. */ @@ -3600,6 +3600,7 @@ elf_link_assign_sym_version (h, data) struct elf_assign_sym_version_info *sinfo = (struct elf_assign_sym_version_info *) data; struct bfd_link_info *info = sinfo->info; + struct elf_backend_data *bed; struct elf_info_failed eif; char *p; @@ -3618,6 +3619,7 @@ elf_link_assign_sym_version (h, data) if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) return true; + bed = get_elf_backend_data (sinfo->output_bfd); p = strchr (h->root.root.string, ELF_VER_CHR); if (p != NULL && h->verinfo.vertree == NULL) { @@ -3685,8 +3687,7 @@ elf_link_assign_sym_version (h, data) && ! sinfo->export_dynamic) { h->elf_link_hash_flags |= ELF_LINK_FORCED_LOCAL; - elf_link_hash_hide_symbol (elf_hash_table (info), - h); + (*bed->elf_backend_hide_symbol) (h); /* FIXME: The name of the symbol has already been recorded in the dynamic string table section. */ @@ -3798,7 +3799,7 @@ elf_link_assign_sym_version (h, data) && ! sinfo->export_dynamic) { h->elf_link_hash_flags |= ELF_LINK_FORCED_LOCAL; - elf_link_hash_hide_symbol (elf_hash_table (info), h); + (*bed->elf_backend_hide_symbol) (h); /* FIXME: The name of the symbol has already been recorded in the dynamic string table section. */ @@ -3820,7 +3821,7 @@ elf_link_assign_sym_version (h, data) && ! sinfo->export_dynamic) { h->elf_link_hash_flags |= ELF_LINK_FORCED_LOCAL; - elf_link_hash_hide_symbol (elf_hash_table (info), h); + (*bed->elf_backend_hide_symbol) (h); /* FIXME: The name of the symbol has already been recorded in the dynamic string table section. */ } diff --git a/bfd/elfxx-target.h b/bfd/elfxx-target.h index 0a69dd80ee..b1f4867e56 100644 --- a/bfd/elfxx-target.h +++ b/bfd/elfxx-target.h @@ -306,6 +306,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef elf_backend_output_arch_syms #define elf_backend_output_arch_syms NULL #endif +#ifndef elf_backend_copy_indirect_symbol +#define elf_backend_copy_indirect_symbol _bfd_elf_link_hash_copy_indirect +#endif +#ifndef elf_backend_hide_symbol +#define elf_backend_hide_symbol _bfd_elf_link_hash_hide_symbol +#endif + /* Previously, backends could only use SHT_REL or SHT_RELA relocation sections, but not both. They defined USE_REL to indicate SHT_REL @@ -383,6 +390,8 @@ static CONST struct elf_backend_data elfNN_bed = elf_backend_post_process_headers, elf_backend_print_symbol_all, elf_backend_output_arch_syms, + elf_backend_copy_indirect_symbol, + elf_backend_hide_symbol, elf_backend_ecoff_debug_swap, ELF_MACHINE_ALT1, ELF_MACHINE_ALT2, -- 2.11.0