diff options
author | Alan Modra <amodra@gmail.com> | 2014-06-13 19:11:19 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2014-06-13 19:11:19 +0930 |
commit | 68faa6378d757de1fdf29f7d27025c5eadd897ec (patch) | |
tree | d8328db037f37874cf6bbcbc9d099851c40b8668 /bfd | |
parent | c72f2fb2bb6a3e1850b081dbfce4040970fae8e6 (diff) | |
download | gdb-68faa6378d757de1fdf29f7d27025c5eadd897ec.zip gdb-68faa6378d757de1fdf29f7d27025c5eadd897ec.tar.gz gdb-68faa6378d757de1fdf29f7d27025c5eadd897ec.tar.bz2 |
Move link_hash_table_free functions earlier
Move some code around, in preparation for a followup patch.
* elf-m10300.c, * elf32-arm.c, * elf32-avr.c, * elf32-hppa.c,
* elf32-i386.c, * elf32-m68hc1x.c, * elf32-m68k.c, * elf32-metag.c,
* elf32-nios2.c, * elf64-ia64-vms.c, * elf64-ppc.c, * elf64-x86-64.c,
* elfnn-aarch64.c, * elfnn-ia64.c, * elfxx-sparc.c, * xcofflink.c:
Move link_hash_table_free functions before their corresponding
link_hash_table_create functions.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 9 | ||||
-rw-r--r-- | bfd/elf-m10300.c | 28 | ||||
-rw-r--r-- | bfd/elf32-arm.c | 26 | ||||
-rw-r--r-- | bfd/elf32-avr.c | 36 | ||||
-rw-r--r-- | bfd/elf32-hppa.c | 24 | ||||
-rw-r--r-- | bfd/elf32-i386.c | 30 | ||||
-rw-r--r-- | bfd/elf32-m68hc1x.c | 26 | ||||
-rw-r--r-- | bfd/elf32-m68k.c | 34 | ||||
-rw-r--r-- | bfd/elf32-metag.c | 24 | ||||
-rw-r--r-- | bfd/elf32-nios2.c | 22 | ||||
-rw-r--r-- | bfd/elf64-ia64-vms.c | 72 | ||||
-rw-r--r-- | bfd/elf64-ppc.c | 28 | ||||
-rw-r--r-- | bfd/elf64-x86-64.c | 30 | ||||
-rw-r--r-- | bfd/elfnn-aarch64.c | 36 | ||||
-rw-r--r-- | bfd/elfnn-ia64.c | 72 | ||||
-rw-r--r-- | bfd/elfxx-sparc.c | 30 | ||||
-rw-r--r-- | bfd/xcofflink.c | 26 |
17 files changed, 281 insertions, 272 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index b337861..bfe234a 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,14 @@ 2014-06-13 Alan Modra <amodra@gmail.com> + * elf-m10300.c, * elf32-arm.c, * elf32-avr.c, * elf32-hppa.c, + * elf32-i386.c, * elf32-m68hc1x.c, * elf32-m68k.c, * elf32-metag.c, + * elf32-nios2.c, * elf64-ia64-vms.c, * elf64-ppc.c, * elf64-x86-64.c, + * elfnn-aarch64.c, * elfnn-ia64.c, * elfxx-sparc.c, * xcofflink.c: + Move link_hash_table_free functions before their corresponding + link_hash_table_create functions. + +2014-06-13 Alan Modra <amodra@gmail.com> + * bfd.c (struct bfd): Replace link_next with a union. * aoutx.h, * bfd.c, * coff-ppc.c, * coff-rs6000.c, * cofflink.c, * ecoff.c, * elf-m10300.c, * elf32-arm.c, * elf32-avr.c, diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c index 413e9da..58c8c73 100644 --- a/bfd/elf-m10300.c +++ b/bfd/elf-m10300.c @@ -4598,6 +4598,20 @@ _bfd_mn10300_copy_indirect_symbol (struct bfd_link_info * info, _bfd_elf_link_hash_copy_indirect (info, dir, ind); } +/* Destroy an mn10300 ELF linker hash table. */ + +static void +elf32_mn10300_link_hash_table_free (struct bfd_link_hash_table *hash) +{ + struct elf32_mn10300_link_hash_table *ret + = (struct elf32_mn10300_link_hash_table *) hash; + + _bfd_elf_link_hash_table_free + ((struct bfd_link_hash_table *) ret->static_hash_table); + _bfd_elf_link_hash_table_free + ((struct bfd_link_hash_table *) ret); +} + /* Create an mn10300 ELF linker hash table. */ static struct bfd_link_hash_table * @@ -4641,20 +4655,6 @@ elf32_mn10300_link_hash_table_create (bfd *abfd) return & ret->root.root; } -/* Free an mn10300 ELF linker hash table. */ - -static void -elf32_mn10300_link_hash_table_free (struct bfd_link_hash_table *hash) -{ - struct elf32_mn10300_link_hash_table *ret - = (struct elf32_mn10300_link_hash_table *) hash; - - _bfd_elf_link_hash_table_free - ((struct bfd_link_hash_table *) ret->static_hash_table); - _bfd_elf_link_hash_table_free - ((struct bfd_link_hash_table *) ret); -} - static unsigned long elf_mn10300_mach (flagword flags) { diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index e0f1d1d..556e66c 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -3523,6 +3523,18 @@ elf32_arm_copy_indirect_symbol (struct bfd_link_info *info, _bfd_elf_link_hash_copy_indirect (info, dir, ind); } +/* Destroy an ARM elf linker hash table. */ + +static void +elf32_arm_link_hash_table_free (struct bfd_link_hash_table *hash) +{ + struct elf32_arm_link_hash_table *ret + = (struct elf32_arm_link_hash_table *) hash; + + bfd_hash_table_free (&ret->stub_hash_table); + _bfd_elf_link_hash_table_free (hash); +} + /* Create an ARM elf linker hash table. */ static struct bfd_link_hash_table * @@ -3565,18 +3577,6 @@ elf32_arm_link_hash_table_create (bfd *abfd) return &ret->root.root; } -/* Free the derived linker hash table. */ - -static void -elf32_arm_hash_table_free (struct bfd_link_hash_table *hash) -{ - struct elf32_arm_link_hash_table *ret - = (struct elf32_arm_link_hash_table *) hash; - - bfd_hash_table_free (&ret->stub_hash_table); - _bfd_elf_link_hash_table_free (hash); -} - /* Determine what kind of NOPs are available. */ static bfd_boolean @@ -16105,7 +16105,7 @@ elf32_arm_get_synthetic_symtab (bfd *abfd, #define bfd_elf32_bfd_set_private_flags elf32_arm_set_private_flags #define bfd_elf32_bfd_print_private_bfd_data elf32_arm_print_private_bfd_data #define bfd_elf32_bfd_link_hash_table_create elf32_arm_link_hash_table_create -#define bfd_elf32_bfd_link_hash_table_free elf32_arm_hash_table_free +#define bfd_elf32_bfd_link_hash_table_free elf32_arm_link_hash_table_free #define bfd_elf32_bfd_reloc_type_lookup elf32_arm_reloc_type_lookup #define bfd_elf32_bfd_reloc_name_lookup elf32_arm_reloc_name_lookup #define bfd_elf32_find_nearest_line elf32_arm_find_nearest_line diff --git a/bfd/elf32-avr.c b/bfd/elf32-avr.c index 60a2c7f..02cb449 100644 --- a/bfd/elf32-avr.c +++ b/bfd/elf32-avr.c @@ -711,6 +711,24 @@ elf32_avr_link_hash_newfunc (struct bfd_hash_entry * entry, return _bfd_elf_link_hash_newfunc (entry, table, string); } +/* Free the derived linker hash table. */ + +static void +elf32_avr_link_hash_table_free (struct bfd_link_hash_table *btab) +{ + struct elf32_avr_link_hash_table *htab + = (struct elf32_avr_link_hash_table *) btab; + + /* Free the address mapping table. */ + if (htab->amt_stub_offsets != NULL) + free (htab->amt_stub_offsets); + if (htab->amt_destination_addr != NULL) + free (htab->amt_destination_addr); + + bfd_hash_table_free (&htab->bstab); + _bfd_elf_link_hash_table_free (btab); +} + /* Create the derived linker hash table. The AVR ELF port uses the derived hash table to keep information specific to the AVR ELF linker (without using static variables). */ @@ -742,24 +760,6 @@ elf32_avr_link_hash_table_create (bfd *abfd) return &htab->etab.root; } -/* Free the derived linker hash table. */ - -static void -elf32_avr_link_hash_table_free (struct bfd_link_hash_table *btab) -{ - struct elf32_avr_link_hash_table *htab - = (struct elf32_avr_link_hash_table *) btab; - - /* Free the address mapping table. */ - if (htab->amt_stub_offsets != NULL) - free (htab->amt_stub_offsets); - if (htab->amt_destination_addr != NULL) - free (htab->amt_destination_addr); - - bfd_hash_table_free (&htab->bstab); - _bfd_elf_link_hash_table_free (btab); -} - /* Calculates the effective distance of a pc relative jump/call. */ static int diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c index 262befd..3d55976 100644 --- a/bfd/elf32-hppa.c +++ b/bfd/elf32-hppa.c @@ -407,6 +407,18 @@ hppa_link_hash_newfunc (struct bfd_hash_entry *entry, return entry; } +/* Free the derived linker hash table. */ + +static void +elf32_hppa_link_hash_table_free (struct bfd_link_hash_table *btab) +{ + struct elf32_hppa_link_hash_table *htab + = (struct elf32_hppa_link_hash_table *) btab; + + bfd_hash_table_free (&htab->bstab); + _bfd_elf_link_hash_table_free (btab); +} + /* Create the derived linker hash table. The PA ELF port uses the derived hash table to keep information specific to the PA ELF linker (without using static variables). */ @@ -439,18 +451,6 @@ elf32_hppa_link_hash_table_create (bfd *abfd) return &htab->etab.root; } -/* Free the derived linker hash table. */ - -static void -elf32_hppa_link_hash_table_free (struct bfd_link_hash_table *btab) -{ - struct elf32_hppa_link_hash_table *htab - = (struct elf32_hppa_link_hash_table *) btab; - - bfd_hash_table_free (&htab->bstab); - _bfd_elf_link_hash_table_free (btab); -} - /* Build a name for an entry in the stub hash table. */ static char * diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index e33a8c6..a42c2d2 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -927,6 +927,21 @@ elf_i386_get_local_sym_hash (struct elf_i386_link_hash_table *htab, return &ret->elf; } +/* Destroy an i386 ELF linker hash table. */ + +static void +elf_i386_link_hash_table_free (struct bfd_link_hash_table *hash) +{ + struct elf_i386_link_hash_table *htab + = (struct elf_i386_link_hash_table *) hash; + + if (htab->loc_hash_table) + htab_delete (htab->loc_hash_table); + if (htab->loc_hash_memory) + objalloc_free ((struct objalloc *) htab->loc_hash_memory); + _bfd_elf_link_hash_table_free (hash); +} + /* Create an i386 ELF linker hash table. */ static struct bfd_link_hash_table * @@ -962,21 +977,6 @@ elf_i386_link_hash_table_create (bfd *abfd) return &ret->elf.root; } -/* Destroy an i386 ELF linker hash table. */ - -static void -elf_i386_link_hash_table_free (struct bfd_link_hash_table *hash) -{ - struct elf_i386_link_hash_table *htab - = (struct elf_i386_link_hash_table *) hash; - - if (htab->loc_hash_table) - htab_delete (htab->loc_hash_table); - if (htab->loc_hash_memory) - objalloc_free ((struct objalloc *) htab->loc_hash_memory); - _bfd_elf_link_hash_table_free (hash); -} - /* Create .plt, .rel.plt, .got, .got.plt, .rel.got, .dynbss, and .rel.bss sections in DYNOBJ, and set up shortcuts to them in our hash table. */ diff --git a/bfd/elf32-m68hc1x.c b/bfd/elf32-m68hc1x.c index c96625c..7c84517 100644 --- a/bfd/elf32-m68hc1x.c +++ b/bfd/elf32-m68hc1x.c @@ -58,6 +58,19 @@ struct m68hc11_scan_param }; +/* Destroy a 68HC11/68HC12 ELF linker hash table. */ + +void +m68hc11_elf_bfd_link_hash_table_free (struct bfd_link_hash_table *hash) +{ + struct m68hc11_elf_link_hash_table *ret + = (struct m68hc11_elf_link_hash_table *) hash; + + bfd_hash_table_free (ret->stub_hash_table); + free (ret->stub_hash_table); + _bfd_elf_link_hash_table_free (hash); +} + /* Create a 68HC11/68HC12 ELF linker hash table. */ struct m68hc11_elf_link_hash_table* @@ -94,19 +107,6 @@ m68hc11_elf_hash_table_create (bfd *abfd) return ret; } -/* Free the derived linker hash table. */ - -void -m68hc11_elf_bfd_link_hash_table_free (struct bfd_link_hash_table *hash) -{ - struct m68hc11_elf_link_hash_table *ret - = (struct m68hc11_elf_link_hash_table *) hash; - - bfd_hash_table_free (ret->stub_hash_table); - free (ret->stub_hash_table); - _bfd_elf_link_hash_table_free (hash); -} - /* Assorted hash table functions. */ /* Initialize an entry in the stub hash table. */ diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c index 44e302a..86252a8 100644 --- a/bfd/elf32-m68k.c +++ b/bfd/elf32-m68k.c @@ -940,6 +940,23 @@ elf_m68k_link_hash_newfunc (struct bfd_hash_entry *entry, return ret; } +/* Destroy an m68k ELF linker hash table. */ + +static void +elf_m68k_link_hash_table_free (struct bfd_link_hash_table *_htab) +{ + struct elf_m68k_link_hash_table *htab; + + htab = (struct elf_m68k_link_hash_table *) _htab; + + if (htab->multi_got_.bfd2got != NULL) + { + htab_delete (htab->multi_got_.bfd2got); + htab->multi_got_.bfd2got = NULL; + } + _bfd_elf_link_hash_table_free (_htab); +} + /* Create an m68k ELF linker hash table. */ static struct bfd_link_hash_table * @@ -966,23 +983,6 @@ elf_m68k_link_hash_table_create (bfd *abfd) return &ret->root.root; } -/* Destruct local data. */ - -static void -elf_m68k_link_hash_table_free (struct bfd_link_hash_table *_htab) -{ - struct elf_m68k_link_hash_table *htab; - - htab = (struct elf_m68k_link_hash_table *) _htab; - - if (htab->multi_got_.bfd2got != NULL) - { - htab_delete (htab->multi_got_.bfd2got); - htab->multi_got_.bfd2got = NULL; - } - _bfd_elf_link_hash_table_free (_htab); -} - /* Set the right machine number. */ static bfd_boolean diff --git a/bfd/elf32-metag.c b/bfd/elf32-metag.c index b48ebb4..e1f800b 100644 --- a/bfd/elf32-metag.c +++ b/bfd/elf32-metag.c @@ -1017,6 +1017,18 @@ metag_link_hash_newfunc (struct bfd_hash_entry *entry, return entry; } +/* Free the derived linker hash table. */ + +static void +elf_metag_link_hash_table_free (struct bfd_link_hash_table *btab) +{ + struct elf_metag_link_hash_table *htab + = (struct elf_metag_link_hash_table *) btab; + + bfd_hash_table_free (&htab->bstab); + _bfd_elf_link_hash_table_free (btab); +} + /* Create the derived linker hash table. The Meta ELF port uses the derived hash table to keep information specific to the Meta ELF linker (without using static variables). */ @@ -1048,18 +1060,6 @@ elf_metag_link_hash_table_create (bfd *abfd) return &htab->etab.root; } -/* Free the derived linker hash table. */ - -static void -elf_metag_link_hash_table_free (struct bfd_link_hash_table *btab) -{ - struct elf_metag_link_hash_table *htab - = (struct elf_metag_link_hash_table *) btab; - - bfd_hash_table_free (&htab->bstab); - _bfd_elf_link_hash_table_free (btab); -} - /* Section name for stubs is the associated section name plus this string. */ #define STUB_SUFFIX ".stub" diff --git a/bfd/elf32-nios2.c b/bfd/elf32-nios2.c index 4ce670b..10060c2 100644 --- a/bfd/elf32-nios2.c +++ b/bfd/elf32-nios2.c @@ -5104,6 +5104,17 @@ nios2_elf32_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, return TRUE; } +/* Free the derived linker hash table. */ +static void +nios2_elf32_link_hash_table_free (struct bfd_link_hash_table *btab) +{ + struct elf32_nios2_link_hash_table *htab + = (struct elf32_nios2_link_hash_table *) btab; + + bfd_hash_table_free (&htab->bstab); + _bfd_elf_link_hash_table_free (btab); +} + /* Implement bfd_elf32_bfd_link_hash_table_create. */ static struct bfd_link_hash_table * nios2_elf32_link_hash_table_create (bfd *abfd) @@ -5133,17 +5144,6 @@ nios2_elf32_link_hash_table_create (bfd *abfd) return &ret->root.root; } -/* Free the derived linker hash table. */ -static void -nios2_elf32_link_hash_table_free (struct bfd_link_hash_table *btab) -{ - struct elf32_nios2_link_hash_table *htab - = (struct elf32_nios2_link_hash_table *) btab; - - bfd_hash_table_free (&htab->bstab); - _bfd_elf_link_hash_table_free (btab); -} - /* Implement elf_backend_reloc_type_class. */ static enum elf_reloc_type_class nios2_elf32_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED, diff --git a/bfd/elf64-ia64-vms.c b/bfd/elf64-ia64-vms.c index d14b909..989646b 100644 --- a/bfd/elf64-ia64-vms.c +++ b/bfd/elf64-ia64-vms.c @@ -975,40 +975,6 @@ elf64_ia64_local_htab_eq (const void *ptr1, const void *ptr2) return entry1->id == entry2->id && entry1->r_sym == entry2->r_sym; } -/* Create the derived linker hash table. The IA-64 ELF port uses this - derived hash table to keep information specific to the IA-64 ElF - linker (without using static variables). */ - -static struct bfd_link_hash_table * -elf64_ia64_hash_table_create (bfd *abfd) -{ - struct elf64_ia64_link_hash_table *ret; - - ret = bfd_zmalloc ((bfd_size_type) sizeof (*ret)); - if (!ret) - return NULL; - - if (!_bfd_elf_link_hash_table_init (&ret->root, abfd, - elf64_ia64_new_elf_hash_entry, - sizeof (struct elf64_ia64_link_hash_entry), - IA64_ELF_DATA)) - { - free (ret); - return NULL; - } - - ret->loc_hash_table = htab_try_create (1024, elf64_ia64_local_htab_hash, - elf64_ia64_local_htab_eq, NULL); - ret->loc_hash_memory = objalloc_create (); - if (!ret->loc_hash_table || !ret->loc_hash_memory) - { - free (ret); - return NULL; - } - - return &ret->root.root; -} - /* Free the global elf64_ia64_dyn_sym_info array. */ static bfd_boolean @@ -1057,7 +1023,7 @@ elf64_ia64_local_dyn_info_free (void **slot, /* Destroy IA-64 linker hash table. */ static void -elf64_ia64_hash_table_free (struct bfd_link_hash_table *hash) +elf64_ia64_link_hash_table_free (struct bfd_link_hash_table *hash) { struct elf64_ia64_link_hash_table *ia64_info = (struct elf64_ia64_link_hash_table *) hash; @@ -1074,6 +1040,40 @@ elf64_ia64_hash_table_free (struct bfd_link_hash_table *hash) _bfd_elf_link_hash_table_free (hash); } +/* Create the derived linker hash table. The IA-64 ELF port uses this + derived hash table to keep information specific to the IA-64 ElF + linker (without using static variables). */ + +static struct bfd_link_hash_table * +elf64_ia64_hash_table_create (bfd *abfd) +{ + struct elf64_ia64_link_hash_table *ret; + + ret = bfd_zmalloc ((bfd_size_type) sizeof (*ret)); + if (!ret) + return NULL; + + if (!_bfd_elf_link_hash_table_init (&ret->root, abfd, + elf64_ia64_new_elf_hash_entry, + sizeof (struct elf64_ia64_link_hash_entry), + IA64_ELF_DATA)) + { + free (ret); + return NULL; + } + + ret->loc_hash_table = htab_try_create (1024, elf64_ia64_local_htab_hash, + elf64_ia64_local_htab_eq, NULL); + ret->loc_hash_memory = objalloc_create (); + if (!ret->loc_hash_table || !ret->loc_hash_memory) + { + free (ret); + return NULL; + } + + return &ret->root.root; +} + /* Traverse both local and global hash tables. */ struct elf64_ia64_dyn_sym_traverse_data @@ -5459,7 +5459,7 @@ static const struct elf_size_info elf64_ia64_vms_size_info = { #define bfd_elf64_bfd_link_hash_table_create \ elf64_ia64_hash_table_create #define bfd_elf64_bfd_link_hash_table_free \ - elf64_ia64_hash_table_free + elf64_ia64_link_hash_table_free #define elf_backend_create_dynamic_sections \ elf64_ia64_create_dynamic_sections #define elf_backend_check_relocs \ diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index 1d5d4ab..29d2b77 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -4142,6 +4142,20 @@ tocsave_htab_eq (const void *p1, const void *p2) return e1->sec == e2->sec && e1->offset == e2->offset; } +/* Destroy a ppc64 ELF linker hash table. */ + +static void +ppc64_elf_link_hash_table_free (struct bfd_link_hash_table *hash) +{ + struct ppc_link_hash_table *htab = (struct ppc_link_hash_table *) hash; + + bfd_hash_table_free (&htab->stub_hash_table); + bfd_hash_table_free (&htab->branch_hash_table); + if (htab->tocsave_htab) + htab_delete (htab->tocsave_htab); + _bfd_elf_link_hash_table_free (hash); +} + /* Create a ppc64 ELF linker hash table. */ static struct bfd_link_hash_table * @@ -4207,20 +4221,6 @@ ppc64_elf_link_hash_table_create (bfd *abfd) return &htab->elf.root; } -/* Free the derived linker hash table. */ - -static void -ppc64_elf_link_hash_table_free (struct bfd_link_hash_table *hash) -{ - struct ppc_link_hash_table *htab = (struct ppc_link_hash_table *) hash; - - bfd_hash_table_free (&htab->stub_hash_table); - bfd_hash_table_free (&htab->branch_hash_table); - if (htab->tocsave_htab) - htab_delete (htab->tocsave_htab); - _bfd_elf_link_hash_table_free (hash); -} - /* Create sections for linker generated code. */ static bfd_boolean diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index d230776..306b437 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -967,6 +967,21 @@ elf_x86_64_get_local_sym_hash (struct elf_x86_64_link_hash_table *htab, return &ret->elf; } +/* Destroy an X86-64 ELF linker hash table. */ + +static void +elf_x86_64_link_hash_table_free (struct bfd_link_hash_table *hash) +{ + struct elf_x86_64_link_hash_table *htab + = (struct elf_x86_64_link_hash_table *) hash; + + if (htab->loc_hash_table) + htab_delete (htab->loc_hash_table); + if (htab->loc_hash_memory) + objalloc_free ((struct objalloc *) htab->loc_hash_memory); + _bfd_elf_link_hash_table_free (hash); +} + /* Create an X86-64 ELF linker hash table. */ static struct bfd_link_hash_table * @@ -1019,21 +1034,6 @@ elf_x86_64_link_hash_table_create (bfd *abfd) return &ret->elf.root; } -/* Destroy an X86-64 ELF linker hash table. */ - -static void -elf_x86_64_link_hash_table_free (struct bfd_link_hash_table *hash) -{ - struct elf_x86_64_link_hash_table *htab - = (struct elf_x86_64_link_hash_table *) hash; - - if (htab->loc_hash_table) - htab_delete (htab->loc_hash_table); - if (htab->loc_hash_memory) - objalloc_free ((struct objalloc *) htab->loc_hash_memory); - _bfd_elf_link_hash_table_free (hash); -} - /* Create .plt, .rela.plt, .got, .got.plt, .rela.got, .dynbss, and .rela.bss sections in DYNOBJ, and set up shortcuts to them in our hash table. */ diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c index 65ca2a4..c1ca594 100644 --- a/bfd/elfnn-aarch64.c +++ b/bfd/elfnn-aarch64.c @@ -2055,6 +2055,23 @@ elfNN_aarch64_copy_indirect_symbol (struct bfd_link_info *info, _bfd_elf_link_hash_copy_indirect (info, dir, ind); } +/* Destroy an AArch64 elf linker hash table. */ + +static void +elfNN_aarch64_link_hash_table_free (struct bfd_link_hash_table *hash) +{ + struct elf_aarch64_link_hash_table *ret + = (struct elf_aarch64_link_hash_table *) hash; + + if (ret->loc_hash_table) + htab_delete (ret->loc_hash_table); + if (ret->loc_hash_memory) + objalloc_free ((struct objalloc *) ret->loc_hash_memory); + + bfd_hash_table_free (&ret->stub_hash_table); + _bfd_elf_link_hash_table_free (hash); +} + /* Create an AArch64 elf linker hash table. */ static struct bfd_link_hash_table * @@ -2101,23 +2118,6 @@ elfNN_aarch64_link_hash_table_create (bfd *abfd) return &ret->root.root; } -/* Free the derived linker hash table. */ - -static void -elfNN_aarch64_hash_table_free (struct bfd_link_hash_table *hash) -{ - struct elf_aarch64_link_hash_table *ret - = (struct elf_aarch64_link_hash_table *) hash; - - if (ret->loc_hash_table) - htab_delete (ret->loc_hash_table); - if (ret->loc_hash_memory) - objalloc_free ((struct objalloc *) ret->loc_hash_memory); - - bfd_hash_table_free (&ret->stub_hash_table); - _bfd_elf_link_hash_table_free (hash); -} - static bfd_boolean aarch64_relocate (unsigned int r_type, bfd *input_bfd, asection *input_section, bfd_vma offset, bfd_vma value) @@ -7197,7 +7197,7 @@ const struct elf_size_info elfNN_aarch64_size_info = elfNN_aarch64_link_hash_table_create #define bfd_elfNN_bfd_link_hash_table_free \ - elfNN_aarch64_hash_table_free + elfNN_aarch64_link_hash_table_free #define bfd_elfNN_bfd_merge_private_bfd_data \ elfNN_aarch64_merge_private_bfd_data diff --git a/bfd/elfnn-ia64.c b/bfd/elfnn-ia64.c index d941cdd..7fcf489 100644 --- a/bfd/elfnn-ia64.c +++ b/bfd/elfnn-ia64.c @@ -1369,40 +1369,6 @@ elfNN_ia64_local_htab_eq (const void *ptr1, const void *ptr2) return entry1->id == entry2->id && entry1->r_sym == entry2->r_sym; } -/* Create the derived linker hash table. The IA-64 ELF port uses this - derived hash table to keep information specific to the IA-64 ElF - linker (without using static variables). */ - -static struct bfd_link_hash_table * -elfNN_ia64_hash_table_create (bfd *abfd) -{ - struct elfNN_ia64_link_hash_table *ret; - - ret = bfd_zmalloc ((bfd_size_type) sizeof (*ret)); - if (!ret) - return NULL; - - if (!_bfd_elf_link_hash_table_init (&ret->root, abfd, - elfNN_ia64_new_elf_hash_entry, - sizeof (struct elfNN_ia64_link_hash_entry), - IA64_ELF_DATA)) - { - free (ret); - return NULL; - } - - ret->loc_hash_table = htab_try_create (1024, elfNN_ia64_local_htab_hash, - elfNN_ia64_local_htab_eq, NULL); - ret->loc_hash_memory = objalloc_create (); - if (!ret->loc_hash_table || !ret->loc_hash_memory) - { - free (ret); - return NULL; - } - - return &ret->root.root; -} - /* Free the global elfNN_ia64_dyn_sym_info array. */ static bfd_boolean @@ -1448,7 +1414,7 @@ elfNN_ia64_local_dyn_info_free (void **slot, /* Destroy IA-64 linker hash table. */ static void -elfNN_ia64_hash_table_free (struct bfd_link_hash_table *hash) +elfNN_ia64_link_hash_table_free (struct bfd_link_hash_table *hash) { struct elfNN_ia64_link_hash_table *ia64_info = (struct elfNN_ia64_link_hash_table *) hash; @@ -1465,6 +1431,40 @@ elfNN_ia64_hash_table_free (struct bfd_link_hash_table *hash) _bfd_elf_link_hash_table_free (hash); } +/* Create the derived linker hash table. The IA-64 ELF port uses this + derived hash table to keep information specific to the IA-64 ElF + linker (without using static variables). */ + +static struct bfd_link_hash_table * +elfNN_ia64_hash_table_create (bfd *abfd) +{ + struct elfNN_ia64_link_hash_table *ret; + + ret = bfd_zmalloc ((bfd_size_type) sizeof (*ret)); + if (!ret) + return NULL; + + if (!_bfd_elf_link_hash_table_init (&ret->root, abfd, + elfNN_ia64_new_elf_hash_entry, + sizeof (struct elfNN_ia64_link_hash_entry), + IA64_ELF_DATA)) + { + free (ret); + return NULL; + } + + ret->loc_hash_table = htab_try_create (1024, elfNN_ia64_local_htab_hash, + elfNN_ia64_local_htab_eq, NULL); + ret->loc_hash_memory = objalloc_create (); + if (!ret->loc_hash_table || !ret->loc_hash_memory) + { + free (ret); + return NULL; + } + + return &ret->root.root; +} + /* Traverse both local and global hash tables. */ struct elfNN_ia64_dyn_sym_traverse_data @@ -5025,7 +5025,7 @@ elfNN_hpux_backend_symbol_processing (bfd *abfd ATTRIBUTE_UNUSED, #define bfd_elfNN_bfd_link_hash_table_create \ elfNN_ia64_hash_table_create #define bfd_elfNN_bfd_link_hash_table_free \ - elfNN_ia64_hash_table_free + elfNN_ia64_link_hash_table_free #define elf_backend_create_dynamic_sections \ elfNN_ia64_create_dynamic_sections #define elf_backend_check_relocs \ diff --git a/bfd/elfxx-sparc.c b/bfd/elfxx-sparc.c index 3470f24..48ca02a 100644 --- a/bfd/elfxx-sparc.c +++ b/bfd/elfxx-sparc.c @@ -1102,6 +1102,21 @@ elf_sparc_get_local_sym_hash (struct _bfd_sparc_elf_link_hash_table *htab, return &ret->elf; } +/* Destroy a SPARC ELF linker hash table. */ + +void +_bfd_sparc_elf_link_hash_table_free (struct bfd_link_hash_table *hash) +{ + struct _bfd_sparc_elf_link_hash_table *htab + = (struct _bfd_sparc_elf_link_hash_table *) hash; + + if (htab->loc_hash_table) + htab_delete (htab->loc_hash_table); + if (htab->loc_hash_memory) + objalloc_free ((struct objalloc *) htab->loc_hash_memory); + _bfd_generic_link_hash_table_free (hash); +} + /* Create a SPARC ELF linker hash table. */ struct bfd_link_hash_table * @@ -1175,21 +1190,6 @@ _bfd_sparc_elf_link_hash_table_create (bfd *abfd) return &ret->elf.root; } -/* Destroy a SPARC ELF linker hash table. */ - -void -_bfd_sparc_elf_link_hash_table_free (struct bfd_link_hash_table *hash) -{ - struct _bfd_sparc_elf_link_hash_table *htab - = (struct _bfd_sparc_elf_link_hash_table *) hash; - - if (htab->loc_hash_table) - htab_delete (htab->loc_hash_table); - if (htab->loc_hash_memory) - objalloc_free ((struct objalloc *) htab->loc_hash_memory); - _bfd_generic_link_hash_table_free (hash); -} - /* Create .plt, .rela.plt, .got, .rela.got, .dynbss, and .rela.bss sections in DYNOBJ, and set up shortcuts to them in our hash table. */ diff --git a/bfd/xcofflink.c b/bfd/xcofflink.c index 9841de6..f6c7fe6 100644 --- a/bfd/xcofflink.c +++ b/bfd/xcofflink.c @@ -571,7 +571,19 @@ xcoff_link_hash_newfunc (struct bfd_hash_entry *entry, return (struct bfd_hash_entry *) ret; } -/* Create a XCOFF link hash table. */ +/* Destroy an XCOFF link hash table. */ + +void +_bfd_xcoff_bfd_link_hash_table_free (struct bfd_link_hash_table *hash) +{ + struct xcoff_link_hash_table *ret = (struct xcoff_link_hash_table *) hash; + + _bfd_stringtab_free (ret->debug_strtab); + bfd_hash_table_free (&ret->root.table); + free (ret); +} + +/* Create an XCOFF link hash table. */ struct bfd_link_hash_table * _bfd_xcoff_bfd_link_hash_table_create (bfd *abfd) @@ -600,18 +612,6 @@ _bfd_xcoff_bfd_link_hash_table_create (bfd *abfd) return &ret->root; } - -/* Free a XCOFF link hash table. */ - -void -_bfd_xcoff_bfd_link_hash_table_free (struct bfd_link_hash_table *hash) -{ - struct xcoff_link_hash_table *ret = (struct xcoff_link_hash_table *) hash; - - _bfd_stringtab_free (ret->debug_strtab); - bfd_hash_table_free (&ret->root.table); - free (ret); -} /* Read internal relocs for an XCOFF csect. This is a wrapper around _bfd_coff_read_internal_relocs which tries to take advantage of any |