From caa4096e844a000ff63c4fa9180d70ca2093fd2a Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Fri, 13 Jun 2014 19:11:29 +0930 Subject: [PATCH] Don't call bfd_link_hash_table_free Freeing the linker hash table is a royal pain. It can't be freed before the _bfd_write_contents call in bfd_close, because some target bfd_write_contents functions access the hash table. It can't be freed after bfd_close either, since bfd_alloc memory holding side data structures disappears (PR17047). Clearly the only place it can be freed is actually in bfd_close. This patch doesn't do that, but kills off the existing means of freeing the hash table via a bfd target xvec call. bfd/ PR 17047 * targets.c (BFD_JUMP_TABLE): Delete NAME##_bfd_link_hash_table_free. (struct bfd_target <_bfd_link_hash_table_free>): Delete. * bfd.c (bfd_link_hash_table_free): Don't define. * aout-adobe.c, * aout-target.h, * aout-tic30.c, * binary.c, * bout.c, * coff64-rs6000.c, * coffcode.h, * elf-m10300.c, * elf32-arm.c, * elf32-avr.c, * elf32-hppa.c, * elf32-i386.c, * elf32-m68hc11.c, * elf32-m68hc12.c, * elf32-m68k.c, * elf32-metag.c, * elf32-nios2.c, * elf32-sparc.c, * elf32-xgate.c, * elf64-ia64-vms.c, * elf64-ppc.c, * elf64-sparc.c, * elf64-x86-64.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfxx-target.h, * i386msdos.c, * i386os9k.c, * ieee.c, * ihex.c, * libbfd-in.h, * libecoff.h, * mach-o-target.c, * mmo.c, * nlm-target.h, * oasys.c, * pef.c, * plugin.c, * ppcboot.c, * som.c, * srec.c, * tekhex.c, * verilog.c, * versados.c, * vms-alpha.c, * xsym.c: Don't define various link_hash_table_free defines, and remove from bfd_target vars. Temporarily reference some of the target link_hash_table_free functions to avoid warnings. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. ld/ PR 17047 * ldlang.c (output_bfd_hash_table_free_fn): Delete. (open_output): Don't set it.. * ldmain.c (ld_cleanup): ..or call it. --- bfd/ChangeLog | 22 ++++++++++++++++++++++ bfd/aout-adobe.c | 1 - bfd/aout-target.h | 3 --- bfd/aout-tic30.c | 3 --- bfd/bfd-in2.h | 7 ------- bfd/bfd.c | 3 --- bfd/binary.c | 1 - bfd/bout.c | 1 - bfd/coff64-rs6000.c | 2 -- bfd/coffcode.h | 4 ---- bfd/elf-m10300.c | 3 +-- bfd/elf32-arm.c | 2 +- bfd/elf32-avr.c | 2 +- bfd/elf32-hppa.c | 2 +- bfd/elf32-i386.c | 2 +- bfd/elf32-m68hc11.c | 2 -- bfd/elf32-m68hc12.c | 2 -- bfd/elf32-m68k.c | 4 +--- bfd/elf32-metag.c | 2 +- bfd/elf32-nios2.c | 3 +-- bfd/elf32-sparc.c | 2 -- bfd/elf32-xgate.c | 1 - bfd/elf64-ia64-vms.c | 3 +-- bfd/elf64-ppc.c | 2 +- bfd/elf64-sparc.c | 2 -- bfd/elf64-x86-64.c | 5 +---- bfd/elfnn-aarch64.c | 4 +--- bfd/elfnn-ia64.c | 3 +-- bfd/elfxx-target.h | 6 ------ bfd/i386msdos.c | 1 - bfd/i386os9k.c | 1 - bfd/ieee.c | 2 -- bfd/ihex.c | 1 - bfd/libbfd-in.h | 2 -- bfd/libbfd.h | 2 -- bfd/libecoff.h | 1 - bfd/mach-o-target.c | 1 - bfd/mmo.c | 1 - bfd/nlm-target.h | 1 - bfd/oasys.c | 1 - bfd/pef.c | 1 - bfd/plugin.c | 1 - bfd/ppcboot.c | 1 - bfd/som.c | 1 - bfd/srec.c | 1 - bfd/targets.c | 4 ---- bfd/tekhex.c | 1 - bfd/verilog.c | 1 - bfd/versados.c | 1 - bfd/vms-alpha.c | 1 - bfd/xsym.c | 1 - ld/ChangeLog | 7 +++++++ ld/ldlang.c | 15 --------------- ld/ldmain.c | 4 ---- 54 files changed, 42 insertions(+), 111 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index bfe234a295b..4cb3d06b9d6 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,25 @@ +2014-06-13 Alan Modra + + PR 17047 + * targets.c (BFD_JUMP_TABLE): Delete NAME##_bfd_link_hash_table_free. + (struct bfd_target <_bfd_link_hash_table_free>): Delete. + * bfd.c (bfd_link_hash_table_free): Don't define. + * aout-adobe.c, * aout-target.h, * aout-tic30.c, * binary.c, * bout.c, + * coff64-rs6000.c, * coffcode.h, * elf-m10300.c, * elf32-arm.c, + * elf32-avr.c, * elf32-hppa.c, * elf32-i386.c, * elf32-m68hc11.c, + * elf32-m68hc12.c, * elf32-m68k.c, * elf32-metag.c, * elf32-nios2.c, + * elf32-sparc.c, * elf32-xgate.c, * elf64-ia64-vms.c, * elf64-ppc.c, + * elf64-sparc.c, * elf64-x86-64.c, * elfnn-aarch64.c, * elfnn-ia64.c, + * elfxx-target.h, * i386msdos.c, * i386os9k.c, * ieee.c, * ihex.c, + * libbfd-in.h, * libecoff.h, * mach-o-target.c, * mmo.c, + * nlm-target.h, * oasys.c, * pef.c, * plugin.c, * ppcboot.c, * som.c, + * srec.c, * tekhex.c, * verilog.c, * versados.c, * vms-alpha.c, + * xsym.c: Don't define various link_hash_table_free defines, and + remove from bfd_target vars. Temporarily reference some of the + target link_hash_table_free functions to avoid warnings. + * bfd-in2.h: Regenerate. + * libbfd.h: Regenerate. + 2014-06-13 Alan Modra * elf-m10300.c, * elf32-arm.c, * elf32-avr.c, * elf32-hppa.c, diff --git a/bfd/aout-adobe.c b/bfd/aout-adobe.c index 904a5bc291a..6c65ad5166b 100644 --- a/bfd/aout-adobe.c +++ b/bfd/aout-adobe.c @@ -464,7 +464,6 @@ aout_adobe_sizeof_headers (bfd *ignore_abfd ATTRIBUTE_UNUSED, #define aout_32_section_already_linked _bfd_generic_section_already_linked #define aout_32_bfd_define_common_symbol bfd_generic_define_common_symbol #define aout_32_bfd_link_hash_table_create _bfd_generic_link_hash_table_create -#define aout_32_bfd_link_hash_table_free _bfd_generic_link_hash_table_free #define aout_32_bfd_link_add_symbols _bfd_generic_link_add_symbols #define aout_32_bfd_link_just_syms _bfd_generic_link_just_syms #define aout_32_bfd_copy_link_hash_symbol_type \ diff --git a/bfd/aout-target.h b/bfd/aout-target.h index 9786f42dccf..019c49c32ca 100644 --- a/bfd/aout-target.h +++ b/bfd/aout-target.h @@ -521,9 +521,6 @@ MY_bfd_final_link (bfd *abfd, struct bfd_link_info *info) #ifndef MY_bfd_link_hash_table_create #define MY_bfd_link_hash_table_create NAME (aout, link_hash_table_create) #endif -#ifndef MY_bfd_link_hash_table_free -#define MY_bfd_link_hash_table_free _bfd_generic_link_hash_table_free -#endif #ifndef MY_bfd_link_add_symbols #define MY_bfd_link_add_symbols NAME (aout, link_add_symbols) #endif diff --git a/bfd/aout-tic30.c b/bfd/aout-tic30.c index 680ef610c13..444ca4bea09 100644 --- a/bfd/aout-tic30.c +++ b/bfd/aout-tic30.c @@ -979,9 +979,6 @@ tic30_aout_set_arch_mach (bfd *abfd, #ifndef MY_bfd_link_hash_table_create #define MY_bfd_link_hash_table_create NAME (aout, link_hash_table_create) #endif -#ifndef MY_bfd_link_hash_table_free -#define MY_bfd_link_hash_table_free _bfd_generic_link_hash_table_free -#endif #ifndef MY_bfd_link_add_symbols #define MY_bfd_link_add_symbols NAME (aout, link_add_symbols) #endif diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 722cc2bbe0d..07d94dfce2a 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -6650,9 +6650,6 @@ bfd_boolean bfd_set_private_flags (bfd *abfd, flagword flags); #define bfd_link_hash_table_create(abfd) \ BFD_SEND (abfd, _bfd_link_hash_table_create, (abfd)) -#define bfd_link_hash_table_free(abfd, hash) \ - BFD_SEND (abfd, _bfd_link_hash_table_free, (hash)) - #define bfd_link_add_symbols(abfd, info) \ BFD_SEND (abfd, _bfd_link_add_symbols, (abfd, info)) @@ -7045,7 +7042,6 @@ typedef struct bfd_target NAME##_bfd_get_relocated_section_contents, \ NAME##_bfd_relax_section, \ NAME##_bfd_link_hash_table_create, \ - NAME##_bfd_link_hash_table_free, \ NAME##_bfd_link_add_symbols, \ NAME##_bfd_link_just_syms, \ NAME##_bfd_copy_link_hash_symbol_type, \ @@ -7072,9 +7068,6 @@ typedef struct bfd_target struct bfd_link_hash_table * (*_bfd_link_hash_table_create) (bfd *); - /* Release the memory associated with the linker hash table. */ - void (*_bfd_link_hash_table_free) (struct bfd_link_hash_table *); - /* Add symbols from this object file into the hash table. */ bfd_boolean (*_bfd_link_add_symbols) (bfd *, struct bfd_link_info *); diff --git a/bfd/bfd.c b/bfd/bfd.c index 641486514cf..2406319db57 100644 --- a/bfd/bfd.c +++ b/bfd/bfd.c @@ -1501,9 +1501,6 @@ DESCRIPTION .#define bfd_link_hash_table_create(abfd) \ . BFD_SEND (abfd, _bfd_link_hash_table_create, (abfd)) . -.#define bfd_link_hash_table_free(abfd, hash) \ -. BFD_SEND (abfd, _bfd_link_hash_table_free, (hash)) -. .#define bfd_link_add_symbols(abfd, info) \ . BFD_SEND (abfd, _bfd_link_add_symbols, (abfd, info)) . diff --git a/bfd/binary.c b/bfd/binary.c index 13825d20540..09bbeceb158 100644 --- a/bfd/binary.c +++ b/bfd/binary.c @@ -305,7 +305,6 @@ binary_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, #define binary_section_already_linked _bfd_generic_section_already_linked #define binary_bfd_define_common_symbol bfd_generic_define_common_symbol #define binary_bfd_link_hash_table_create _bfd_generic_link_hash_table_create -#define binary_bfd_link_hash_table_free _bfd_generic_link_hash_table_free #define binary_bfd_link_just_syms _bfd_generic_link_just_syms #define binary_bfd_copy_link_hash_symbol_type \ _bfd_generic_copy_link_hash_symbol_type diff --git a/bfd/bout.c b/bfd/bout.c index fddc77d075c..b444f803c89 100644 --- a/bfd/bout.c +++ b/bfd/bout.c @@ -1377,7 +1377,6 @@ b_out_bfd_get_relocated_section_contents (bfd *output_bfd, #define aout_32_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol #define aout_32_close_and_cleanup aout_32_bfd_free_cached_info #define b_out_bfd_link_hash_table_create _bfd_generic_link_hash_table_create -#define b_out_bfd_link_hash_table_free _bfd_generic_link_hash_table_free #define b_out_bfd_link_add_symbols _bfd_generic_link_add_symbols #define b_out_bfd_link_just_syms _bfd_generic_link_just_syms #define b_out_bfd_copy_link_hash_symbol_type \ diff --git a/bfd/coff64-rs6000.c b/bfd/coff64-rs6000.c index eb3b05b0893..a735e04b80e 100644 --- a/bfd/coff64-rs6000.c +++ b/bfd/coff64-rs6000.c @@ -2738,7 +2738,6 @@ const bfd_target rs6000_xcoff64_vec = bfd_generic_get_relocated_section_contents, bfd_generic_relax_section, _bfd_xcoff_bfd_link_hash_table_create, - _bfd_generic_link_hash_table_free, _bfd_xcoff_bfd_link_add_symbols, _bfd_generic_link_just_syms, _bfd_generic_copy_link_hash_symbol_type, @@ -2997,7 +2996,6 @@ const bfd_target rs6000_xcoff64_aix_vec = bfd_generic_get_relocated_section_contents, bfd_generic_relax_section, _bfd_xcoff_bfd_link_hash_table_create, - _bfd_generic_link_hash_table_free, _bfd_xcoff_bfd_link_add_symbols, _bfd_generic_link_just_syms, _bfd_generic_copy_link_hash_symbol_type, diff --git a/bfd/coffcode.h b/bfd/coffcode.h index ba3cfa27699..89ca2346612 100644 --- a/bfd/coffcode.h +++ b/bfd/coffcode.h @@ -5355,10 +5355,6 @@ dummy_reloc16_extra_cases (bfd *abfd ATTRIBUTE_UNUSED, } #endif -#ifndef coff_bfd_link_hash_table_free -#define coff_bfd_link_hash_table_free _bfd_generic_link_hash_table_free -#endif - /* If coff_relocate_section is defined, we can use the optimized COFF backend linker. Otherwise we must continue to use the old linker. */ diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c index 58c8c73fe53..4cc879ec32a 100644 --- a/bfd/elf-m10300.c +++ b/bfd/elf-m10300.c @@ -4652,6 +4652,7 @@ elf32_mn10300_link_hash_table_create (bfd *abfd) free (ret); return NULL; } + (void) elf32_mn10300_link_hash_table_free; return & ret->root.root; } @@ -5581,8 +5582,6 @@ mn10300_elf_mkobject (bfd *abfd) mn10300_elf_get_relocated_section_contents #define bfd_elf32_bfd_link_hash_table_create \ elf32_mn10300_link_hash_table_create -#define bfd_elf32_bfd_link_hash_table_free \ - elf32_mn10300_link_hash_table_free #ifndef elf_symbol_leading_char #define elf_symbol_leading_char '_' diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index 556e66c7003..6358b580ba5 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -3573,6 +3573,7 @@ elf32_arm_link_hash_table_create (bfd *abfd) free (ret); return NULL; } + (void) elf32_arm_link_hash_table_free; return &ret->root.root; } @@ -16105,7 +16106,6 @@ 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_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 02cb449e09f..55953841ce7 100644 --- a/bfd/elf32-avr.c +++ b/bfd/elf32-avr.c @@ -756,6 +756,7 @@ elf32_avr_link_hash_table_create (bfd *abfd) if (!bfd_hash_table_init (&htab->bstab, stub_hash_newfunc, sizeof (struct elf32_avr_stub_hash_entry))) return NULL; + (void) elf32_avr_link_hash_table_free; return &htab->etab.root; } @@ -3249,7 +3250,6 @@ elf32_avr_build_stubs (struct bfd_link_info *info) #define TARGET_LITTLE_NAME "elf32-avr" #define bfd_elf32_bfd_link_hash_table_create elf32_avr_link_hash_table_create -#define bfd_elf32_bfd_link_hash_table_free elf32_avr_link_hash_table_free #define elf_info_to_howto avr_info_to_howto_rela #define elf_info_to_howto_rel NULL diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c index 3d5597672f4..635ec42d943 100644 --- a/bfd/elf32-hppa.c +++ b/bfd/elf32-hppa.c @@ -445,6 +445,7 @@ elf32_hppa_link_hash_table_create (bfd *abfd) if (!bfd_hash_table_init (&htab->bstab, stub_hash_newfunc, sizeof (struct elf32_hppa_stub_hash_entry))) return NULL; + (void) elf32_hppa_link_hash_table_free; htab->text_segment_base = (bfd_vma) -1; htab->data_segment_base = (bfd_vma) -1; @@ -4625,7 +4626,6 @@ elf32_hppa_elf_get_symbol_type (Elf_Internal_Sym *elf_sym, int type) /* Stuff for the BFD linker. */ #define bfd_elf32_bfd_final_link elf32_hppa_final_link #define bfd_elf32_bfd_link_hash_table_create elf32_hppa_link_hash_table_create -#define bfd_elf32_bfd_link_hash_table_free elf32_hppa_link_hash_table_free #define elf_backend_adjust_dynamic_symbol elf32_hppa_adjust_dynamic_symbol #define elf_backend_copy_indirect_symbol elf32_hppa_copy_indirect_symbol #define elf_backend_check_relocs elf32_hppa_check_relocs diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index a42c2d26946..eb5b3d01be8 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -973,6 +973,7 @@ elf_i386_link_hash_table_create (bfd *abfd) free (ret); return NULL; } + (void) elf_i386_link_hash_table_free; return &ret->elf.root; } @@ -5041,7 +5042,6 @@ elf_i386_add_symbol_hook (bfd * abfd, #define bfd_elf32_bfd_is_local_label_name elf_i386_is_local_label_name #define bfd_elf32_bfd_link_hash_table_create elf_i386_link_hash_table_create -#define bfd_elf32_bfd_link_hash_table_free elf_i386_link_hash_table_free #define bfd_elf32_bfd_reloc_type_lookup elf_i386_reloc_type_lookup #define bfd_elf32_bfd_reloc_name_lookup elf_i386_reloc_name_lookup diff --git a/bfd/elf32-m68hc11.c b/bfd/elf32-m68hc11.c index 4b2c16e07e5..2101bdf827f 100644 --- a/bfd/elf32-m68hc11.c +++ b/bfd/elf32-m68hc11.c @@ -1305,8 +1305,6 @@ static const struct bfd_elf_special_section elf32_m68hc11_special_sections[] = #define bfd_elf32_bfd_link_hash_table_create \ m68hc11_elf_bfd_link_hash_table_create -#define bfd_elf32_bfd_link_hash_table_free \ - m68hc11_elf_bfd_link_hash_table_free #define bfd_elf32_bfd_merge_private_bfd_data \ _bfd_m68hc11_elf_merge_private_bfd_data #define bfd_elf32_bfd_set_private_flags _bfd_m68hc11_elf_set_private_flags diff --git a/bfd/elf32-m68hc12.c b/bfd/elf32-m68hc12.c index f643c37fe95..7f48b7eb761 100644 --- a/bfd/elf32-m68hc12.c +++ b/bfd/elf32-m68hc12.c @@ -655,8 +655,6 @@ static const struct bfd_elf_special_section elf32_m68hc12_special_sections[] = #define bfd_elf32_bfd_link_hash_table_create \ m68hc12_elf_bfd_link_hash_table_create -#define bfd_elf32_bfd_link_hash_table_free \ - m68hc11_elf_bfd_link_hash_table_free #define bfd_elf32_bfd_merge_private_bfd_data \ _bfd_m68hc11_elf_merge_private_bfd_data #define bfd_elf32_bfd_set_private_flags _bfd_m68hc11_elf_set_private_flags diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c index 86252a85f61..b857a0dfa88 100644 --- a/bfd/elf32-m68k.c +++ b/bfd/elf32-m68k.c @@ -977,6 +977,7 @@ elf_m68k_link_hash_table_create (bfd *abfd) free (ret); return NULL; } + (void) elf_m68k_link_hash_table_free; ret->multi_got_.global_symndx = 1; @@ -4857,9 +4858,6 @@ elf_m68k_add_symbol_hook (bfd *abfd, _bfd_elf_create_dynamic_sections #define bfd_elf32_bfd_link_hash_table_create \ elf_m68k_link_hash_table_create -/* ??? Should it be this macro or bfd_elfNN_bfd_link_hash_table_create? */ -#define bfd_elf32_bfd_link_hash_table_free \ - elf_m68k_link_hash_table_free #define bfd_elf32_bfd_final_link bfd_elf_final_link #define elf_backend_check_relocs elf_m68k_check_relocs diff --git a/bfd/elf32-metag.c b/bfd/elf32-metag.c index e1f800b6547..fde454b80e3 100644 --- a/bfd/elf32-metag.c +++ b/bfd/elf32-metag.c @@ -1056,6 +1056,7 @@ elf_metag_link_hash_table_create (bfd *abfd) if (!bfd_hash_table_init (&htab->bstab, stub_hash_newfunc, sizeof (struct elf_metag_stub_hash_entry))) return NULL; + (void) elf_metag_link_hash_table_free; return &htab->etab.root; } @@ -4295,7 +4296,6 @@ elf_metag_plt_sym_val (bfd_vma i, const asection *plt, #define bfd_elf32_bfd_is_local_label_name elf_metag_is_local_label_name #define bfd_elf32_bfd_link_hash_table_create \ elf_metag_link_hash_table_create -#define bfd_elf32_bfd_link_hash_table_free elf_metag_link_hash_table_free #define elf_backend_relocate_section elf_metag_relocate_section #define elf_backend_gc_mark_hook elf_metag_gc_mark_hook #define elf_backend_gc_sweep_hook elf_metag_gc_sweep_hook diff --git a/bfd/elf32-nios2.c b/bfd/elf32-nios2.c index 10060c25223..ba6a3718323 100644 --- a/bfd/elf32-nios2.c +++ b/bfd/elf32-nios2.c @@ -5140,6 +5140,7 @@ nios2_elf32_link_hash_table_create (bfd *abfd) if (!bfd_hash_table_init (&ret->bstab, stub_hash_newfunc, sizeof (struct elf32_nios2_stub_hash_entry))) return NULL; + (void) nios2_elf32_link_hash_table_free; return &ret->root.root; } @@ -5250,8 +5251,6 @@ const struct bfd_elf_special_section elf32_nios2_special_sections[] = #define bfd_elf32_bfd_link_hash_table_create \ nios2_elf32_link_hash_table_create -#define bfd_elf32_bfd_link_hash_table_free \ - nios2_elf32_link_hash_table_free /* Relocation table lookup macros. */ diff --git a/bfd/elf32-sparc.c b/bfd/elf32-sparc.c index f714a5e4c8e..ecfa16509ae 100644 --- a/bfd/elf32-sparc.c +++ b/bfd/elf32-sparc.c @@ -209,8 +209,6 @@ elf32_sparc_add_symbol_hook (bfd * abfd, _bfd_sparc_elf_reloc_name_lookup #define bfd_elf32_bfd_link_hash_table_create \ _bfd_sparc_elf_link_hash_table_create -#define bfd_elf32_bfd_link_hash_table_free \ - _bfd_sparc_elf_link_hash_table_free #define bfd_elf32_bfd_relax_section _bfd_sparc_elf_relax_section #define bfd_elf32_new_section_hook _bfd_sparc_elf_new_section_hook #define elf_backend_copy_indirect_symbol \ diff --git a/bfd/elf32-xgate.c b/bfd/elf32-xgate.c index 87d06c874d2..588901bab11 100644 --- a/bfd/elf32-xgate.c +++ b/bfd/elf32-xgate.c @@ -717,7 +717,6 @@ elf32_xgate_post_process_headers (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_link_in #define elf_backend_add_symbol_hook elf32_xgate_add_symbol_hook #define bfd_elf32_bfd_link_hash_table_create xgate_elf_bfd_link_hash_table_create -#define bfd_elf32_bfd_link_hash_table_free xgate_elf_bfd_link_hash_table_free #define bfd_elf32_bfd_merge_private_bfd_data _bfd_xgate_elf_merge_private_bfd_data #define bfd_elf32_bfd_set_private_flags _bfd_xgate_elf_set_private_flags #define bfd_elf32_bfd_print_private_bfd_data _bfd_xgate_elf_print_private_bfd_data diff --git a/bfd/elf64-ia64-vms.c b/bfd/elf64-ia64-vms.c index 989646b00e2..4beeca204ba 100644 --- a/bfd/elf64-ia64-vms.c +++ b/bfd/elf64-ia64-vms.c @@ -1070,6 +1070,7 @@ elf64_ia64_hash_table_create (bfd *abfd) free (ret); return NULL; } + (void) elf64_ia64_link_hash_table_free; return &ret->root.root; } @@ -5458,8 +5459,6 @@ static const struct elf_size_info elf64_ia64_vms_size_info = { /* Stuff for the BFD linker: */ #define bfd_elf64_bfd_link_hash_table_create \ elf64_ia64_hash_table_create -#define bfd_elf64_bfd_link_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 29d2b773407..581ce55f309 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -84,7 +84,6 @@ static bfd_vma opd_entry_value #define bfd_elf64_bfd_print_private_bfd_data ppc64_elf_print_private_bfd_data #define bfd_elf64_new_section_hook ppc64_elf_new_section_hook #define bfd_elf64_bfd_link_hash_table_create ppc64_elf_link_hash_table_create -#define bfd_elf64_bfd_link_hash_table_free ppc64_elf_link_hash_table_free #define bfd_elf64_get_synthetic_symtab ppc64_elf_get_synthetic_symtab #define bfd_elf64_bfd_link_just_syms ppc64_elf_link_just_syms @@ -4204,6 +4203,7 @@ ppc64_elf_link_hash_table_create (bfd *abfd) _bfd_elf_link_hash_table_free ((struct bfd_link_hash_table *) htab); return NULL; } + (void) ppc64_elf_link_hash_table_free; /* Initializing two fields of the union is just cosmetic. We really only care about glist, but when compiled on a 32-bit host the diff --git a/bfd/elf64-sparc.c b/bfd/elf64-sparc.c index 6f995c5cfba..0866c0db1b0 100644 --- a/bfd/elf64-sparc.c +++ b/bfd/elf64-sparc.c @@ -864,8 +864,6 @@ const struct elf_size_info elf64_sparc_size_info = _bfd_sparc_elf_plt_sym_val #define bfd_elf64_bfd_link_hash_table_create \ _bfd_sparc_elf_link_hash_table_create -#define bfd_elf64_bfd_link_hash_table_free \ - _bfd_sparc_elf_link_hash_table_free #define elf_info_to_howto \ _bfd_sparc_elf_info_to_howto #define elf_backend_copy_indirect_symbol \ diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index 306b4371d34..27f0a54fdbb 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -1030,6 +1030,7 @@ elf_x86_64_link_hash_table_create (bfd *abfd) free (ret); return NULL; } + (void) elf_x86_64_link_hash_table_free; return &ret->elf.root; } @@ -5640,8 +5641,6 @@ static const struct bfd_elf_special_section #define bfd_elf64_bfd_link_hash_table_create \ elf_x86_64_link_hash_table_create -#define bfd_elf64_bfd_link_hash_table_free \ - elf_x86_64_link_hash_table_free #define bfd_elf64_bfd_reloc_type_lookup elf_x86_64_reloc_type_lookup #define bfd_elf64_bfd_reloc_name_lookup \ elf_x86_64_reloc_name_lookup @@ -5913,8 +5912,6 @@ elf32_x86_64_nacl_elf_object_p (bfd *abfd) #define bfd_elf32_bfd_link_hash_table_create \ elf_x86_64_link_hash_table_create -#define bfd_elf32_bfd_link_hash_table_free \ - elf_x86_64_link_hash_table_free #define bfd_elf32_bfd_reloc_type_lookup \ elf_x86_64_reloc_type_lookup #define bfd_elf32_bfd_reloc_name_lookup \ diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c index c1ca5947a1d..4baa41b00c4 100644 --- a/bfd/elfnn-aarch64.c +++ b/bfd/elfnn-aarch64.c @@ -2114,6 +2114,7 @@ elfNN_aarch64_link_hash_table_create (bfd *abfd) free (ret); return NULL; } + (void) elfNN_aarch64_link_hash_table_free; return &ret->root.root; } @@ -7196,9 +7197,6 @@ const struct elf_size_info elfNN_aarch64_size_info = #define bfd_elfNN_bfd_link_hash_table_create \ elfNN_aarch64_link_hash_table_create -#define bfd_elfNN_bfd_link_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 7fcf489df83..c87dd996efe 100644 --- a/bfd/elfnn-ia64.c +++ b/bfd/elfnn-ia64.c @@ -1461,6 +1461,7 @@ elfNN_ia64_hash_table_create (bfd *abfd) free (ret); return NULL; } + (void) elfNN_ia64_link_hash_table_free; return &ret->root.root; } @@ -5024,8 +5025,6 @@ elfNN_hpux_backend_symbol_processing (bfd *abfd ATTRIBUTE_UNUSED, /* Stuff for the BFD linker: */ #define bfd_elfNN_bfd_link_hash_table_create \ elfNN_ia64_hash_table_create -#define bfd_elfNN_bfd_link_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-target.h b/bfd/elfxx-target.h index 1460d6a6109..b6531478e66 100644 --- a/bfd/elfxx-target.h +++ b/bfd/elfxx-target.h @@ -237,9 +237,6 @@ #ifndef bfd_elfNN_bfd_link_hash_table_create #define bfd_elfNN_bfd_link_hash_table_create _bfd_elf_link_hash_table_create #endif -#ifndef bfd_elfNN_bfd_link_hash_table_free -#define bfd_elfNN_bfd_link_hash_table_free _bfd_elf_link_hash_table_free -#endif #ifndef bfd_elfNN_bfd_link_add_symbols #define bfd_elfNN_bfd_link_add_symbols bfd_elf_link_add_symbols #endif @@ -256,9 +253,6 @@ #define bfd_elfNN_bfd_link_hash_table_create \ _bfd_generic_link_hash_table_create #endif -#ifndef bfd_elfNN_bfd_link_hash_table_free -#define bfd_elfNN_bfd_link_hash_table_free _bfd_generic_link_hash_table_free -#endif #ifndef bfd_elfNN_bfd_link_add_symbols #define bfd_elfNN_bfd_link_add_symbols _bfd_generic_link_add_symbols #endif diff --git a/bfd/i386msdos.c b/bfd/i386msdos.c index 7ec9298493c..e16a66cc2d2 100644 --- a/bfd/i386msdos.c +++ b/bfd/i386msdos.c @@ -150,7 +150,6 @@ msdos_set_section_contents (bfd *abfd, _bfd_generic_section_already_linked #define msdos_bfd_define_common_symbol bfd_generic_define_common_symbol #define msdos_bfd_link_hash_table_create _bfd_generic_link_hash_table_create -#define msdos_bfd_link_hash_table_free _bfd_generic_link_hash_table_free #define msdos_bfd_link_add_symbols _bfd_generic_link_add_symbols #define msdos_bfd_link_just_syms _bfd_generic_link_just_syms #define msdos_bfd_copy_link_hash_symbol_type \ diff --git a/bfd/i386os9k.c b/bfd/i386os9k.c index 65ea0bc4400..0316263278e 100644 --- a/bfd/i386os9k.c +++ b/bfd/i386os9k.c @@ -174,7 +174,6 @@ os9k_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, _bfd_generic_section_already_linked #define os9k_bfd_define_common_symbol bfd_generic_define_common_symbol #define os9k_bfd_link_hash_table_create _bfd_generic_link_hash_table_create -#define os9k_bfd_link_hash_table_free _bfd_generic_link_hash_table_free #define os9k_bfd_link_add_symbols _bfd_generic_link_add_symbols #define os9k_bfd_link_just_syms _bfd_generic_link_just_syms #define os9k_bfd_copy_link_hash_symbol_type \ diff --git a/bfd/ieee.c b/bfd/ieee.c index 7eb4dde86ee..a3d08bb819a 100644 --- a/bfd/ieee.c +++ b/bfd/ieee.c @@ -3779,7 +3779,6 @@ ieee_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, _bfd_generic_section_already_linked #define ieee_bfd_define_common_symbol bfd_generic_define_common_symbol #define ieee_bfd_link_hash_table_create _bfd_generic_link_hash_table_create -#define ieee_bfd_link_hash_table_free _bfd_generic_link_hash_table_free #define ieee_bfd_link_add_symbols _bfd_generic_link_add_symbols #define ieee_bfd_link_just_syms _bfd_generic_link_just_syms #define ieee_bfd_copy_link_hash_symbol_type \ @@ -3857,7 +3856,6 @@ const bfd_target ieee_vec = /* ieee_sizeof_headers, ieee_bfd_get_relocated_section_contents, ieee_bfd_relax_section, ieee_bfd_link_hash_table_create, - _bfd_generic_link_hash_table_free, ieee_bfd_link_add_symbols, ieee_bfd_final_link, ieee_bfd_link_split_section, ieee_bfd_gc_sections, ieee_bfd_merge_sections. */ diff --git a/bfd/ihex.c b/bfd/ihex.c index f767cb0a3d3..3301f2f3aaf 100644 --- a/bfd/ihex.c +++ b/bfd/ihex.c @@ -936,7 +936,6 @@ ihex_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, #define ihex_section_already_linked _bfd_generic_section_already_linked #define ihex_bfd_define_common_symbol bfd_generic_define_common_symbol #define ihex_bfd_link_hash_table_create _bfd_generic_link_hash_table_create -#define ihex_bfd_link_hash_table_free _bfd_generic_link_hash_table_free #define ihex_bfd_link_add_symbols _bfd_generic_link_add_symbols #define ihex_bfd_link_just_syms _bfd_generic_link_just_syms #define ihex_bfd_copy_link_hash_symbol_type \ diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h index 8a4f439ad0e..c17e508289c 100644 --- a/bfd/libbfd-in.h +++ b/bfd/libbfd-in.h @@ -471,8 +471,6 @@ extern bfd_boolean _bfd_generic_set_section_contents bfd_false) #define _bfd_nolink_bfd_link_hash_table_create \ ((struct bfd_link_hash_table *(*) (bfd *)) bfd_nullvoidptr) -#define _bfd_nolink_bfd_link_hash_table_free \ - ((void (*) (struct bfd_link_hash_table *)) bfd_void) #define _bfd_nolink_bfd_link_add_symbols \ ((bfd_boolean (*) (bfd *, struct bfd_link_info *)) bfd_false) #define _bfd_nolink_bfd_link_just_syms \ diff --git a/bfd/libbfd.h b/bfd/libbfd.h index 09f307f8a05..923eb93d673 100644 --- a/bfd/libbfd.h +++ b/bfd/libbfd.h @@ -476,8 +476,6 @@ extern bfd_boolean _bfd_generic_set_section_contents bfd_false) #define _bfd_nolink_bfd_link_hash_table_create \ ((struct bfd_link_hash_table *(*) (bfd *)) bfd_nullvoidptr) -#define _bfd_nolink_bfd_link_hash_table_free \ - ((void (*) (struct bfd_link_hash_table *)) bfd_void) #define _bfd_nolink_bfd_link_add_symbols \ ((bfd_boolean (*) (bfd *, struct bfd_link_info *)) bfd_false) #define _bfd_nolink_bfd_link_just_syms \ diff --git a/bfd/libecoff.h b/bfd/libecoff.h index f53d749d2c5..97acea40e22 100644 --- a/bfd/libecoff.h +++ b/bfd/libecoff.h @@ -311,7 +311,6 @@ extern int _bfd_ecoff_sizeof_headers (bfd *, struct bfd_link_info *); /* ecoff_bfd_relax_section defined by backend. */ extern struct bfd_link_hash_table *_bfd_ecoff_bfd_link_hash_table_create (bfd *); -#define _bfd_ecoff_bfd_link_hash_table_free _bfd_generic_link_hash_table_free extern bfd_boolean _bfd_ecoff_bfd_link_add_symbols (bfd *, struct bfd_link_info *); #define _bfd_ecoff_bfd_link_just_syms _bfd_generic_link_just_syms diff --git a/bfd/mach-o-target.c b/bfd/mach-o-target.c index 36d0758f130..a070e677ebd 100644 --- a/bfd/mach-o-target.c +++ b/bfd/mach-o-target.c @@ -37,7 +37,6 @@ #define bfd_mach_o_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents #define bfd_mach_o_bfd_relax_section bfd_generic_relax_section #define bfd_mach_o_bfd_link_hash_table_create _bfd_generic_link_hash_table_create -#define bfd_mach_o_bfd_link_hash_table_free _bfd_generic_link_hash_table_free #define bfd_mach_o_bfd_link_add_symbols _bfd_generic_link_add_symbols #define bfd_mach_o_bfd_link_just_syms _bfd_generic_link_just_syms #define bfd_mach_o_bfd_copy_link_hash_symbol_type \ diff --git a/bfd/mmo.c b/bfd/mmo.c index f8eeae5298f..35d06f1d452 100644 --- a/bfd/mmo.c +++ b/bfd/mmo.c @@ -3223,7 +3223,6 @@ mmo_write_object_contents (bfd *abfd) #define mmo_bfd_gc_sections bfd_generic_gc_sections #define mmo_bfd_lookup_section_flags bfd_generic_lookup_section_flags #define mmo_bfd_link_hash_table_create _bfd_generic_link_hash_table_create -#define mmo_bfd_link_hash_table_free _bfd_generic_link_hash_table_free #define mmo_bfd_link_add_symbols _bfd_generic_link_add_symbols #define mmo_bfd_link_just_syms _bfd_generic_link_just_syms #define mmo_bfd_copy_link_hash_symbol_type \ diff --git a/bfd/nlm-target.h b/bfd/nlm-target.h index e55ddb6ed27..08fba07feb4 100644 --- a/bfd/nlm-target.h +++ b/bfd/nlm-target.h @@ -51,7 +51,6 @@ #define nlm_section_already_linked _bfd_generic_section_already_linked #define nlm_bfd_define_common_symbol bfd_generic_define_common_symbol #define nlm_bfd_link_hash_table_create _bfd_generic_link_hash_table_create -#define nlm_bfd_link_hash_table_free _bfd_generic_link_hash_table_free #define nlm_bfd_link_add_symbols _bfd_generic_link_add_symbols #define nlm_bfd_link_just_syms _bfd_generic_link_just_syms #define nlm_bfd_copy_link_hash_symbol_type \ diff --git a/bfd/oasys.c b/bfd/oasys.c index 74305d73c16..b4a97fe4bdc 100644 --- a/bfd/oasys.c +++ b/bfd/oasys.c @@ -1204,7 +1204,6 @@ oasys_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, #define oasys_section_already_linked _bfd_generic_section_already_linked #define oasys_bfd_define_common_symbol bfd_generic_define_common_symbol #define oasys_bfd_link_hash_table_create _bfd_generic_link_hash_table_create -#define oasys_bfd_link_hash_table_free _bfd_generic_link_hash_table_free #define oasys_bfd_link_add_symbols _bfd_generic_link_add_symbols #define oasys_bfd_link_just_syms _bfd_generic_link_just_syms #define oasys_bfd_copy_link_hash_symbol_type \ diff --git a/bfd/pef.c b/bfd/pef.c index f0b323388f2..4faabb49d18 100644 --- a/bfd/pef.c +++ b/bfd/pef.c @@ -58,7 +58,6 @@ #define bfd_pef_section_already_linked _bfd_generic_section_already_linked #define bfd_pef_bfd_define_common_symbol bfd_generic_define_common_symbol #define bfd_pef_bfd_link_hash_table_create _bfd_generic_link_hash_table_create -#define bfd_pef_bfd_link_hash_table_free _bfd_generic_link_hash_table_free #define bfd_pef_bfd_link_add_symbols _bfd_generic_link_add_symbols #define bfd_pef_bfd_link_just_syms _bfd_generic_link_just_syms #define bfd_pef_bfd_copy_link_hash_symbol_type \ diff --git a/bfd/plugin.c b/bfd/plugin.c index c3f28ede0c0..c9d53c89a61 100644 --- a/bfd/plugin.c +++ b/bfd/plugin.c @@ -92,7 +92,6 @@ dlerror (void) #define bfd_plugin_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents #define bfd_plugin_bfd_relax_section bfd_generic_relax_section #define bfd_plugin_bfd_link_hash_table_create _bfd_generic_link_hash_table_create -#define bfd_plugin_bfd_link_hash_table_free _bfd_generic_link_hash_table_free #define bfd_plugin_bfd_link_add_symbols _bfd_generic_link_add_symbols #define bfd_plugin_bfd_link_just_syms _bfd_generic_link_just_syms #define bfd_plugin_bfd_final_link _bfd_generic_final_link diff --git a/bfd/ppcboot.c b/bfd/ppcboot.c index 7b990797682..4814a4b1ea8 100644 --- a/bfd/ppcboot.c +++ b/bfd/ppcboot.c @@ -454,7 +454,6 @@ ppcboot_bfd_print_private_bfd_data (bfd *abfd, void * farg) _bfd_generic_section_already_linked #define ppcboot_bfd_define_common_symbol bfd_generic_define_common_symbol #define ppcboot_bfd_link_hash_table_create _bfd_generic_link_hash_table_create -#define ppcboot_bfd_link_hash_table_free _bfd_generic_link_hash_table_free #define ppcboot_bfd_link_add_symbols _bfd_generic_link_add_symbols #define ppcboot_bfd_link_just_syms _bfd_generic_link_just_syms #define ppcboot_bfd_copy_link_hash_symbol_type \ diff --git a/bfd/som.c b/bfd/som.c index b6143ae5e35..87f3288a45b 100644 --- a/bfd/som.c +++ b/bfd/som.c @@ -6732,7 +6732,6 @@ som_bfd_link_split_section (bfd *abfd ATTRIBUTE_UNUSED, asection *sec) #define som_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents #define som_bfd_relax_section bfd_generic_relax_section #define som_bfd_link_hash_table_create _bfd_generic_link_hash_table_create -#define som_bfd_link_hash_table_free _bfd_generic_link_hash_table_free #define som_bfd_link_add_symbols _bfd_generic_link_add_symbols #define som_bfd_link_just_syms _bfd_generic_link_just_syms #define som_bfd_copy_link_hash_symbol_type \ diff --git a/bfd/srec.c b/bfd/srec.c index 1045d9918fe..f11e74a0295 100644 --- a/bfd/srec.c +++ b/bfd/srec.c @@ -1258,7 +1258,6 @@ srec_print_symbol (bfd *abfd, #define srec_section_already_linked _bfd_generic_section_already_linked #define srec_bfd_define_common_symbol bfd_generic_define_common_symbol #define srec_bfd_link_hash_table_create _bfd_generic_link_hash_table_create -#define srec_bfd_link_hash_table_free _bfd_generic_link_hash_table_free #define srec_bfd_link_add_symbols _bfd_generic_link_add_symbols #define srec_bfd_link_just_syms _bfd_generic_link_just_syms #define srec_bfd_copy_link_hash_symbol_type \ diff --git a/bfd/targets.c b/bfd/targets.c index be5d11a75d6..0860dc5bb28 100644 --- a/bfd/targets.c +++ b/bfd/targets.c @@ -446,7 +446,6 @@ BFD_JUMP_TABLE macros. . NAME##_bfd_get_relocated_section_contents, \ . NAME##_bfd_relax_section, \ . NAME##_bfd_link_hash_table_create, \ -. NAME##_bfd_link_hash_table_free, \ . NAME##_bfd_link_add_symbols, \ . NAME##_bfd_link_just_syms, \ . NAME##_bfd_copy_link_hash_symbol_type, \ @@ -473,9 +472,6 @@ BFD_JUMP_TABLE macros. . struct bfd_link_hash_table * . (*_bfd_link_hash_table_create) (bfd *); . -. {* Release the memory associated with the linker hash table. *} -. void (*_bfd_link_hash_table_free) (struct bfd_link_hash_table *); -. . {* Add symbols from this object file into the hash table. *} . bfd_boolean (*_bfd_link_add_symbols) (bfd *, struct bfd_link_info *); . diff --git a/bfd/tekhex.c b/bfd/tekhex.c index 7fcab936da2..e5f6547589b 100644 --- a/bfd/tekhex.c +++ b/bfd/tekhex.c @@ -949,7 +949,6 @@ tekhex_print_symbol (bfd *abfd, #define tekhex_section_already_linked _bfd_generic_section_already_linked #define tekhex_bfd_define_common_symbol bfd_generic_define_common_symbol #define tekhex_bfd_link_hash_table_create _bfd_generic_link_hash_table_create -#define tekhex_bfd_link_hash_table_free _bfd_generic_link_hash_table_free #define tekhex_bfd_link_add_symbols _bfd_generic_link_add_symbols #define tekhex_bfd_link_just_syms _bfd_generic_link_just_syms #define tekhex_bfd_copy_link_hash_symbol_type \ diff --git a/bfd/verilog.c b/bfd/verilog.c index 276e7fc7564..c1c5458f125 100644 --- a/bfd/verilog.c +++ b/bfd/verilog.c @@ -311,7 +311,6 @@ verilog_mkobject (bfd *abfd) #define verilog_bfd_discard_group bfd_generic_discard_group #define verilog_section_already_linked _bfd_generic_section_already_linked #define verilog_bfd_link_hash_table_create _bfd_generic_link_hash_table_create -#define verilog_bfd_link_hash_table_free _bfd_generic_link_hash_table_free #define verilog_bfd_link_add_symbols _bfd_generic_link_add_symbols #define verilog_bfd_link_just_syms _bfd_generic_link_just_syms #define verilog_bfd_final_link _bfd_generic_final_link diff --git a/bfd/versados.c b/bfd/versados.c index 2d49458566a..b02f31ab2ab 100644 --- a/bfd/versados.c +++ b/bfd/versados.c @@ -812,7 +812,6 @@ versados_canonicalize_reloc (bfd *abfd, #define versados_section_already_linked _bfd_generic_section_already_linked #define versados_bfd_define_common_symbol bfd_generic_define_common_symbol #define versados_bfd_link_hash_table_create _bfd_generic_link_hash_table_create -#define versados_bfd_link_hash_table_free _bfd_generic_link_hash_table_free #define versados_bfd_link_add_symbols _bfd_generic_link_add_symbols #define versados_bfd_link_just_syms _bfd_generic_link_just_syms #define versados_bfd_copy_link_hash_symbol_type \ diff --git a/bfd/vms-alpha.c b/bfd/vms-alpha.c index 66a1999efe3..f62d324630e 100644 --- a/bfd/vms-alpha.c +++ b/bfd/vms-alpha.c @@ -9239,7 +9239,6 @@ bfd_vms_get_data (bfd *abfd) _bfd_generic_section_already_linked #define alpha_vms_bfd_define_common_symbol bfd_generic_define_common_symbol -#define alpha_vms_bfd_link_hash_table_free _bfd_generic_link_hash_table_free #define alpha_vms_bfd_link_just_syms _bfd_generic_link_just_syms #define alpha_vms_bfd_copy_link_hash_symbol_type \ _bfd_generic_copy_link_hash_symbol_type diff --git a/bfd/xsym.c b/bfd/xsym.c index 194511373b6..58b23198e08 100644 --- a/bfd/xsym.c +++ b/bfd/xsym.c @@ -50,7 +50,6 @@ #define bfd_sym_section_already_linked _bfd_generic_section_already_linked #define bfd_sym_bfd_define_common_symbol bfd_generic_define_common_symbol #define bfd_sym_bfd_link_hash_table_create _bfd_generic_link_hash_table_create -#define bfd_sym_bfd_link_hash_table_free _bfd_generic_link_hash_table_free #define bfd_sym_bfd_link_add_symbols _bfd_generic_link_add_symbols #define bfd_sym_bfd_link_just_syms _bfd_generic_link_just_syms #define bfd_sym_bfd_copy_link_hash_symbol_type \ diff --git a/ld/ChangeLog b/ld/ChangeLog index e1abf43b733..783c4bdeff8 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,10 @@ +2014-06-13 Alan Modra + + PR 17047 + * ldlang.c (output_bfd_hash_table_free_fn): Delete. + (open_output): Don't set it.. + * ldmain.c (ld_cleanup): ..or call it. + 2014-06-13 Alan Modra * emultempl/cr16elf.em, * emultempl/elf32.em, * emultempl/genelf.em, diff --git a/ld/ldlang.c b/ld/ldlang.c index add86dadbd7..e7c96696993 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -3072,9 +3072,6 @@ lang_get_output_target (void) return default_target; } -/* Stashed function to free link_info.hash; see open_output. */ -void (*output_bfd_hash_table_free_fn) (struct bfd_link_hash_table *); - /* Open the output file. */ static void @@ -3154,18 +3151,6 @@ open_output (const char *name) if (link_info.hash == NULL) einfo (_("%P%F: can not create hash table: %E\n")); - /* We want to please memory leak checkers by deleting link_info.hash. - We can't do it in lang_finish, as a bfd target may hold references to - symbols in this table and use them when their _bfd_write_contents - function is invoked, as part of bfd_close on the output_bfd. But, - output_bfd is deallocated at bfd_close, so we can't refer to - output_bfd after that time, and dereferencing it is needed to call - "bfd_link_hash_table_free". Smash this dependency deadlock and grab - the function pointer; arrange to call it on link_info.hash in - ld_cleanup. */ - output_bfd_hash_table_free_fn - = link_info.output_bfd->xvec->_bfd_link_hash_table_free; - bfd_set_gp_size (link_info.output_bfd, g_switch_value); } diff --git a/ld/ldmain.c b/ld/ldmain.c index d4be6f0e2ef..ea25afe4f44 100644 --- a/ld/ldmain.c +++ b/ld/ldmain.c @@ -171,10 +171,6 @@ ld_cleanup (void) #endif if (output_filename && delete_output_file_on_failure) unlink_if_ordinary (output_filename); - - /* See open_output in ldlang.c. */ - if (output_bfd_hash_table_free_fn != NULL) - (*output_bfd_hash_table_free_fn) (link_info.hash); } /* If there's a BFD assertion, we'll notice and exit with an error -- 2.30.2