aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bfd/ChangeLog76
-rw-r--r--bfd/aout-adobe.c5
-rw-r--r--bfd/aout-target.h5
-rw-r--r--bfd/aout-tic30.c5
-rw-r--r--bfd/bfd-in2.h7
-rw-r--r--bfd/bfd.c3
-rw-r--r--bfd/binary.c3
-rw-r--r--bfd/bout.c3
-rw-r--r--bfd/coff-arm.c4
-rw-r--r--bfd/coff-h8300.c6
-rw-r--r--bfd/coff-mcore.c6
-rw-r--r--bfd/coff-ppc.c6
-rw-r--r--bfd/coff-rs6000.c2
-rw-r--r--bfd/coff64-rs6000.c2
-rw-r--r--bfd/coffcode.h4
-rw-r--r--bfd/cofflink.c4
-rw-r--r--bfd/ecoff.c2
-rw-r--r--bfd/elf-m10300.c31
-rw-r--r--bfd/elf.c4
-rw-r--r--bfd/elf32-arm.h4
-rw-r--r--bfd/elf32-cris.c4
-rw-r--r--bfd/elf32-hppa.c21
-rw-r--r--bfd/elf32-i386.c4
-rw-r--r--bfd/elf32-m68k.c4
-rw-r--r--bfd/elf32-s390.c4
-rw-r--r--bfd/elf32-sh.c4
-rw-r--r--bfd/elf64-alpha.c4
-rw-r--r--bfd/elf64-ppc.c4
-rw-r--r--bfd/elf64-s390.c4
-rw-r--r--bfd/elf64-sh64.c4
-rw-r--r--bfd/elf64-sparc.c6
-rw-r--r--bfd/elf64-x86-64.c4
-rw-r--r--bfd/elfxx-mips.c4
-rw-r--r--bfd/elfxx-target.h4
-rw-r--r--bfd/i386msdos.c3
-rw-r--r--bfd/i386os9k.c3
-rw-r--r--bfd/ieee.c2
-rw-r--r--bfd/ihex.c1
-rw-r--r--bfd/libbfd-in.h8
-rw-r--r--bfd/libbfd.h8
-rw-r--r--bfd/libcoff-in.h4
-rw-r--r--bfd/libcoff.h4
-rw-r--r--bfd/libecoff.h3
-rw-r--r--bfd/linker.c13
-rw-r--r--bfd/m68klinux.c2
-rw-r--r--bfd/mmo.c1
-rw-r--r--bfd/nlm-target.h4
-rw-r--r--bfd/oasys.c3
-rw-r--r--bfd/ppcboot.c1
-rw-r--r--bfd/som.c1
-rw-r--r--bfd/sparclinux.c2
-rw-r--r--bfd/srec.c1
-rw-r--r--bfd/sunos.c4
-rw-r--r--bfd/targets.c4
-rw-r--r--bfd/tekhex.c3
-rw-r--r--bfd/versados.c1
-rw-r--r--bfd/vms.c13
-rw-r--r--bfd/xcofflink.c16
58 files changed, 289 insertions, 73 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 6a05b0e..dc9840e 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -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.
diff --git a/bfd/aout-adobe.c b/bfd/aout-adobe.c
index 72fed35..01f2691 100644
--- a/bfd/aout-adobe.c
+++ b/bfd/aout-adobe.c
@@ -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
diff --git a/bfd/aout-target.h b/bfd/aout-target.h
index ccedb93..30c735a 100644
--- a/bfd/aout-target.h
+++ b/bfd/aout-target.h
@@ -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
diff --git a/bfd/aout-tic30.c b/bfd/aout-tic30.c
index e3c74fa..58ef3ea 100644
--- a/bfd/aout-tic30.c
+++ b/bfd/aout-tic30.c
@@ -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
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index c62e5a0..49a1aed 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -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 *));
diff --git a/bfd/bfd.c b/bfd/bfd.c
index 5795383..c1135c8 100644
--- 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))
.
diff --git a/bfd/binary.c b/bfd/binary.c
index 705ac8f..3207e89 100644
--- a/bfd/binary.c
+++ b/bfd/binary.c
@@ -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
diff --git a/bfd/bout.c b/bfd/bout.c
index 13e4f04..0e070ad 100644
--- a/bfd/bout.c
+++ b/bfd/bout.c
@@ -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
diff --git a/bfd/coff-arm.c b/bfd/coff-arm.c
index 798cd49..049d144 100644
--- a/bfd/coff-arm.c
+++ b/bfd/coff-arm.c
@@ -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;
}
diff --git a/bfd/coff-h8300.c b/bfd/coff-h8300.c
index 7ce4208..82b7bca 100644
--- a/bfd/coff-h8300.c
+++ b/bfd/coff-h8300.c
@@ -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;
}
diff --git a/bfd/coff-mcore.c b/bfd/coff-mcore.c
index 9603e02..f15102d 100644
--- a/bfd/coff-mcore.c
+++ b/bfd/coff-mcore.c
@@ -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;
}
diff --git a/bfd/coff-ppc.c b/bfd/coff-ppc.c
index f2bdfe5..4f8b15e 100644
--- a/bfd/coff-ppc.c
+++ b/bfd/coff-ppc.c
@@ -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;
diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c
index 75d77ab..066d020 100644
--- a/bfd/coff-rs6000.c
+++ b/bfd/coff-rs6000.c
@@ -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 */
diff --git a/bfd/coff64-rs6000.c b/bfd/coff64-rs6000.c
index 9398163..09a1abe 100644
--- a/bfd/coff64-rs6000.c
+++ b/bfd/coff64-rs6000.c
@@ -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 */
diff --git a/bfd/coffcode.h b/bfd/coffcode.h
index db42987..010ed33 100644
--- a/bfd/coffcode.h
+++ b/bfd/coffcode.h
@@ -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
diff --git a/bfd/cofflink.c b/bfd/cofflink.c
index 8a80c14..1eac3c5 100644
--- a/bfd/cofflink.c
+++ b/bfd/cofflink.c
@@ -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;
diff --git a/bfd/ecoff.c b/bfd/ecoff.c
index 70224cb..c7230f6 100644
--- a/bfd/ecoff.c
+++ b/bfd/ecoff.c
@@ -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,
diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c
index a80060a..ce68a16 100644
--- a/bfd/elf-m10300.c
+++ b/bfd/elf-m10300.c
@@ -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 '_'
diff --git a/bfd/elf.c b/bfd/elf.c
index 67d9add..379eb08 100644
--- 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;
}
diff --git a/bfd/elf32-arm.h b/bfd/elf32-arm.h
index d420e5b..217666f 100644
--- a/bfd/elf32-arm.h
+++ b/bfd/elf32-arm.h
@@ -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;
}
diff --git a/bfd/elf32-cris.c b/bfd/elf32-cris.c
index 30570ee..2348cd4 100644
--- a/bfd/elf32-cris.c
+++ b/bfd/elf32-cris.c
@@ -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;
}
diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c
index a8d0a44..1b03886 100644
--- a/bfd/elf32-hppa.c
+++ b/bfd/elf32-hppa.c
@@ -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
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index d74f6ee..7165e84 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -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;
}
diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c
index 19266b0..9267e47 100644
--- a/bfd/elf32-m68k.c
+++ b/bfd/elf32-m68k.c
@@ -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;
}
diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c
index 1c11269..8c6f546 100644
--- a/bfd/elf32-s390.c
+++ b/bfd/elf32-s390.c
@@ -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;
}
diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c
index 74f276b..ef737b5 100644
--- a/bfd/elf32-sh.c
+++ b/bfd/elf32-sh.c
@@ -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;
}
diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c
index 8cf68dd..7151f06 100644
--- a/bfd/elf64-alpha.c
+++ b/bfd/elf64-alpha.c
@@ -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;
}
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index 6adc202..056cd94 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -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;
}
diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c
index 23c1bfa..c4c3c1d 100644
--- a/bfd/elf64-s390.c
+++ b/bfd/elf64-s390.c
@@ -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;
}
diff --git a/bfd/elf64-sh64.c b/bfd/elf64-sh64.c
index dee4a44..aac491a 100644
--- a/bfd/elf64-sh64.c
+++ b/bfd/elf64-sh64.c
@@ -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;
}
diff --git a/bfd/elf64-sparc.c b/bfd/elf64-sparc.c
index 78d2a56..8df7e31 100644
--- a/bfd/elf64-sparc.c
+++ b/bfd/elf64-sparc.c
@@ -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;
}
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index a82b99c..51f10fc 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -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;
}
diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
index 7cfa733..90426c4 100644
--- a/bfd/elfxx-mips.c
+++ b/bfd/elfxx-mips.c
@@ -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;
}
diff --git a/bfd/elfxx-target.h b/bfd/elfxx-target.h
index fe16284..c1c106f 100644
--- a/bfd/elfxx-target.h
+++ b/bfd/elfxx-target.h
@@ -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
diff --git a/bfd/i386msdos.c b/bfd/i386msdos.c
index f192b22..655ecfd 100644
--- a/bfd/i386msdos.c
+++ b/bfd/i386msdos.c
@@ -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
diff --git a/bfd/i386os9k.c b/bfd/i386os9k.c
index 626fc77..099a714 100644
--- a/bfd/i386os9k.c
+++ b/bfd/i386os9k.c
@@ -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
diff --git a/bfd/ieee.c b/bfd/ieee.c
index df7cfd6..cd56101 100644
--- a/bfd/ieee.c
+++ b/bfd/ieee.c
@@ -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 */
diff --git a/bfd/ihex.c b/bfd/ihex.c
index 613eaf3..64f9fc7 100644
--- a/bfd/ihex.c
+++ b/bfd/ihex.c
@@ -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
diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h
index ed417ca..68006fa 100644
--- a/bfd/libbfd-in.h
+++ b/bfd/libbfd-in.h
@@ -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 *));
diff --git a/bfd/libbfd.h b/bfd/libbfd.h
index 55d192c..cbe4973 100644
--- a/bfd/libbfd.h
+++ b/bfd/libbfd.h
@@ -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 *));
diff --git a/bfd/libcoff-in.h b/bfd/libcoff-in.h
index bbccbba..618ddda 100644
--- a/bfd/libcoff-in.h
+++ b/bfd/libcoff-in.h
@@ -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
diff --git a/bfd/libcoff.h b/bfd/libcoff.h
index f26a692..2e9a7d8 100644
--- a/bfd/libcoff.h
+++ b/bfd/libcoff.h
@@ -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
diff --git a/bfd/libecoff.h b/bfd/libecoff.h
index 5f9e016..c900ee8 100644
--- a/bfd/libecoff.h
+++ b/bfd/libecoff.h
@@ -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
diff --git a/bfd/linker.c b/bfd/linker.c
index aa61f76..b4b9f29 100644
--- a/bfd/linker.c
+++ b/bfd/linker.c
@@ -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.
diff --git a/bfd/m68klinux.c b/bfd/m68klinux.c
index 9ce7d0a..7dd0428 100644
--- a/bfd/m68klinux.c
+++ b/bfd/m68klinux.c
@@ -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);
diff --git a/bfd/mmo.c b/bfd/mmo.c
index bc3b1475..fe70a18 100644
--- 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
diff --git a/bfd/nlm-target.h b/bfd/nlm-target.h
index c1b086b..79877fe 100644
--- a/bfd/nlm-target.h
+++ b/bfd/nlm-target.h
@@ -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
diff --git a/bfd/oasys.c b/bfd/oasys.c
index d8dc957..4cadb69 100644
--- a/bfd/oasys.c
+++ b/bfd/oasys.c
@@ -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
diff --git a/bfd/ppcboot.c b/bfd/ppcboot.c
index 9ac3f31..d40590f 100644
--- a/bfd/ppcboot.c
+++ b/bfd/ppcboot.c
@@ -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
diff --git a/bfd/som.c b/bfd/som.c
index be190d8..4672379 100644
--- 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
diff --git a/bfd/sparclinux.c b/bfd/sparclinux.c
index a8b4792..7f1d270 100644
--- a/bfd/sparclinux.c
+++ b/bfd/sparclinux.c
@@ -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,
diff --git a/bfd/srec.c b/bfd/srec.c
index 41d9871..f40af69 100644
--- a/bfd/srec.c
+++ b/bfd/srec.c
@@ -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
diff --git a/bfd/sunos.c b/bfd/sunos.c
index cb23fe1..7825a82 100644
--- a/bfd/sunos.c
+++ b/bfd/sunos.c
@@ -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;
}
diff --git a/bfd/targets.c b/bfd/targets.c
index 2ff69d6..b9d3a93 100644
--- a/bfd/targets.c
+++ b/bfd/targets.c
@@ -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 *));
.
diff --git a/bfd/tekhex.c b/bfd/tekhex.c
index f5d5160..565568a 100644
--- a/bfd/tekhex.c
+++ b/bfd/tekhex.c
@@ -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
diff --git a/bfd/versados.c b/bfd/versados.c
index 37eb94c..9a7bcc7 100644
--- a/bfd/versados.c
+++ b/bfd/versados.c
@@ -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
diff --git a/bfd/vms.c b/bfd/vms.c
index 388b727..7ca7459 100644
--- 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
diff --git a/bfd/xcofflink.c b/bfd/xcofflink.c
index aff6293..79952d2 100644
--- a/bfd/xcofflink.c
+++ b/bfd/xcofflink.c
@@ -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);
+}
/* Read internal relocs for an XCOFF csect. This is a wrapper around
_bfd_coff_read_internal_relocs which tries to take advantage of any