OSDN Git Service

2002-04-04 Daniel Jacobowitz <drow@mvista.com>
authorDaniel Jacobowitz <dan@debian.org>
Thu, 4 Apr 2002 19:53:38 +0000 (19:53 +0000)
committerDaniel Jacobowitz <dan@debian.org>
Thu, 4 Apr 2002 19:53:38 +0000 (19:53 +0000)
* aout-adobe.c (aout_32_bfd_link_hash_table_free): Define.
* aout-target.h (MY_bfd_link_hash_table_free): Conditionally
define.
* aout-tic30.c (MY_bfd_link_hash_table_free): Likewise.
* bfd.c (bfd_link_hash_table_free): Define.
* binary.c (binary_bfd_link_hash_table_free): Define.
* bout.c (b_out_bfd_link_hash_table_free): Define.
* coff-rs6000.c (rs6000coff_vec): Include
_bfd_generic_link_hash_table_free.
(pmac_xcoff_vec): Likewise.
* coff64-rs6000.c (rs6000coff64_vec): Likewise.
(aix5coff64_vec): Likewise.
* coffcode.h (coff_bfd_link_hash_table_free): Conditionally define.
* elf-m10300.c (elf32_mn10300_link_hash_table_free): New function.
(bfd_elf32_bfd_link_hash_table_free): Define.
* elf32-hppa.c (elf32_hppa_link_hash_table_free): New function.
(bfd_elf32_bfd_link_hash_table_free): Define.
* elfxx-target.h (bfd_elfNN_bfd_link_hash_table_free): Conditionally
define.
* i386msdos.c (msdos_bfd_link_hash_table_free): Define.
* i386os9k.c (os9k_bfd_link_hash_table_free): Define.
* ieee.c (ieee_bfd_link_hash_table_free): Define.
* ihex.c (ihex_bfd_link_hash_table_free): Define.
* libbfd-in.h (_bfd_nolink_bfd_link_hash_table_free): Define.
(_bfd_generic_link_hash_table_free): Add prototype.
* libcoff-in.h (_bfd_xcoff_bfd_link_hash_table_free): Add prototype.
* libecoff.h (_bfd_ecoff_bfd_link_hash_table_free): Define.
* linker.c (_bfd_generic_link_hash_table_free): New function.
* mmo.c (mmo_bfd_link_hash_table_free): Define.
* nlm-target.h (nlm_bfd_link_hash_table_free): Define.
* oasys.c (oasys_bfd_link_hash_table_free): Define.
* ppcboot.c (ppcboot_bfd_link_hash_table_free): Define.
* som.c (som_bfd_link_hash_table_free): Define.
* srec.c (srec_bfd_link_hash_table_free): Define.
* tekhex.c (tekhex_bfd_link_hash_table_free): Define.
* versados.c (versados_bfd_link_hash_table_free): Define.
* vms.c (vms_bfd_link_hash_table_free): New function.
* xcofflink.c (_bfd_xcoff_bfd_link_hash_table_free): New function.

* coff-arm.c (coff_arm_link_hash_table_create): Use bfd_malloc
instead of bfd_alloc.
* coff-h8300.c (h8300_coff_link_hash_table_create): Likewise.
* coff-mcore.c (coff_mcore_link_hash_table_create): Likewise.
* coff-ppc.c (ppc_coff_link_hash_table_create): Likewise.
* cofflink.c (_bfd_coff_link_hash_table_create): Likewise.
* ecoff.c (_bfd_ecoff_bfd_link_hash_table_create): Likewise.
* elf-m10300.c (elf32_mn10300_link_hash_table_create): Likewise.
* elf.c (_bfd_elf_link_hash_table_create): Likewise.
* elf32-arm.h (elf32_arm_link_hash_table_create): Likewise.
* elf32-cris.c (elf_cris_link_hash_table_create): Likewise.
* elf32-hppa.c (elf32_hppa_link_hash_table_create): Likewise.
* elf32-i386.c (elf_i386_link_hash_table_create): Likewise.
* elf32-m68k.c (elf_m68k_link_hash_table_create): Likewise.
* elf32-s390.c (elf_s390_link_hash_table_create): Likewise.
* elf32-sh.c (sh_elf_link_hash_table_create): Likewise.
* elf64-alpha.c (elf64_alpha_bfd_link_hash_table_create): Likewise.
* elf64-ppc.c (ppc64_elf_link_hash_table_create): Likewise.
* elf64-s390.c (elf_s390_link_hash_table_create): Likewise.
* elf64-sh64.c (sh64_elf64_link_hash_table_create): Likewise.
* elf64-sparc.c (sparc64_elf_bfd_link_hash_table_create): Likewise.
* elf64-x86-64.c (elf64_x86_64_link_hash_table_create): Likewise.
* elfxx-mips.c (_bfd_mips_elf_link_hash_table_create): Likewise.
* linker.c (_bfd_generic_link_hash_table_create): Likewise.
* m68klinux.c (linux_link_hash_table_create): Likewise.
* sparclinux.c (linux_link_hash_table_create): Likewise.
* sunos.c (sunos_link_hash_table_create): Likewise.
* xcofflink.c (_bfd_xcoff_bfd_link_hash_table_create): Likewise.

* targets.c: Add _bfd_link_hash_table_free to xvec.

* bfd-in2.h: Regenerate.
* libbfd.h: Regenerate.
* libcoff.h: Regenerate.

58 files changed:
bfd/ChangeLog
bfd/aout-adobe.c
bfd/aout-target.h
bfd/aout-tic30.c
bfd/bfd-in2.h
bfd/bfd.c
bfd/binary.c
bfd/bout.c
bfd/coff-arm.c
bfd/coff-h8300.c
bfd/coff-mcore.c
bfd/coff-ppc.c
bfd/coff-rs6000.c
bfd/coff64-rs6000.c
bfd/coffcode.h
bfd/cofflink.c
bfd/ecoff.c
bfd/elf-m10300.c
bfd/elf.c
bfd/elf32-arm.h
bfd/elf32-cris.c
bfd/elf32-hppa.c
bfd/elf32-i386.c
bfd/elf32-m68k.c
bfd/elf32-s390.c
bfd/elf32-sh.c
bfd/elf64-alpha.c
bfd/elf64-ppc.c
bfd/elf64-s390.c
bfd/elf64-sh64.c
bfd/elf64-sparc.c
bfd/elf64-x86-64.c
bfd/elfxx-mips.c
bfd/elfxx-target.h
bfd/i386msdos.c
bfd/i386os9k.c
bfd/ieee.c
bfd/ihex.c
bfd/libbfd-in.h
bfd/libbfd.h
bfd/libcoff-in.h
bfd/libcoff.h
bfd/libecoff.h
bfd/linker.c
bfd/m68klinux.c
bfd/mmo.c
bfd/nlm-target.h
bfd/oasys.c
bfd/ppcboot.c
bfd/som.c
bfd/sparclinux.c
bfd/srec.c
bfd/sunos.c
bfd/targets.c
bfd/tekhex.c
bfd/versados.c
bfd/vms.c
bfd/xcofflink.c

index 6a05b0e..dc9840e 100644 (file)
@@ -1,3 +1,79 @@
+2002-04-04  Daniel Jacobowitz  <drow@mvista.com>
+
+       * aout-adobe.c (aout_32_bfd_link_hash_table_free): Define.
+       * aout-target.h (MY_bfd_link_hash_table_free): Conditionally
+       define.
+       * aout-tic30.c (MY_bfd_link_hash_table_free): Likewise.
+       * bfd.c (bfd_link_hash_table_free): Define.
+       * binary.c (binary_bfd_link_hash_table_free): Define.
+       * bout.c (b_out_bfd_link_hash_table_free): Define.
+       * coff-rs6000.c (rs6000coff_vec): Include
+       _bfd_generic_link_hash_table_free.
+       (pmac_xcoff_vec): Likewise.
+       * coff64-rs6000.c (rs6000coff64_vec): Likewise.
+       (aix5coff64_vec): Likewise.
+       * coffcode.h (coff_bfd_link_hash_table_free): Conditionally define.
+       * elf-m10300.c (elf32_mn10300_link_hash_table_free): New function.
+       (bfd_elf32_bfd_link_hash_table_free): Define.
+       * elf32-hppa.c (elf32_hppa_link_hash_table_free): New function.
+       (bfd_elf32_bfd_link_hash_table_free): Define.
+       * elfxx-target.h (bfd_elfNN_bfd_link_hash_table_free): Conditionally
+       define.
+       * i386msdos.c (msdos_bfd_link_hash_table_free): Define.
+       * i386os9k.c (os9k_bfd_link_hash_table_free): Define.
+       * ieee.c (ieee_bfd_link_hash_table_free): Define.
+       * ihex.c (ihex_bfd_link_hash_table_free): Define.
+       * libbfd-in.h (_bfd_nolink_bfd_link_hash_table_free): Define.
+       (_bfd_generic_link_hash_table_free): Add prototype.
+       * libcoff-in.h (_bfd_xcoff_bfd_link_hash_table_free): Add prototype.
+       * libecoff.h (_bfd_ecoff_bfd_link_hash_table_free): Define.
+       * linker.c (_bfd_generic_link_hash_table_free): New function.
+       * mmo.c (mmo_bfd_link_hash_table_free): Define.
+       * nlm-target.h (nlm_bfd_link_hash_table_free): Define.
+       * oasys.c (oasys_bfd_link_hash_table_free): Define.
+       * ppcboot.c (ppcboot_bfd_link_hash_table_free): Define.
+       * som.c (som_bfd_link_hash_table_free): Define.
+       * srec.c (srec_bfd_link_hash_table_free): Define.
+       * tekhex.c (tekhex_bfd_link_hash_table_free): Define.
+       * versados.c (versados_bfd_link_hash_table_free): Define.
+       * vms.c (vms_bfd_link_hash_table_free): New function.
+       * xcofflink.c (_bfd_xcoff_bfd_link_hash_table_free): New function.
+
+       * coff-arm.c (coff_arm_link_hash_table_create): Use bfd_malloc
+       instead of bfd_alloc.
+       * coff-h8300.c (h8300_coff_link_hash_table_create): Likewise.
+       * coff-mcore.c (coff_mcore_link_hash_table_create): Likewise.
+       * coff-ppc.c (ppc_coff_link_hash_table_create): Likewise.
+       * cofflink.c (_bfd_coff_link_hash_table_create): Likewise.
+       * ecoff.c (_bfd_ecoff_bfd_link_hash_table_create): Likewise.
+       * elf-m10300.c (elf32_mn10300_link_hash_table_create): Likewise.
+       * elf.c (_bfd_elf_link_hash_table_create): Likewise.
+       * elf32-arm.h (elf32_arm_link_hash_table_create): Likewise.
+       * elf32-cris.c (elf_cris_link_hash_table_create): Likewise.
+       * elf32-hppa.c (elf32_hppa_link_hash_table_create): Likewise.
+       * elf32-i386.c (elf_i386_link_hash_table_create): Likewise.
+       * elf32-m68k.c (elf_m68k_link_hash_table_create): Likewise.
+       * elf32-s390.c (elf_s390_link_hash_table_create): Likewise.
+       * elf32-sh.c (sh_elf_link_hash_table_create): Likewise.
+       * elf64-alpha.c (elf64_alpha_bfd_link_hash_table_create): Likewise.
+       * elf64-ppc.c (ppc64_elf_link_hash_table_create): Likewise.
+       * elf64-s390.c (elf_s390_link_hash_table_create): Likewise.
+       * elf64-sh64.c (sh64_elf64_link_hash_table_create): Likewise.
+       * elf64-sparc.c (sparc64_elf_bfd_link_hash_table_create): Likewise.
+       * elf64-x86-64.c (elf64_x86_64_link_hash_table_create): Likewise.
+       * elfxx-mips.c (_bfd_mips_elf_link_hash_table_create): Likewise.
+       * linker.c (_bfd_generic_link_hash_table_create): Likewise.
+       * m68klinux.c (linux_link_hash_table_create): Likewise.
+       * sparclinux.c (linux_link_hash_table_create): Likewise.
+       * sunos.c (sunos_link_hash_table_create): Likewise.
+       * xcofflink.c (_bfd_xcoff_bfd_link_hash_table_create): Likewise.
+
+       * targets.c: Add _bfd_link_hash_table_free to xvec.
+
+       * bfd-in2.h: Regenerate.
+       * libbfd.h: Regenerate.
+       * libcoff.h: Regenerate.
+
 2002-04-04  Alan Modra  <amodra@bigpond.net.au>
 
        * dep-in.sed: Cope with absolute paths.
index 72fed35..01f2691 100644 (file)
@@ -1,5 +1,6 @@
 /* BFD back-end for a.out.adobe binaries.
-   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
+   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+   2002
    Free Software Foundation, Inc.
    Written by Cygnus Support.  Based on bout.c.
 
@@ -511,6 +512,8 @@ aout_adobe_sizeof_headers (ignore_abfd, ignore)
 #define aout_32_bfd_merge_sections     bfd_generic_merge_sections
 #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_final_link         _bfd_generic_final_link
 #define aout_32_bfd_link_split_section _bfd_generic_link_split_section
index ccedb93..30c735a 100644 (file)
@@ -1,6 +1,6 @@
 /* Define a target vector and some small routines for a variant of a.out.
    Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2000, 2001
+   2000, 2001, 2002
    Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -528,6 +528,9 @@ MY_bfd_final_link (abfd, 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
index e3c74fa..58ef3ea 100644 (file)
@@ -1,5 +1,5 @@
 /* BFD back-end for TMS320C30 a.out binaries.
-   Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+   Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
    Contributed by Steven Haworth (steve@pm.cse.rmit.edu.au)
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -980,6 +980,9 @@ tic30_aout_set_arch_mach (abfd, arch, machine)
 #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
index c62e5a0..49a1aed 100644 (file)
@@ -3501,6 +3501,9 @@ bfd_set_private_flags PARAMS ((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))
 
@@ -3826,6 +3829,7 @@ CONCAT2 (NAME,_sizeof_headers), \
 CONCAT2 (NAME,_bfd_get_relocated_section_contents), \
 CONCAT2 (NAME,_bfd_relax_section), \
 CONCAT2 (NAME,_bfd_link_hash_table_create), \
+CONCAT2 (NAME,_bfd_link_hash_table_free), \
 CONCAT2 (NAME,_bfd_link_add_symbols), \
 CONCAT2 (NAME,_bfd_final_link), \
 CONCAT2 (NAME,_bfd_link_split_section), \
@@ -3843,6 +3847,9 @@ CONCAT2 (NAME,_bfd_merge_sections)
      different information in this table.  */
   struct bfd_link_hash_table *(*_bfd_link_hash_table_create) PARAMS ((bfd *));
 
+  /* Release the memory associated with the linker hash table.  */
+  void (*_bfd_link_hash_table_free) PARAMS ((struct bfd_link_hash_table *));
+
   /* Add symbols from this object file into the hash table.  */
   boolean  (*_bfd_link_add_symbols) PARAMS ((bfd *, struct bfd_link_info *));
 
index 5795383..c1135c8 100644 (file)
--- a/bfd/bfd.c
+++ b/bfd/bfd.c
@@ -1189,6 +1189,9 @@ 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))
 .
index 705ac8f..3207e89 100644 (file)
@@ -1,5 +1,5 @@
 /* BFD back-end for binary objects.
-   Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+   Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
    Free Software Foundation, Inc.
    Written by Ian Lance Taylor, Cygnus Support, <ian@cygnus.com>
 
@@ -338,6 +338,7 @@ binary_sizeof_headers (abfd, exec)
 #define binary_bfd_gc_sections bfd_generic_gc_sections
 #define binary_bfd_merge_sections bfd_generic_merge_sections
 #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_add_symbols _bfd_generic_link_add_symbols
 #define binary_bfd_final_link _bfd_generic_final_link
 #define binary_bfd_link_split_section _bfd_generic_link_split_section
index 13e4f04..0e070ad 100644 (file)
@@ -1,6 +1,6 @@
 /* BFD back-end for Intel 960 b.out binaries.
    Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2000, 2001
+   2000, 2001, 2002
    Free Software Foundation, Inc.
    Written by Cygnus Support.
 
@@ -1449,6 +1449,7 @@ b_out_bfd_get_relocated_section_contents (output_bfd, link_info, link_order,
 #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_final_link _bfd_generic_final_link
 #define b_out_bfd_link_split_section  _bfd_generic_link_split_section
index 798cd49..049d144 100644 (file)
@@ -939,14 +939,14 @@ coff_arm_link_hash_table_create (abfd)
   struct coff_arm_link_hash_table * ret;
   bfd_size_type amt = sizeof (struct coff_arm_link_hash_table);
 
-  ret = (struct coff_arm_link_hash_table *) bfd_alloc (abfd, amt);
+  ret = (struct coff_arm_link_hash_table *) bfd_malloc (amt);
   if (ret == (struct coff_arm_link_hash_table *) NULL)
     return NULL;
 
   if (! _bfd_coff_link_hash_table_init
       (& ret->root, abfd, _bfd_coff_link_hash_newfunc))
     {
-      bfd_release (abfd, ret);
+      free (ret);
       return (struct bfd_link_hash_table *) NULL;
     }
 
index 7ce4208..82b7bca 100644 (file)
@@ -1,6 +1,6 @@
 /* BFD back-end for Hitachi H8/300 COFF binaries.
    Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2000, 2001
+   2000, 2001, 2002
    Free Software Foundation, Inc.
    Written by Steve Chamberlain, <sac@cygnus.com>.
 
@@ -186,13 +186,13 @@ h8300_coff_link_hash_table_create (abfd)
   struct h8300_coff_link_hash_table *ret;
   bfd_size_type amt = sizeof (struct h8300_coff_link_hash_table);
 
-  ret = (struct h8300_coff_link_hash_table *) bfd_alloc (abfd, amt);
+  ret = (struct h8300_coff_link_hash_table *) bfd_malloc (amt);
   if (ret == NULL)
     return NULL;
   if (!_bfd_link_hash_table_init (&ret->root.root, abfd,
                                  _bfd_generic_link_hash_newfunc))
     {
-      bfd_release (abfd, ret);
+      free (ret);
       return NULL;
     }
 
index 9603e02..f15102d 100644 (file)
@@ -1,5 +1,5 @@
 /* BFD back-end for Motorola MCore COFF/PE
-   Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
+   Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
 
@@ -229,14 +229,14 @@ coff_mcore_link_hash_table_create (abfd)
 {
   mcore_hash_table * ret;
 
-  ret = (mcore_hash_table *) bfd_alloc (abfd, (bfd_size_type) sizeof (* ret));
+  ret = (mcore_hash_table *) bfd_malloc ((bfd_size_type) sizeof (* ret));
   if (ret == (mcore_hash_table *) NULL)
     return NULL;
 
   if (! _bfd_coff_link_hash_table_init
       (& ret->root, abfd, _bfd_coff_link_hash_newfunc))
     {
-      bfd_release (abfd, ret);
+      free (ret);
       return (struct bfd_link_hash_table *) NULL;
     }
 
index f2bdfe5..4f8b15e 100644 (file)
@@ -1,6 +1,6 @@
 /* BFD back-end for PowerPC Microsoft Portable Executable files.
    Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2000, 2001
+   2000, 2001, 2002
    Free Software Foundation, Inc.
 
    Original version pieced together by Kim Knuttila (krk@cygnus.com)
@@ -204,13 +204,13 @@ ppc_coff_link_hash_table_create (abfd)
   struct ppc_coff_link_hash_table *ret;
   bfd_size_type amt = sizeof (struct ppc_coff_link_hash_table);
 
-  ret = (struct ppc_coff_link_hash_table *) bfd_alloc (abfd, amt);
+  ret = (struct ppc_coff_link_hash_table *) bfd_malloc (amt);
   if (ret == NULL)
     return NULL;
   if (! ppc_coff_link_hash_table_init (ret, abfd,
                                        ppc_coff_link_hash_newfunc))
     {
-      bfd_release (abfd, ret);
+      free (ret);
       return (struct bfd_link_hash_table *) NULL;
     }
   return &ret->root.root;
index 75d77ab..066d020 100644 (file)
@@ -3677,6 +3677,7 @@ const bfd_target rs6000coff_vec =
   bfd_generic_get_relocated_section_contents,
   bfd_generic_relax_section,               /* _bfd_relax_section */
   _bfd_xcoff_bfd_link_hash_table_create,   /* _bfd_link_hash_table_create */
+  _bfd_generic_link_hash_table_free,       /* _bfd_link_hash_table_free */
   _bfd_xcoff_bfd_link_add_symbols,         /* _bfd_link_add_symbols */
   _bfd_xcoff_bfd_final_link,               /* _bfd_filnal_link */
   _bfd_generic_link_split_section,         /* _bfd_link_split_section */
@@ -3937,6 +3938,7 @@ const bfd_target pmac_xcoff_vec =
   bfd_generic_get_relocated_section_contents,
   bfd_generic_relax_section,               /* _bfd_relax_section */
   _bfd_xcoff_bfd_link_hash_table_create,   /* _bfd_link_hash_table_create */
+  _bfd_generic_link_hash_table_free,       /* _bfd_link_hash_table_free */
   _bfd_xcoff_bfd_link_add_symbols,         /* _bfd_link_add_symbols */
   _bfd_xcoff_bfd_final_link,               /* _bfd_filnal_link */
   _bfd_generic_link_split_section,         /* _bfd_link_split_section */
index 9398163..09a1abe 100644 (file)
@@ -2712,6 +2712,7 @@ const bfd_target rs6000coff64_vec =
   bfd_generic_get_relocated_section_contents,
   bfd_generic_relax_section,           /* _bfd_relax_section */
   _bfd_xcoff_bfd_link_hash_table_create,/* _bfd_link_hash_table_create */
+  _bfd_generic_link_hash_table_free,    /* _bfd_link_hash_table_free */
   _bfd_xcoff_bfd_link_add_symbols,     /* _bfd_link_add_symbols */
   _bfd_xcoff_bfd_final_link,           /* _bfd_filnal_link */
   _bfd_generic_link_split_section,     /* _bfd_link_split_section */
@@ -2963,6 +2964,7 @@ const bfd_target aix5coff64_vec =
   bfd_generic_get_relocated_section_contents,
   bfd_generic_relax_section,           /* _bfd_relax_section */
   _bfd_xcoff_bfd_link_hash_table_create,/* _bfd_link_hash_table_create */
+  _bfd_generic_link_hash_table_free,    /* _bfd_link_hash_table_free */
   _bfd_xcoff_bfd_link_add_symbols,     /* _bfd_link_add_symbols */
   _bfd_xcoff_bfd_final_link,           /* _bfd_filnal_link */
   _bfd_generic_link_split_section,     /* _bfd_link_split_section */
index db42987..010ed33 100644 (file)
@@ -5043,6 +5043,10 @@ dummy_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr,
 }
 #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.  */
 #ifdef coff_relocate_section
index 8a80c14..1eac3c5 100644 (file)
@@ -119,13 +119,13 @@ _bfd_coff_link_hash_table_create (abfd)
   struct coff_link_hash_table *ret;
   bfd_size_type amt = sizeof (struct coff_link_hash_table);
 
-  ret = (struct coff_link_hash_table *) bfd_alloc (abfd, amt);
+  ret = (struct coff_link_hash_table *) bfd_malloc (amt);
   if (ret == NULL)
     return NULL;
   if (! _bfd_coff_link_hash_table_init (ret, abfd,
                                        _bfd_coff_link_hash_newfunc))
     {
-      bfd_release (abfd, ret);
+      free (ret);
       return (struct bfd_link_hash_table *) NULL;
     }
   return &ret->root;
index 70224cb..c7230f6 100644 (file)
@@ -3452,7 +3452,7 @@ _bfd_ecoff_bfd_link_hash_table_create (abfd)
   struct ecoff_link_hash_table *ret;
   bfd_size_type amt = sizeof (struct ecoff_link_hash_table);
 
-  ret = (struct ecoff_link_hash_table *) bfd_alloc (abfd, amt);
+  ret = (struct ecoff_link_hash_table *) bfd_malloc (amt);
   if (ret == NULL)
     return NULL;
   if (! _bfd_link_hash_table_init (&ret->root, abfd,
index a80060a..ce68a16 100644 (file)
@@ -111,6 +111,8 @@ static struct bfd_hash_entry *elf32_mn10300_link_hash_newfunc
   PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
 static struct bfd_link_hash_table *elf32_mn10300_link_hash_table_create
   PARAMS ((bfd *));
+static void elf32_mn10300_link_hash_table_free
+  PARAMS ((struct bfd_link_hash_table *));
 
 static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup
   PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
@@ -2969,37 +2971,52 @@ elf32_mn10300_link_hash_table_create (abfd)
   struct elf32_mn10300_link_hash_table *ret;
   bfd_size_type amt = sizeof (struct elf32_mn10300_link_hash_table);
 
-  ret = (struct elf32_mn10300_link_hash_table *) bfd_alloc (abfd, amt);
+  ret = (struct elf32_mn10300_link_hash_table *) bfd_malloc (amt);
   if (ret == (struct elf32_mn10300_link_hash_table *) NULL)
     return NULL;
 
   if (! _bfd_elf_link_hash_table_init (&ret->root, abfd,
                                       elf32_mn10300_link_hash_newfunc))
     {
-      bfd_release (abfd, ret);
+      free (ret);
       return NULL;
     }
 
   ret->flags = 0;
   amt = sizeof (struct elf_link_hash_table);
   ret->static_hash_table
-    = (struct elf32_mn10300_link_hash_table *) bfd_alloc (abfd, amt);
+    = (struct elf32_mn10300_link_hash_table *) bfd_malloc (amt);
   if (ret->static_hash_table == NULL)
     {
-      bfd_release (abfd, ret);
+      free (ret);
       return NULL;
     }
 
   if (! _bfd_elf_link_hash_table_init (&ret->static_hash_table->root, abfd,
                                       elf32_mn10300_link_hash_newfunc))
     {
-      bfd_release (abfd, ret->static_hash_table);
-      bfd_release (abfd, ret);
+      free (ret->static_hash_table);
+      free (ret);
       return NULL;
     }
   return &ret->root.root;
 }
 
+/* Free an mn10300 ELF linker hash table.  */
+
+static void
+elf32_mn10300_link_hash_table_free (hash)
+     struct bfd_link_hash_table *hash;
+{
+  struct elf32_mn10300_link_hash_table *ret
+    = (struct elf32_mn10300_link_hash_table *) hash;
+
+  _bfd_generic_link_hash_table_free
+    ((struct bfd_link_hash_table *) ret->static_hash_table);
+  _bfd_generic_link_hash_table_free
+    ((struct bfd_link_hash_table *) ret);
+}
+
 static unsigned long
 elf_mn10300_mach (flags)
      flagword flags;
@@ -3092,6 +3109,8 @@ _bfd_mn10300_elf_merge_private_bfd_data (ibfd, obfd)
                                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
 
 #define elf_symbol_leading_char '_'
 
index 67d9add..379eb08 100644 (file)
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -1360,13 +1360,13 @@ _bfd_elf_link_hash_table_create (abfd)
   struct elf_link_hash_table *ret;
   bfd_size_type amt = sizeof (struct elf_link_hash_table);
 
-  ret = (struct elf_link_hash_table *) bfd_alloc (abfd, amt);
+  ret = (struct elf_link_hash_table *) bfd_malloc (amt);
   if (ret == (struct elf_link_hash_table *) NULL)
     return NULL;
 
   if (! _bfd_elf_link_hash_table_init (ret, abfd, _bfd_elf_link_hash_newfunc))
     {
-      bfd_release (abfd, ret);
+      free (ret);
       return NULL;
     }
 
index d420e5b..217666f 100644 (file)
@@ -236,14 +236,14 @@ elf32_arm_link_hash_table_create (abfd)
   struct elf32_arm_link_hash_table *ret;
   bfd_size_type amt = sizeof (struct elf32_arm_link_hash_table);
 
-  ret = (struct elf32_arm_link_hash_table *) bfd_alloc (abfd, amt);
+  ret = (struct elf32_arm_link_hash_table *) bfd_malloc (amt);
   if (ret == (struct elf32_arm_link_hash_table *) NULL)
     return NULL;
 
   if (!_bfd_elf_link_hash_table_init (&ret->root, abfd,
                                      elf32_arm_link_hash_newfunc))
     {
-      bfd_release (abfd, ret);
+      free (ret);
       return NULL;
     }
 
index 30570ee..2348cd4 100644 (file)
@@ -710,14 +710,14 @@ elf_cris_link_hash_table_create (abfd)
   struct elf_cris_link_hash_table *ret;
   bfd_size_type amt = sizeof (struct elf_cris_link_hash_table);
 
-  ret = ((struct elf_cris_link_hash_table *) bfd_alloc (abfd, amt));
+  ret = ((struct elf_cris_link_hash_table *) bfd_malloc (amt));
   if (ret == (struct elf_cris_link_hash_table *) NULL)
     return NULL;
 
   if (! _bfd_elf_link_hash_table_init (&ret->root, abfd,
                                       elf_cris_link_hash_newfunc))
     {
-      bfd_release (abfd, ret);
+      free (ret);
       return NULL;
     }
 
index a8d0a44..1b03886 100644 (file)
@@ -284,6 +284,9 @@ static struct bfd_hash_entry *hppa_link_hash_newfunc
 static struct bfd_link_hash_table *elf32_hppa_link_hash_table_create
   PARAMS ((bfd *));
 
+static void elf32_hppa_link_hash_table_free
+  PARAMS ((struct bfd_link_hash_table *));
+
 /* Stub handling functions.  */
 static char *hppa_stub_name
   PARAMS ((const asection *, const asection *,
@@ -479,13 +482,13 @@ elf32_hppa_link_hash_table_create (abfd)
   struct elf32_hppa_link_hash_table *ret;
   bfd_size_type amt = sizeof (*ret);
 
-  ret = (struct elf32_hppa_link_hash_table *) bfd_alloc (abfd, amt);
+  ret = (struct elf32_hppa_link_hash_table *) bfd_malloc (amt);
   if (ret == NULL)
     return NULL;
 
   if (!_bfd_elf_link_hash_table_init (&ret->elf, abfd, hppa_link_hash_newfunc))
     {
-      bfd_release (abfd, ret);
+      free (ret);
       return NULL;
     }
 
@@ -514,6 +517,19 @@ elf32_hppa_link_hash_table_create (abfd)
   return &ret->elf.root;
 }
 
+/* Free the derived linker hash table.  */
+
+static void
+elf32_hppa_link_hash_table_free (hash)
+     struct bfd_link_hash_table *hash;
+{
+  struct elf32_hppa_link_hash_table *ret
+    = (struct elf32_hppa_link_hash_table *) hash;
+
+  bfd_hash_table_free (&ret->stub_hash_table);
+  _bfd_generic_link_hash_table_free (hash);
+}
+
 /* Build a name for an entry in the stub hash table.  */
 
 static char *
@@ -4477,6 +4493,7 @@ elf32_hppa_elf_get_symbol_type (elf_sym, 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_add_symbol_hook         elf32_hppa_add_symbol_hook
 #define elf_backend_adjust_dynamic_symbol    elf32_hppa_adjust_dynamic_symbol
 #define elf_backend_copy_indirect_symbol     elf32_hppa_copy_indirect_symbol
index d74f6ee..7165e84 100644 (file)
@@ -547,13 +547,13 @@ elf_i386_link_hash_table_create (abfd)
   struct elf_i386_link_hash_table *ret;
   bfd_size_type amt = sizeof (struct elf_i386_link_hash_table);
 
-  ret = (struct elf_i386_link_hash_table *) bfd_alloc (abfd, amt);
+  ret = (struct elf_i386_link_hash_table *) bfd_malloc (amt);
   if (ret == NULL)
     return NULL;
 
   if (! _bfd_elf_link_hash_table_init (&ret->elf, abfd, link_hash_newfunc))
     {
-      bfd_release (abfd, ret);
+      free (ret);
       return NULL;
     }
 
index 19266b0..9267e47 100644 (file)
@@ -340,14 +340,14 @@ elf_m68k_link_hash_table_create (abfd)
   struct elf_m68k_link_hash_table *ret;
   bfd_size_type amt = sizeof (struct elf_m68k_link_hash_table);
 
-  ret = (struct elf_m68k_link_hash_table *) bfd_alloc (abfd, amt);
+  ret = (struct elf_m68k_link_hash_table *) bfd_malloc (amt);
   if (ret == (struct elf_m68k_link_hash_table *) NULL)
     return NULL;
 
   if (! _bfd_elf_link_hash_table_init (&ret->root, abfd,
                                       elf_m68k_link_hash_newfunc))
     {
-      bfd_release (abfd, ret);
+      free (ret);
       return NULL;
     }
 
index 1c11269..8c6f546 100644 (file)
@@ -478,13 +478,13 @@ elf_s390_link_hash_table_create (abfd)
   struct elf_s390_link_hash_table *ret;
   bfd_size_type amt = sizeof (struct elf_s390_link_hash_table);
 
-  ret = (struct elf_s390_link_hash_table *) bfd_alloc (abfd, amt);
+  ret = (struct elf_s390_link_hash_table *) bfd_malloc (amt);
   if (ret == NULL)
     return NULL;
 
   if (! _bfd_elf_link_hash_table_init (&ret->elf, abfd, link_hash_newfunc))
     {
-      bfd_release (abfd, ret);
+      free (ret);
       return NULL;
     }
 
index 74f276b..ef737b5 100644 (file)
@@ -3529,14 +3529,14 @@ sh_elf_link_hash_table_create (abfd)
   struct elf_sh_link_hash_table *ret;
   bfd_size_type amt = sizeof (struct elf_sh_link_hash_table);
 
-  ret = (struct elf_sh_link_hash_table *) bfd_alloc (abfd, amt);
+  ret = (struct elf_sh_link_hash_table *) bfd_malloc (amt);
   if (ret == (struct elf_sh_link_hash_table *) NULL)
     return NULL;
 
   if (! _bfd_elf_link_hash_table_init (&ret->root, abfd,
                                       sh_elf_link_hash_newfunc))
     {
-      bfd_release (abfd, ret);
+      free (ret);
       return NULL;
     }
 
index 8cf68dd..7151f06 100644 (file)
@@ -324,14 +324,14 @@ elf64_alpha_bfd_link_hash_table_create (abfd)
   struct alpha_elf_link_hash_table *ret;
   bfd_size_type amt = sizeof (struct alpha_elf_link_hash_table);
 
-  ret = (struct alpha_elf_link_hash_table *) bfd_zalloc (abfd, amt);
+  ret = (struct alpha_elf_link_hash_table *) bfd_zmalloc (amt);
   if (ret == (struct alpha_elf_link_hash_table *) NULL)
     return NULL;
 
   if (! _bfd_elf_link_hash_table_init (&ret->root, abfd,
                                       elf64_alpha_link_hash_newfunc))
     {
-      bfd_release (abfd, ret);
+      free (ret);
       return NULL;
     }
 
index 6adc202..056cd94 100644 (file)
@@ -1780,13 +1780,13 @@ ppc64_elf_link_hash_table_create (abfd)
   struct ppc_link_hash_table *htab;
   bfd_size_type amt = sizeof (struct ppc_link_hash_table);
 
-  htab = (struct ppc_link_hash_table *) bfd_alloc (abfd, amt);
+  htab = (struct ppc_link_hash_table *) bfd_malloc (amt);
   if (htab == NULL)
     return NULL;
 
   if (! _bfd_elf_link_hash_table_init (&htab->elf, abfd, link_hash_newfunc))
     {
-      bfd_release (abfd, htab);
+      free (htab);
       return NULL;
     }
 
index 23c1bfa..c4c3c1d 100644 (file)
@@ -424,13 +424,13 @@ elf_s390_link_hash_table_create (abfd)
   struct elf_s390_link_hash_table *ret;
   bfd_size_type amt = sizeof (struct elf_s390_link_hash_table);
 
-  ret = (struct elf_s390_link_hash_table *) bfd_alloc (abfd, amt);
+  ret = (struct elf_s390_link_hash_table *) bfd_malloc (amt);
   if (ret == NULL)
     return NULL;
 
   if (! _bfd_elf_link_hash_table_init (&ret->elf, abfd, link_hash_newfunc))
     {
-      bfd_release (abfd, ret);
+      free (ret);
       return NULL;
     }
 
index dee4a44..aac491a 100644 (file)
@@ -3227,14 +3227,14 @@ sh64_elf64_link_hash_table_create (abfd)
   struct elf_sh64_link_hash_table *ret;
 
   ret = ((struct elf_sh64_link_hash_table *)
-        bfd_alloc (abfd, sizeof (struct elf_sh64_link_hash_table)));
+        bfd_malloc (sizeof (struct elf_sh64_link_hash_table)));
   if (ret == (struct elf_sh64_link_hash_table *) NULL)
     return NULL;
 
   if (! _bfd_elf_link_hash_table_init (&ret->root, abfd,
                                       sh64_elf64_link_hash_newfunc))
     {
-      bfd_release (abfd, ret);
+      free (ret);
       return NULL;
     }
 
index 78d2a56..8df7e31 100644 (file)
@@ -1,5 +1,5 @@
 /* SPARC-specific support for 64-bit ELF
-   Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+   Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
    Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -659,14 +659,14 @@ sparc64_elf_bfd_link_hash_table_create (abfd)
   struct sparc64_elf_link_hash_table *ret;
   bfd_size_type amt = sizeof (struct sparc64_elf_link_hash_table);
 
-  ret = (struct sparc64_elf_link_hash_table *) bfd_zalloc (abfd, amt);
+  ret = (struct sparc64_elf_link_hash_table *) bfd_zmalloc (amt);
   if (ret == (struct sparc64_elf_link_hash_table *) NULL)
     return NULL;
 
   if (! _bfd_elf_link_hash_table_init (&ret->root, abfd,
                                       _bfd_elf_link_hash_newfunc))
     {
-      bfd_release (abfd, ret);
+      free (ret);
       return NULL;
     }
 
index a82b99c..51f10fc 100644 (file)
@@ -340,13 +340,13 @@ elf64_x86_64_link_hash_table_create (abfd)
   struct elf64_x86_64_link_hash_table *ret;
   bfd_size_type amt = sizeof (struct elf64_x86_64_link_hash_table);
 
-  ret = (struct elf64_x86_64_link_hash_table *) bfd_alloc (abfd, amt);
+  ret = (struct elf64_x86_64_link_hash_table *) bfd_malloc (amt);
   if (ret == NULL)
     return NULL;
 
   if (! _bfd_elf_link_hash_table_init (&ret->elf, abfd, link_hash_newfunc))
     {
-      bfd_release (abfd, ret);
+      free (ret);
       return NULL;
     }
 
index 7cfa733..90426c4 100644 (file)
@@ -6750,14 +6750,14 @@ _bfd_mips_elf_link_hash_table_create (abfd)
   struct mips_elf_link_hash_table *ret;
   bfd_size_type amt = sizeof (struct mips_elf_link_hash_table);
 
-  ret = (struct mips_elf_link_hash_table *) bfd_alloc (abfd, amt);
+  ret = (struct mips_elf_link_hash_table *) bfd_malloc (amt);
   if (ret == (struct mips_elf_link_hash_table *) NULL)
     return NULL;
 
   if (! _bfd_elf_link_hash_table_init (&ret->root, abfd,
                                       mips_elf_link_hash_newfunc))
     {
-      bfd_release (abfd, ret);
+      free (ret);
       return NULL;
     }
 
index fe16284..c1c106f 100644 (file)
@@ -169,6 +169,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
   _bfd_elf_canonicalize_dynamic_reloc
 #endif
 
+#ifndef bfd_elfNN_bfd_link_hash_table_free
+#define bfd_elfNN_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
+#endif
+
 #ifdef elf_backend_relocate_section
 #ifndef bfd_elfNN_bfd_link_hash_table_create
 #define bfd_elfNN_bfd_link_hash_table_create _bfd_elf_link_hash_table_create
index f192b22..655ecfd 100644 (file)
@@ -1,5 +1,5 @@
 /* BFD back-end for MS-DOS executables.
-   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2001
+   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2001, 2002
    Free Software Foundation, Inc.
    Written by Bryan Ford of the University of Utah.
 
@@ -174,6 +174,7 @@ msdos_set_section_contents (abfd, section, location, offset, count)
 #define msdos_bfd_gc_sections bfd_generic_gc_sections
 #define msdos_bfd_merge_sections bfd_generic_merge_sections
 #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_final_link _bfd_generic_final_link
 #define msdos_bfd_link_split_section _bfd_generic_link_split_section
index 626fc77..099a714 100644 (file)
@@ -1,5 +1,5 @@
 /* BFD back-end for os9000 i386 binaries.
-   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2001
+   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2001, 2002
    Free Software Foundation, Inc.
    Written by Cygnus Support.
 
@@ -330,6 +330,7 @@ os9k_sizeof_headers (ignore_abfd, ignore)
 #define os9k_bfd_gc_sections bfd_generic_gc_sections
 #define os9k_bfd_merge_sections bfd_generic_merge_sections
 #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_final_link _bfd_generic_final_link
 #define os9k_bfd_link_split_section  _bfd_generic_link_split_section
index df7cfd6..cd56101 100644 (file)
@@ -4011,6 +4011,7 @@ ieee_bfd_debug_info_accumulate (abfd, section)
 #define ieee_bfd_gc_sections bfd_generic_gc_sections
 #define ieee_bfd_merge_sections bfd_generic_merge_sections
 #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_final_link _bfd_generic_final_link
 #define ieee_bfd_link_split_section  _bfd_generic_link_split_section
@@ -4084,6 +4085,7 @@ 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  */
index 613eaf3..64f9fc7 100644 (file)
@@ -981,6 +981,7 @@ ihex_sizeof_headers (abfd, exec)
 #define ihex_bfd_gc_sections bfd_generic_gc_sections
 #define ihex_bfd_merge_sections bfd_generic_merge_sections
 #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_final_link _bfd_generic_final_link
 #define ihex_bfd_link_split_section _bfd_generic_link_split_section
index ed417ca..68006fa 100644 (file)
@@ -1,7 +1,7 @@
 /* libbfd.h -- Declarations used by bfd library *implementation*.
    (This include file is not for users of the library.)
    Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2000, 2001
+   2000, 2001, 2002
    Free Software Foundation, Inc.
    Written by Cygnus Support.
 
@@ -324,6 +324,8 @@ extern boolean _bfd_generic_set_section_contents
    bfd_false)
 #define _bfd_nolink_bfd_link_hash_table_create \
   ((struct bfd_link_hash_table *(*) PARAMS ((bfd *))) bfd_nullvoidptr)
+#define _bfd_nolink_bfd_link_hash_table_free \
+  ((void (*) PARAMS ((struct bfd_link_hash_table *))) bfd_void)
 #define _bfd_nolink_bfd_link_add_symbols \
   ((boolean (*) PARAMS ((bfd *, struct bfd_link_info *))) bfd_false)
 #define _bfd_nolink_bfd_final_link \
@@ -389,6 +391,10 @@ extern boolean _bfd_link_hash_table_init
 extern struct bfd_link_hash_table *_bfd_generic_link_hash_table_create
   PARAMS ((bfd *));
 
+/* Generic link hash table destruction routine.  */
+extern void _bfd_generic_link_hash_table_free
+  PARAMS ((struct bfd_link_hash_table *));
+
 /* Generic add symbol routine.  */
 extern boolean _bfd_generic_link_add_symbols
   PARAMS ((bfd *, struct bfd_link_info *));
index 55d192c..cbe4973 100644 (file)
@@ -6,7 +6,7 @@
 /* libbfd.h -- Declarations used by bfd library *implementation*.
    (This include file is not for users of the library.)
    Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2000, 2001
+   2000, 2001, 2002
    Free Software Foundation, Inc.
    Written by Cygnus Support.
 
@@ -329,6 +329,8 @@ extern boolean _bfd_generic_set_section_contents
    bfd_false)
 #define _bfd_nolink_bfd_link_hash_table_create \
   ((struct bfd_link_hash_table *(*) PARAMS ((bfd *))) bfd_nullvoidptr)
+#define _bfd_nolink_bfd_link_hash_table_free \
+  ((void (*) PARAMS ((struct bfd_link_hash_table *))) bfd_void)
 #define _bfd_nolink_bfd_link_add_symbols \
   ((boolean (*) PARAMS ((bfd *, struct bfd_link_info *))) bfd_false)
 #define _bfd_nolink_bfd_final_link \
@@ -394,6 +396,10 @@ extern boolean _bfd_link_hash_table_init
 extern struct bfd_link_hash_table *_bfd_generic_link_hash_table_create
   PARAMS ((bfd *));
 
+/* Generic link hash table destruction routine.  */
+extern void _bfd_generic_link_hash_table_free
+  PARAMS ((struct bfd_link_hash_table *));
+
 /* Generic add symbol routine.  */
 extern boolean _bfd_generic_link_add_symbols
   PARAMS ((bfd *, struct bfd_link_info *));
index bbccbba..618ddda 100644 (file)
@@ -1,6 +1,6 @@
 /* BFD COFF object file private structure.
    Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2000, 2001
+   2000, 2001, 2002
    Free Software Foundation, Inc.
    Written by Cygnus Support.
 
@@ -580,6 +580,8 @@ extern long _bfd_xcoff_canonicalize_dynamic_reloc
   PARAMS ((bfd *, arelent **, asymbol **));
 extern struct bfd_link_hash_table *_bfd_xcoff_bfd_link_hash_table_create
   PARAMS ((bfd *));
+extern void _bfd_xcoff_bfd_link_hash_table_free
+  PARAMS ((struct bfd_link_hash_table *));
 extern boolean _bfd_xcoff_bfd_link_add_symbols
   PARAMS ((bfd *, struct bfd_link_info *));
 extern boolean _bfd_xcoff_bfd_final_link
index f26a692..2e9a7d8 100644 (file)
@@ -4,7 +4,7 @@
 
 /* BFD COFF object file private structure.
    Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2000, 2001
+   2000, 2001, 2002
    Free Software Foundation, Inc.
    Written by Cygnus Support.
 
@@ -584,6 +584,8 @@ extern long _bfd_xcoff_canonicalize_dynamic_reloc
   PARAMS ((bfd *, arelent **, asymbol **));
 extern struct bfd_link_hash_table *_bfd_xcoff_bfd_link_hash_table_create
   PARAMS ((bfd *));
+extern void _bfd_xcoff_bfd_link_hash_table_free
+  PARAMS ((struct bfd_link_hash_table *));
 extern boolean _bfd_xcoff_bfd_link_add_symbols
   PARAMS ((bfd *, struct bfd_link_info *));
 extern boolean _bfd_xcoff_bfd_final_link
index 5f9e016..c900ee8 100644 (file)
@@ -1,5 +1,5 @@
 /* BFD ECOFF object file private structure.
-   Copyright 1993, 1994, 1995, 1996, 1999, 2001
+   Copyright 1993, 1994, 1995, 1996, 1999, 2001, 2002
    Free Software Foundation, Inc.
    Written by Ian Lance Taylor, Cygnus Support.
 
@@ -330,6 +330,7 @@ extern int _bfd_ecoff_sizeof_headers PARAMS ((bfd *abfd, boolean reloc));
 /* ecoff_bfd_relax_section defined by backend.  */
 extern struct bfd_link_hash_table *_bfd_ecoff_bfd_link_hash_table_create
   PARAMS ((bfd *));
+#define _bfd_ecoff_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
 extern boolean _bfd_ecoff_bfd_link_add_symbols
   PARAMS ((bfd *, struct bfd_link_info *));
 extern boolean _bfd_ecoff_bfd_final_link
index aa61f76..b4b9f29 100644 (file)
@@ -675,7 +675,7 @@ _bfd_generic_link_hash_table_create (abfd)
   struct generic_link_hash_table *ret;
   bfd_size_type amt = sizeof (struct generic_link_hash_table);
 
-  ret = (struct generic_link_hash_table *) bfd_alloc (abfd, amt);
+  ret = (struct generic_link_hash_table *) bfd_malloc (amt);
   if (ret == NULL)
     return (struct bfd_link_hash_table *) NULL;
   if (! _bfd_link_hash_table_init (&ret->root, abfd,
@@ -687,6 +687,17 @@ _bfd_generic_link_hash_table_create (abfd)
   return &ret->root;
 }
 
+void
+_bfd_generic_link_hash_table_free (hash)
+     struct bfd_link_hash_table *hash;
+{
+  struct generic_link_hash_table *ret
+    = (struct generic_link_hash_table *) hash;
+
+  bfd_hash_table_free (&ret->root.table);
+  free (ret);
+}
+
 /* Grab the symbols for an object file when doing a generic link.  We
    store the symbols in the outsymbols field.  We need to keep them
    around for the entire link to ensure that we only read them once.
index 9ce7d0a..7dd0428 100644 (file)
@@ -230,7 +230,7 @@ linux_link_hash_table_create (abfd)
   struct linux_link_hash_table *ret;
   bfd_size_type amt = sizeof (struct linux_link_hash_table);
 
-  ret = (struct linux_link_hash_table *) bfd_alloc (abfd, amt);
+  ret = (struct linux_link_hash_table *) bfd_malloc (amt);
   if (ret == (struct linux_link_hash_table *) NULL)
     {
       bfd_set_error (bfd_error_no_memory);
index bc3b147..fe70a18 100644 (file)
--- a/bfd/mmo.c
+++ b/bfd/mmo.c
@@ -3245,6 +3245,7 @@ mmo_canonicalize_reloc (abfd, section, relptr, symbols)
   bfd_generic_get_relocated_section_contents
 #define mmo_bfd_gc_sections bfd_generic_gc_sections
 #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_final_link _bfd_generic_final_link
 #define mmo_bfd_link_split_section _bfd_generic_link_split_section
index c1b086b..79877fe 100644 (file)
@@ -1,5 +1,6 @@
 /* Target definitions for 32/64-bit NLM (NetWare Loadable Module)
-   Copyright 1993, 1994, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+   Copyright 1993, 1994, 1998, 1999, 2000, 2001, 2002
+   Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
 
@@ -44,6 +45,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #define nlm_bfd_gc_sections bfd_generic_gc_sections
 #define nlm_bfd_merge_sections bfd_generic_merge_sections
 #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_final_link _bfd_generic_final_link
 #define nlm_bfd_link_split_section _bfd_generic_link_split_section
index d8dc957..4cadb69 100644 (file)
@@ -1,5 +1,5 @@
 /* BFD back-end for oasys objects.
-   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2001
+   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2001, 2002
    Free Software Foundation, Inc.
    Written by Steve Chamberlain of Cygnus Support, <sac@cygnus.com>.
 
@@ -1491,6 +1491,7 @@ oasys_sizeof_headers (abfd, exec)
 #define oasys_bfd_gc_sections bfd_generic_gc_sections
 #define oasys_bfd_merge_sections bfd_generic_merge_sections
 #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_final_link _bfd_generic_final_link
 #define oasys_bfd_link_split_section _bfd_generic_link_split_section
index 9ac3f31..d40590f 100644 (file)
@@ -470,6 +470,7 @@ ppcboot_bfd_print_private_bfd_data (abfd, farg)
 #define ppcboot_bfd_gc_sections bfd_generic_gc_sections
 #define ppcboot_bfd_merge_sections bfd_generic_merge_sections
 #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_final_link _bfd_generic_final_link
 #define ppcboot_bfd_link_split_section _bfd_generic_link_split_section
index be190d8..4672379 100644 (file)
--- a/bfd/som.c
+++ b/bfd/som.c
@@ -6333,6 +6333,7 @@ som_bfd_link_split_section (abfd, sec)
  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_final_link _bfd_generic_final_link
 
index a8b4792..7f1d270 100644 (file)
@@ -230,7 +230,7 @@ linux_link_hash_table_create (abfd)
   struct linux_link_hash_table *ret;
   bfd_size_type amt = sizeof (struct linux_link_hash_table);
 
-  ret = (struct linux_link_hash_table *) bfd_alloc (abfd, amt);
+  ret = (struct linux_link_hash_table *) bfd_malloc (amt);
   if (ret == (struct linux_link_hash_table *) NULL)
     return (struct bfd_link_hash_table *) NULL;
   if (! NAME(aout,link_hash_table_init) (&ret->root, abfd,
index 41d9871..f40af69 100644 (file)
@@ -1271,6 +1271,7 @@ srec_print_symbol (abfd, afile, symbol, how)
 #define srec_bfd_gc_sections bfd_generic_gc_sections
 #define srec_bfd_merge_sections bfd_generic_merge_sections
 #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_final_link _bfd_generic_final_link
 #define srec_bfd_link_split_section _bfd_generic_link_split_section
index cb23fe1..7825a82 100644 (file)
@@ -717,13 +717,13 @@ sunos_link_hash_table_create (abfd)
   struct sunos_link_hash_table *ret;
   bfd_size_type amt = sizeof (struct sunos_link_hash_table);
 
-  ret = (struct sunos_link_hash_table *) bfd_alloc (abfd, amt);
+  ret = (struct sunos_link_hash_table *) bfd_malloc (amt);
   if (ret == (struct sunos_link_hash_table *) NULL)
     return (struct bfd_link_hash_table *) NULL;
   if (! NAME(aout,link_hash_table_init) (&ret->root, abfd,
                                         sunos_link_hash_newfunc))
     {
-      bfd_release (abfd, ret);
+      free (ret);
       return (struct bfd_link_hash_table *) NULL;
     }
 
index 2ff69d6..b9d3a93 100644 (file)
@@ -394,6 +394,7 @@ the tokens.
 .CONCAT2 (NAME,_bfd_get_relocated_section_contents), \
 .CONCAT2 (NAME,_bfd_relax_section), \
 .CONCAT2 (NAME,_bfd_link_hash_table_create), \
+.CONCAT2 (NAME,_bfd_link_hash_table_free), \
 .CONCAT2 (NAME,_bfd_link_add_symbols), \
 .CONCAT2 (NAME,_bfd_final_link), \
 .CONCAT2 (NAME,_bfd_link_split_section), \
@@ -411,6 +412,9 @@ the tokens.
 .     different information in this table.  *}
 .  struct bfd_link_hash_table *(*_bfd_link_hash_table_create) PARAMS ((bfd *));
 .
+.  {* Release the memory associated with the linker hash table.  *}
+.  void (*_bfd_link_hash_table_free) PARAMS ((struct bfd_link_hash_table *));
+.
 .  {* Add symbols from this object file into the hash table.  *}
 .  boolean  (*_bfd_link_add_symbols) PARAMS ((bfd *, struct bfd_link_info *));
 .
index f5d5160..565568a 100644 (file)
@@ -1,5 +1,5 @@
 /* BFD backend for Extended Tektronix Hex Format  objects.
-   Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
+   Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
    Free Software Foundation, Inc.
    Written by Steve Chamberlain of Cygnus Support <sac@cygnus.com>.
 
@@ -1006,6 +1006,7 @@ tekhex_print_symbol (abfd, filep, symbol, how)
 #define tekhex_bfd_gc_sections bfd_generic_gc_sections
 #define tekhex_bfd_merge_sections bfd_generic_merge_sections
 #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_final_link _bfd_generic_final_link
 #define tekhex_bfd_link_split_section _bfd_generic_link_split_section
index 37eb94c..9a7bcc7 100644 (file)
@@ -868,6 +868,7 @@ versados_canonicalize_reloc (abfd, section, relptr, symbols)
 #define versados_bfd_gc_sections bfd_generic_gc_sections
 #define versados_bfd_merge_sections bfd_generic_merge_sections
 #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_final_link _bfd_generic_final_link
 #define versados_bfd_link_split_section _bfd_generic_link_split_section
index 388b727..7ca7459 100644 (file)
--- a/bfd/vms.c
+++ b/bfd/vms.c
@@ -114,6 +114,8 @@ static boolean vms_bfd_merge_sections
   PARAMS ((bfd *abfd, struct bfd_link_info *link_info));
 static struct bfd_link_hash_table *vms_bfd_link_hash_table_create
   PARAMS ((bfd *abfd));
+static void vms_bfd_link_hash_table_free
+  PARAMS ((struct bfd_link_hash_table *hash));
 static boolean vms_bfd_link_add_symbols
   PARAMS ((bfd *abfd, struct bfd_link_info *link_info));
 static boolean vms_bfd_final_link
@@ -1789,6 +1791,17 @@ vms_bfd_link_hash_table_create (abfd)
   return 0;
 }
 
+/* Free a linker hash table.  */
+
+static void
+vms_bfd_link_hash_table_free (hash)
+     struct bfd_link_hash_table *hash ATTRIBUTE_UNUSED;
+{
+#if VMS_DEBUG
+  vms_debug (1, "vms_bfd_link_hash_table_free(%p)\n", abfd);
+#endif
+}
+
 /* Add symbols from this object file into the hash table.  */
 
 static boolean
index aff6293..79952d2 100644 (file)
@@ -482,12 +482,12 @@ _bfd_xcoff_bfd_link_hash_table_create (abfd)
   struct xcoff_link_hash_table *ret;
   bfd_size_type amt = sizeof (struct xcoff_link_hash_table);
 
-  ret = (struct xcoff_link_hash_table *) bfd_alloc (abfd, amt);
+  ret = (struct xcoff_link_hash_table *) bfd_malloc (amt);
   if (ret == (struct xcoff_link_hash_table *) NULL)
     return (struct bfd_link_hash_table *) NULL;
   if (! _bfd_link_hash_table_init (&ret->root, abfd, xcoff_link_hash_newfunc))
     {
-      bfd_release (abfd, ret);
+      free (ret);
       return (struct bfd_link_hash_table *) NULL;
     }
 
@@ -513,6 +513,18 @@ _bfd_xcoff_bfd_link_hash_table_create (abfd)
   return &ret->root;
 }
 
+/* Free a XCOFF link hash table.  */
+
+void
+_bfd_xcoff_bfd_link_hash_table_free (hash)
+     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);
+}
 \f
 /* Read internal relocs for an XCOFF csect.  This is a wrapper around
    _bfd_coff_read_internal_relocs which tries to take advantage of any