This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
ld memory deallocation
- From: Alan Modra <amodra at gmail dot com>
- To: binutils at sourceware dot org
- Date: Tue, 12 Feb 2013 08:36:36 +1030
- Subject: ld memory deallocation
I committed this one yesterday, and it seems didn't post the patch.
Fixes some low-hanging memory errors.
* elfcode.h (elf_checksum_contents): Free contents.
* elf-bfd.h (_bfd_elf_link_hash_table_free): Declare.
* elflink.c (_bfd_elf_link_hash_table_free): New function.
(elf_final_link_free): New function, extracted from..
(bfd_elf_final_link): ..here. Always call
_bfd_elf_write_section_eh_frame_hdr.
* elfxx-target.h (bfd_elfNN_bfd_link_hash_table_free): Default to
_bfd_elf_link_hash_table_free.
* libbfd-in.h (_bfd_merge_sections_free): Declare.
* libbfd.h: Regenerate.
* merge.c (_bfd_merge_sections_free): New function.
* elf-eh-frame.c (_bfd_elf_write_section_eh_frame_hdr): Free
hdr_info->array.
* elf-m10300.c (elf32_mn10300_link_hash_table_free): Call
_bfd_elf_link_hash_table_free.
* elf32-arm.c (elf32_arm_link_hash_table_free): Likewise.
* elf32-avr.c (elf32_avr_link_hash_table_free): Likewise.
* elf32-hppa.c (elf32_hppa_link_hash_table_free): Likewise.
* elf32-i386.c (elf_i386_link_hash_table_free): Likewise.
* elf32-m68hc1x.c (m68hc11_elf_hash_table_free): Likewise.
* elf32-m68k.c (elf_m68k_link_hash_table_free): Likewise.
* elf32-metag.c (elf_metag_link_hash_table_free): Likewise.
* elf32-xgate.c (xgate_elf_bfd_link_hash_table_free): Likewise.
* elf64-aarch64.c (elf64_aarch64_link_hash_table_free): Likewise.
* elf64-ia64-vms.c (elf64_ia64_hash_table_free): Likewise.
* elf64-ppc.c (ppc64_elf_link_hash_table_free): Likewise.
* elf64-x86-64.c (elf_x86_64_link_hash_table_free): Likewise.
* elfnn-ia64.c (elfNN_ia64_hash_table_free): Likewise.
* elf32-cr16.c (elf32_cr16_link_hash_table_free): Delete.
(bfd_elf32_bfd_link_hash_table_free): Don't define.
* elf32-tic6x.c (elf32_tic6x_link_hash_table_free): Delete.
(bfd_elf32_bfd_link_hash_table_free): Dont' define.
Index: bfd/elfcode.h
===================================================================
RCS file: /cvs/src/src/bfd/elfcode.h,v
retrieving revision 1.116
diff -u -p -r1.116 elfcode.h
--- bfd/elfcode.h 26 Jan 2013 02:08:01 -0000 1.116
+++ bfd/elfcode.h 11 Feb 2013 03:42:17 -0000
@@ -1071,6 +1071,7 @@ elf_checksum_contents (bfd *abfd,
{
Elf_Internal_Shdr i_shdr;
Elf_External_Shdr x_shdr;
+ bfd_byte *contents, *free_contents;
i_shdr = *i_shdrp[count];
i_shdr.sh_offset = 0;
@@ -1078,28 +1079,36 @@ elf_checksum_contents (bfd *abfd,
elf_swap_shdr_out (abfd, &i_shdr, &x_shdr);
(*process) (&x_shdr, sizeof x_shdr, arg);
- /* PR ld/12451:
- Process the section's contents, if it has some. Read them in if necessary. */
- if (i_shdr.contents)
- (*process) (i_shdr.contents, i_shdr.sh_size, arg);
- else if (i_shdr.sh_type != SHT_NOBITS)
+ /* Process the section's contents, if it has some.
+ PR ld/12451: Read them in if necessary. */
+ if (i_shdr.sh_type == SHT_NOBITS)
+ continue;
+ free_contents = NULL;
+ contents = i_shdr.contents;
+ if (contents == NULL)
{
asection *sec;
sec = bfd_section_from_elf_index (abfd, count);
if (sec != NULL)
{
- if (sec->contents == NULL)
+ contents = sec->contents;
+ if (contents == NULL)
{
/* Force rereading from file. */
sec->flags &= ~SEC_IN_MEMORY;
- if (! bfd_malloc_and_get_section (abfd, sec, & sec->contents))
+ if (!bfd_malloc_and_get_section (abfd, sec, &free_contents))
continue;
+ contents = free_contents;
}
- if (sec->contents != NULL)
- (*process) (sec->contents, i_shdr.sh_size, arg);
}
}
+ if (contents != NULL)
+ {
+ (*process) (contents, i_shdr.sh_size, arg);
+ if (free_contents != NULL)
+ free (free_contents);
+ }
}
return TRUE;
Index: bfd/elf-bfd.h
===================================================================
RCS file: /cvs/src/src/bfd/elf-bfd.h,v
retrieving revision 1.358
diff -u -p -r1.358 elf-bfd.h
--- bfd/elf-bfd.h 8 Feb 2013 07:04:49 -0000 1.358
+++ bfd/elf-bfd.h 11 Feb 2013 02:00:36 -0000
@@ -1804,6 +1804,8 @@ extern struct bfd_hash_entry *_bfd_elf_l
(struct bfd_hash_entry *, struct bfd_hash_table *, const char *);
extern struct bfd_link_hash_table *_bfd_elf_link_hash_table_create
(bfd *);
+extern void _bfd_elf_link_hash_table_free
+ (struct bfd_link_hash_table *);
extern void _bfd_elf_link_hash_copy_indirect
(struct bfd_link_info *, struct elf_link_hash_entry *,
struct elf_link_hash_entry *);
Index: bfd/elflink.c
===================================================================
RCS file: /cvs/src/src/bfd/elflink.c,v
retrieving revision 1.466
diff -u -p -r1.466 elflink.c
--- bfd/elflink.c 10 Feb 2013 04:36:33 -0000 1.466
+++ bfd/elflink.c 11 Feb 2013 03:37:31 -0000
@@ -6962,6 +6962,18 @@ _bfd_elf_link_hash_table_create (bfd *ab
return &ret->root;
}
+/* Destroy an ELF linker hash table. */
+
+void
+_bfd_elf_link_hash_table_free (struct bfd_link_hash_table *hash)
+{
+ struct elf_link_hash_table *htab = (struct elf_link_hash_table *) hash;
+ if (htab->dynstr != NULL)
+ _bfd_elf_strtab_free (htab->dynstr);
+ _bfd_merge_sections_free (htab->merge_info);
+ _bfd_generic_link_hash_table_free (hash);
+}
+
/* This is a hook for the ELF emulation code in the generic linker to
tell the backend linker what file name to use for the DT_NEEDED
entry for a dynamic object. */
@@ -10432,6 +10444,42 @@ elf_fixup_link_order (bfd *abfd, asectio
return TRUE;
}
+static void
+elf_final_link_free (bfd *obfd, struct elf_final_link_info *flinfo)
+{
+ asection *o;
+
+ if (flinfo->symstrtab != NULL)
+ _bfd_stringtab_free (flinfo->symstrtab);
+ if (flinfo->contents != NULL)
+ free (flinfo->contents);
+ if (flinfo->external_relocs != NULL)
+ free (flinfo->external_relocs);
+ if (flinfo->internal_relocs != NULL)
+ free (flinfo->internal_relocs);
+ if (flinfo->external_syms != NULL)
+ free (flinfo->external_syms);
+ if (flinfo->locsym_shndx != NULL)
+ free (flinfo->locsym_shndx);
+ if (flinfo->internal_syms != NULL)
+ free (flinfo->internal_syms);
+ if (flinfo->indices != NULL)
+ free (flinfo->indices);
+ if (flinfo->sections != NULL)
+ free (flinfo->sections);
+ if (flinfo->symbuf != NULL)
+ free (flinfo->symbuf);
+ if (flinfo->symshndxbuf != NULL)
+ free (flinfo->symshndxbuf);
+ for (o = obfd->sections; o != NULL; o = o->next)
+ {
+ struct bfd_elf_section_data *esdo = elf_section_data (o);
+ if ((o->flags & SEC_RELOC) != 0 && esdo->rel.hashes != NULL)
+ free (esdo->rel.hashes);
+ if ((o->flags & SEC_RELOC) != 0 && esdo->rela.hashes != NULL)
+ free (esdo->rela.hashes);
+ }
+}
/* Do the final step of an ELF link. */
@@ -11479,42 +11527,10 @@ bfd_elf_final_link (bfd *abfd, struct bf
goto error_return;
}
- if (info->eh_frame_hdr)
- {
- if (! _bfd_elf_write_section_eh_frame_hdr (abfd, info))
- goto error_return;
- }
+ if (! _bfd_elf_write_section_eh_frame_hdr (abfd, info))
+ goto error_return;
- if (flinfo.symstrtab != NULL)
- _bfd_stringtab_free (flinfo.symstrtab);
- if (flinfo.contents != NULL)
- free (flinfo.contents);
- if (flinfo.external_relocs != NULL)
- free (flinfo.external_relocs);
- if (flinfo.internal_relocs != NULL)
- free (flinfo.internal_relocs);
- if (flinfo.external_syms != NULL)
- free (flinfo.external_syms);
- if (flinfo.locsym_shndx != NULL)
- free (flinfo.locsym_shndx);
- if (flinfo.internal_syms != NULL)
- free (flinfo.internal_syms);
- if (flinfo.indices != NULL)
- free (flinfo.indices);
- if (flinfo.sections != NULL)
- free (flinfo.sections);
- if (flinfo.symbuf != NULL)
- free (flinfo.symbuf);
- if (flinfo.symshndxbuf != NULL)
- free (flinfo.symshndxbuf);
- for (o = abfd->sections; o != NULL; o = o->next)
- {
- struct bfd_elf_section_data *esdo = elf_section_data (o);
- if ((o->flags & SEC_RELOC) != 0 && esdo->rel.hashes != NULL)
- free (esdo->rel.hashes);
- if ((o->flags & SEC_RELOC) != 0 && esdo->rela.hashes != NULL)
- free (esdo->rela.hashes);
- }
+ elf_final_link_free (abfd, &flinfo);
elf_tdata (abfd)->linker = TRUE;
@@ -11531,37 +11547,7 @@ bfd_elf_final_link (bfd *abfd, struct bf
return TRUE;
error_return:
- if (flinfo.symstrtab != NULL)
- _bfd_stringtab_free (flinfo.symstrtab);
- if (flinfo.contents != NULL)
- free (flinfo.contents);
- if (flinfo.external_relocs != NULL)
- free (flinfo.external_relocs);
- if (flinfo.internal_relocs != NULL)
- free (flinfo.internal_relocs);
- if (flinfo.external_syms != NULL)
- free (flinfo.external_syms);
- if (flinfo.locsym_shndx != NULL)
- free (flinfo.locsym_shndx);
- if (flinfo.internal_syms != NULL)
- free (flinfo.internal_syms);
- if (flinfo.indices != NULL)
- free (flinfo.indices);
- if (flinfo.sections != NULL)
- free (flinfo.sections);
- if (flinfo.symbuf != NULL)
- free (flinfo.symbuf);
- if (flinfo.symshndxbuf != NULL)
- free (flinfo.symshndxbuf);
- for (o = abfd->sections; o != NULL; o = o->next)
- {
- struct bfd_elf_section_data *esdo = elf_section_data (o);
- if ((o->flags & SEC_RELOC) != 0 && esdo->rel.hashes != NULL)
- free (esdo->rel.hashes);
- if ((o->flags & SEC_RELOC) != 0 && esdo->rela.hashes != NULL)
- free (esdo->rela.hashes);
- }
-
+ elf_final_link_free (abfd, &flinfo);
return FALSE;
}
Index: bfd/elfxx-target.h
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-target.h,v
retrieving revision 1.130
diff -u -p -r1.130 elfxx-target.h
--- bfd/elfxx-target.h 23 Oct 2012 09:33:54 -0000 1.130
+++ bfd/elfxx-target.h 11 Feb 2013 02:00:40 -0000
@@ -233,7 +233,7 @@
#endif
#ifndef bfd_elfNN_bfd_link_hash_table_free
-#define bfd_elfNN_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
+#define bfd_elfNN_bfd_link_hash_table_free _bfd_elf_link_hash_table_free
#endif
#ifdef elf_backend_relocate_section
Index: bfd/libbfd-in.h
===================================================================
RCS file: /cvs/src/src/bfd/libbfd-in.h,v
retrieving revision 1.102
diff -u -p -r1.102 libbfd-in.h
--- bfd/libbfd-in.h 9 Aug 2012 06:25:52 -0000 1.102
+++ bfd/libbfd-in.h 11 Feb 2013 02:00:40 -0000
@@ -707,6 +707,10 @@ extern bfd_boolean _bfd_write_merged_sec
extern bfd_vma _bfd_merged_section_offset
(bfd *, asection **, void *, bfd_vma);
+/* Tidy up when done. */
+
+extern void _bfd_merge_sections_free (void *);
+
/* Create a string table. */
extern struct bfd_strtab_hash *_bfd_stringtab_init
(void);
Index: bfd/merge.c
===================================================================
RCS file: /cvs/src/src/bfd/merge.c,v
retrieving revision 1.42
diff -u -p -r1.42 merge.c
--- bfd/merge.c 29 Oct 2010 12:10:24 -0000 1.42
+++ bfd/merge.c 11 Feb 2013 02:00:40 -0000
@@ -885,3 +885,17 @@ _bfd_merged_section_offset (bfd *output_
*psec = entry->secinfo->sec;
return entry->u.index + (secinfo->contents + offset - p);
}
+
+/* Tidy up when done. */
+
+void
+_bfd_merge_sections_free (void *xsinfo)
+{
+ struct sec_merge_info *sinfo;
+
+ for (sinfo = (struct sec_merge_info *) xsinfo; sinfo; sinfo = sinfo->next)
+ {
+ bfd_hash_table_free (&sinfo->htab->table);
+ free (sinfo->htab);
+ }
+}
Index: bfd/elf-eh-frame.c
===================================================================
RCS file: /cvs/src/src/bfd/elf-eh-frame.c,v
retrieving revision 1.90
diff -u -p -r1.90 elf-eh-frame.c
--- bfd/elf-eh-frame.c 25 May 2012 01:12:19 -0000 1.90
+++ bfd/elf-eh-frame.c 11 Feb 2013 02:00:37 -0000
@@ -1770,74 +1770,81 @@ _bfd_elf_write_section_eh_frame_hdr (bfd
struct elf_link_hash_table *htab;
struct eh_frame_hdr_info *hdr_info;
asection *sec;
- bfd_byte *contents;
- asection *eh_frame_sec;
- bfd_size_type size;
- bfd_boolean retval;
- bfd_vma encoded_eh_frame;
+ bfd_boolean retval = TRUE;
htab = elf_hash_table (info);
hdr_info = &htab->eh_info;
sec = hdr_info->hdr_sec;
- if (sec == NULL)
- return TRUE;
- size = EH_FRAME_HDR_SIZE;
- if (hdr_info->array && hdr_info->array_count == hdr_info->fde_count)
- size += 4 + hdr_info->fde_count * 8;
- contents = (bfd_byte *) bfd_malloc (size);
- if (contents == NULL)
- return FALSE;
-
- eh_frame_sec = bfd_get_section_by_name (abfd, ".eh_frame");
- if (eh_frame_sec == NULL)
+ if (info->eh_frame_hdr && sec != NULL)
{
- free (contents);
- return FALSE;
- }
+ bfd_byte *contents;
+ asection *eh_frame_sec;
+ bfd_size_type size;
+ bfd_vma encoded_eh_frame;
+
+ size = EH_FRAME_HDR_SIZE;
+ if (hdr_info->array && hdr_info->array_count == hdr_info->fde_count)
+ size += 4 + hdr_info->fde_count * 8;
+ contents = (bfd_byte *) bfd_malloc (size);
+ if (contents == NULL)
+ return FALSE;
- memset (contents, 0, EH_FRAME_HDR_SIZE);
- contents[0] = 1; /* Version. */
- contents[1] = get_elf_backend_data (abfd)->elf_backend_encode_eh_address
- (abfd, info, eh_frame_sec, 0, sec, 4,
- &encoded_eh_frame); /* .eh_frame offset. */
+ eh_frame_sec = bfd_get_section_by_name (abfd, ".eh_frame");
+ if (eh_frame_sec == NULL)
+ {
+ free (contents);
+ return FALSE;
+ }
- if (hdr_info->array && hdr_info->array_count == hdr_info->fde_count)
- {
- contents[2] = DW_EH_PE_udata4; /* FDE count encoding. */
- contents[3] = DW_EH_PE_datarel | DW_EH_PE_sdata4; /* Search table enc. */
- }
- else
- {
- contents[2] = DW_EH_PE_omit;
- contents[3] = DW_EH_PE_omit;
- }
- bfd_put_32 (abfd, encoded_eh_frame, contents + 4);
+ memset (contents, 0, EH_FRAME_HDR_SIZE);
+ /* Version. */
+ contents[0] = 1;
+ /* .eh_frame offset. */
+ contents[1] = get_elf_backend_data (abfd)->elf_backend_encode_eh_address
+ (abfd, info, eh_frame_sec, 0, sec, 4, &encoded_eh_frame);
- if (contents[2] != DW_EH_PE_omit)
- {
- unsigned int i;
+ if (hdr_info->array && hdr_info->array_count == hdr_info->fde_count)
+ {
+ /* FDE count encoding. */
+ contents[2] = DW_EH_PE_udata4;
+ /* Search table encoding. */
+ contents[3] = DW_EH_PE_datarel | DW_EH_PE_sdata4;
+ }
+ else
+ {
+ contents[2] = DW_EH_PE_omit;
+ contents[3] = DW_EH_PE_omit;
+ }
+ bfd_put_32 (abfd, encoded_eh_frame, contents + 4);
- bfd_put_32 (abfd, hdr_info->fde_count, contents + EH_FRAME_HDR_SIZE);
- qsort (hdr_info->array, hdr_info->fde_count, sizeof (*hdr_info->array),
- vma_compare);
- for (i = 0; i < hdr_info->fde_count; i++)
+ if (contents[2] != DW_EH_PE_omit)
{
- bfd_put_32 (abfd,
- hdr_info->array[i].initial_loc
- - sec->output_section->vma,
- contents + EH_FRAME_HDR_SIZE + i * 8 + 4);
- bfd_put_32 (abfd,
- hdr_info->array[i].fde - sec->output_section->vma,
- contents + EH_FRAME_HDR_SIZE + i * 8 + 8);
+ unsigned int i;
+
+ bfd_put_32 (abfd, hdr_info->fde_count, contents + EH_FRAME_HDR_SIZE);
+ qsort (hdr_info->array, hdr_info->fde_count,
+ sizeof (*hdr_info->array), vma_compare);
+ for (i = 0; i < hdr_info->fde_count; i++)
+ {
+ bfd_put_32 (abfd,
+ hdr_info->array[i].initial_loc
+ - sec->output_section->vma,
+ contents + EH_FRAME_HDR_SIZE + i * 8 + 4);
+ bfd_put_32 (abfd,
+ hdr_info->array[i].fde - sec->output_section->vma,
+ contents + EH_FRAME_HDR_SIZE + i * 8 + 8);
+ }
}
- }
- /* FIXME: octets_per_byte. */
- retval = bfd_set_section_contents (abfd, sec->output_section,
- contents, (file_ptr) sec->output_offset,
- sec->size);
- free (contents);
+ /* FIXME: octets_per_byte. */
+ retval = bfd_set_section_contents (abfd, sec->output_section, contents,
+ (file_ptr) sec->output_offset,
+ sec->size);
+ free (contents);
+ }
+ if (hdr_info->array != NULL)
+ free (hdr_info->array);
return retval;
}
Index: bfd/elf-m10300.c
===================================================================
RCS file: /cvs/src/src/bfd/elf-m10300.c,v
retrieving revision 1.119
diff -u -p -r1.119 elf-m10300.c
--- bfd/elf-m10300.c 10 Feb 2013 04:36:30 -0000 1.119
+++ bfd/elf-m10300.c 11 Feb 2013 02:00:37 -0000
@@ -4646,9 +4646,9 @@ elf32_mn10300_link_hash_table_free (stru
struct elf32_mn10300_link_hash_table *ret
= (struct elf32_mn10300_link_hash_table *) hash;
- _bfd_generic_link_hash_table_free
+ _bfd_elf_link_hash_table_free
((struct bfd_link_hash_table *) ret->static_hash_table);
- _bfd_generic_link_hash_table_free
+ _bfd_elf_link_hash_table_free
((struct bfd_link_hash_table *) ret);
}
Index: bfd/elf32-arm.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-arm.c,v
retrieving revision 1.306
diff -u -p -r1.306 elf32-arm.c
--- bfd/elf32-arm.c 10 Feb 2013 04:36:30 -0000 1.306
+++ bfd/elf32-arm.c 11 Feb 2013 02:00:38 -0000
@@ -3460,7 +3460,7 @@ elf32_arm_hash_table_free (struct bfd_li
= (struct elf32_arm_link_hash_table *) hash;
bfd_hash_table_free (&ret->stub_hash_table);
- _bfd_generic_link_hash_table_free (hash);
+ _bfd_elf_link_hash_table_free (hash);
}
/* Determine if we're dealing with a Thumb only architecture. */
Index: bfd/elf32-avr.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-avr.c,v
retrieving revision 1.60
diff -u -p -r1.60 elf32-avr.c
--- bfd/elf32-avr.c 10 Feb 2013 04:36:31 -0000 1.60
+++ bfd/elf32-avr.c 11 Feb 2013 02:00:38 -0000
@@ -708,7 +708,7 @@ elf32_avr_link_hash_table_free (struct b
free (htab->amt_destination_addr);
bfd_hash_table_free (&htab->bstab);
- _bfd_generic_link_hash_table_free (btab);
+ _bfd_elf_link_hash_table_free (btab);
}
/* Calculates the effective distance of a pc relative jump/call. */
Index: bfd/elf32-cr16.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-cr16.c,v
retrieving revision 1.24
diff -u -p -r1.24 elf32-cr16.c
--- bfd/elf32-cr16.c 10 Feb 2013 04:36:31 -0000 1.24
+++ bfd/elf32-cr16.c 11 Feb 2013 02:00:38 -0000
@@ -1676,18 +1676,6 @@ elf32_cr16_link_hash_table_create (bfd *
return &ret->root;
}
-/* Free an cr16 ELF linker hash table. */
-
-static void
-elf32_cr16_link_hash_table_free (struct bfd_link_hash_table *hash)
-{
- struct elf_link_hash_table *ret
- = (struct elf_link_hash_table *) hash;
-
- _bfd_generic_link_hash_table_free
- ((struct bfd_link_hash_table *) ret);
-}
-
static unsigned long
elf_cr16_mach (flagword flags)
{
@@ -2973,8 +2961,6 @@ _bfd_cr16_elf_reloc_type_class (const El
#define bfd_elf32_bfd_link_hash_table_create \
elf32_cr16_link_hash_table_create
-#define bfd_elf32_bfd_link_hash_table_free \
- elf32_cr16_link_hash_table_free
#define elf_backend_create_dynamic_sections \
_bfd_cr16_elf_create_dynamic_sections
Index: bfd/elf32-hppa.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-hppa.c,v
retrieving revision 1.190
diff -u -p -r1.190 elf32-hppa.c
--- bfd/elf32-hppa.c 10 Feb 2013 04:36:31 -0000 1.190
+++ bfd/elf32-hppa.c 11 Feb 2013 02:00:38 -0000
@@ -450,7 +450,7 @@ elf32_hppa_link_hash_table_free (struct
= (struct elf32_hppa_link_hash_table *) btab;
bfd_hash_table_free (&htab->bstab);
- _bfd_generic_link_hash_table_free (btab);
+ _bfd_elf_link_hash_table_free (btab);
}
/* Build a name for an entry in the stub hash table. */
Index: bfd/elf32-i386.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-i386.c,v
retrieving revision 1.300
diff -u -p -r1.300 elf32-i386.c
--- bfd/elf32-i386.c 10 Feb 2013 04:36:31 -0000 1.300
+++ bfd/elf32-i386.c 11 Feb 2013 02:00:38 -0000
@@ -976,7 +976,7 @@ elf_i386_link_hash_table_free (struct bf
htab_delete (htab->loc_hash_table);
if (htab->loc_hash_memory)
objalloc_free ((struct objalloc *) htab->loc_hash_memory);
- _bfd_generic_link_hash_table_free (hash);
+ _bfd_elf_link_hash_table_free (hash);
}
/* Create .plt, .rel.plt, .got, .got.plt, .rel.got, .dynbss, and
Index: bfd/elf32-m68hc1x.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-m68hc1x.c,v
retrieving revision 1.50
diff -u -p -r1.50 elf32-m68hc1x.c
--- bfd/elf32-m68hc1x.c 10 Feb 2013 04:36:31 -0000 1.50
+++ bfd/elf32-m68hc1x.c 11 Feb 2013 02:00:38 -0000
@@ -105,7 +105,7 @@ m68hc11_elf_bfd_link_hash_table_free (st
bfd_hash_table_free (ret->stub_hash_table);
free (ret->stub_hash_table);
- _bfd_generic_link_hash_table_free (hash);
+ _bfd_elf_link_hash_table_free (hash);
}
/* Assorted hash table functions. */
Index: bfd/elf32-m68k.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-m68k.c,v
retrieving revision 1.138
diff -u -p -r1.138 elf32-m68k.c
--- bfd/elf32-m68k.c 10 Feb 2013 04:36:31 -0000 1.138
+++ bfd/elf32-m68k.c 11 Feb 2013 02:00:38 -0000
@@ -982,6 +982,7 @@ elf_m68k_link_hash_table_free (struct bf
htab_delete (htab->multi_got_.bfd2got);
htab->multi_got_.bfd2got = NULL;
}
+ _bfd_elf_link_hash_table_free (_htab);
}
/* Set the right machine number. */
Index: bfd/elf32-metag.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-metag.c,v
retrieving revision 1.5
diff -u -p -r1.5 elf32-metag.c
--- bfd/elf32-metag.c 10 Feb 2013 04:36:32 -0000 1.5
+++ bfd/elf32-metag.c 11 Feb 2013 02:00:39 -0000
@@ -1057,7 +1057,7 @@ elf_metag_link_hash_table_free (struct b
= (struct elf_metag_link_hash_table *) btab;
bfd_hash_table_free (&htab->bstab);
- _bfd_generic_link_hash_table_free (btab);
+ _bfd_elf_link_hash_table_free (btab);
}
/* Section name for stubs is the associated section name plus this
Index: bfd/elf32-tic6x.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-tic6x.c,v
retrieving revision 1.36
diff -u -p -r1.36 elf32-tic6x.c
--- bfd/elf32-tic6x.c 10 Feb 2013 04:36:32 -0000 1.36
+++ bfd/elf32-tic6x.c 11 Feb 2013 02:00:39 -0000
@@ -1614,14 +1614,6 @@ elf32_tic6x_final_link (bfd *abfd, struc
return TRUE;
}
-/* Destroy a C6X ELF linker hash table. */
-
-static void
-elf32_tic6x_link_hash_table_free (struct bfd_link_hash_table *hash)
-{
- _bfd_generic_link_hash_table_free (hash);
-}
-
/* Called to pass PARAMS to the backend. We store them in the hash table
associated with INFO. */
@@ -4374,7 +4366,6 @@ elf32_tic6x_set_osabi (bfd *abfd, struct
#define bfd_elf32_bfd_merge_private_bfd_data elf32_tic6x_merge_private_bfd_data
#define bfd_elf32_mkobject elf32_tic6x_mkobject
#define bfd_elf32_bfd_link_hash_table_create elf32_tic6x_link_hash_table_create
-#define bfd_elf32_bfd_link_hash_table_free elf32_tic6x_link_hash_table_free
#define bfd_elf32_new_section_hook elf32_tic6x_new_section_hook
#define elf_backend_stack_align 8
#define elf_backend_can_gc_sections 1
Index: bfd/elf32-xgate.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-xgate.c,v
retrieving revision 1.4
diff -u -p -r1.4 elf32-xgate.c
--- bfd/elf32-xgate.c 10 Feb 2013 04:36:32 -0000 1.4
+++ bfd/elf32-xgate.c 11 Feb 2013 02:00:39 -0000
@@ -437,7 +437,7 @@ xgate_elf_bfd_link_hash_table_free (stru
bfd_hash_table_free (ret->stub_hash_table);
free (ret->stub_hash_table);
- _bfd_generic_link_hash_table_free (hash);
+ _bfd_elf_link_hash_table_free (hash);
}
/* Create a XGATE ELF linker hash table. */
Index: bfd/elf64-aarch64.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-aarch64.c,v
retrieving revision 1.7
diff -u -p -r1.7 elf64-aarch64.c
--- bfd/elf64-aarch64.c 10 Feb 2013 04:36:32 -0000 1.7
+++ bfd/elf64-aarch64.c 11 Feb 2013 02:00:39 -0000
@@ -2129,7 +2129,7 @@ elf64_aarch64_hash_table_free (struct bf
= (struct elf64_aarch64_link_hash_table *) hash;
bfd_hash_table_free (&ret->stub_hash_table);
- _bfd_generic_link_hash_table_free (hash);
+ _bfd_elf_link_hash_table_free (hash);
}
static bfd_vma
Index: bfd/elf64-ia64-vms.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-ia64-vms.c,v
retrieving revision 1.6
diff -u -p -r1.6 elf64-ia64-vms.c
--- bfd/elf64-ia64-vms.c 2 Sep 2012 12:17:26 -0000 1.6
+++ bfd/elf64-ia64-vms.c 11 Feb 2013 02:00:39 -0000
@@ -1072,7 +1072,7 @@ elf64_ia64_hash_table_free (struct bfd_l
objalloc_free ((struct objalloc *) ia64_info->loc_hash_memory);
elf_link_hash_traverse (&ia64_info->root,
elf64_ia64_global_dyn_info_free, NULL);
- _bfd_generic_link_hash_table_free (hash);
+ _bfd_elf_link_hash_table_free (hash);
}
/* Traverse both local and global hash tables. */
Index: bfd/elf64-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-ppc.c,v
retrieving revision 1.403
diff -u -p -r1.403 elf64-ppc.c
--- bfd/elf64-ppc.c 1 Feb 2013 11:06:37 -0000 1.403
+++ bfd/elf64-ppc.c 11 Feb 2013 02:00:40 -0000
@@ -4043,7 +4043,7 @@ ppc64_elf_link_hash_table_free (struct b
bfd_hash_table_free (&htab->branch_hash_table);
if (htab->tocsave_htab)
htab_delete (htab->tocsave_htab);
- _bfd_generic_link_hash_table_free (hash);
+ _bfd_elf_link_hash_table_free (hash);
}
/* Satisfy the ELF linker by filling in some fields in our fake bfd. */
Index: bfd/elf64-x86-64.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-x86-64.c,v
retrieving revision 1.291
diff -u -p -r1.291 elf64-x86-64.c
--- bfd/elf64-x86-64.c 10 Feb 2013 04:36:32 -0000 1.291
+++ bfd/elf64-x86-64.c 11 Feb 2013 02:00:40 -0000
@@ -944,7 +944,7 @@ elf_x86_64_link_hash_table_free (struct
htab_delete (htab->loc_hash_table);
if (htab->loc_hash_memory)
objalloc_free ((struct objalloc *) htab->loc_hash_memory);
- _bfd_generic_link_hash_table_free (hash);
+ _bfd_elf_link_hash_table_free (hash);
}
/* Create .plt, .rela.plt, .got, .got.plt, .rela.got, .dynbss, and
Index: bfd/elfnn-ia64.c
===================================================================
RCS file: /cvs/src/src/bfd/elfnn-ia64.c,v
retrieving revision 1.12
diff -u -p -r1.12 elfnn-ia64.c
--- bfd/elfnn-ia64.c 2 Sep 2012 12:17:27 -0000 1.12
+++ bfd/elfnn-ia64.c 11 Feb 2013 02:00:40 -0000
@@ -1463,7 +1463,7 @@ elfNN_ia64_hash_table_free (struct bfd_l
objalloc_free ((struct objalloc *) ia64_info->loc_hash_memory);
elf_link_hash_traverse (&ia64_info->root,
elfNN_ia64_global_dyn_info_free, NULL);
- _bfd_generic_link_hash_table_free (hash);
+ _bfd_elf_link_hash_table_free (hash);
}
/* Traverse both local and global hash tables. */
--
Alan Modra
Australia Development Lab, IBM