aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2005-08-08 11:06:16 +0000
committerNick Clifton <nickc@redhat.com>2005-08-08 11:06:16 +0000
commit957c6e41daa2c75e9e88c85d0076f475a5810d49 (patch)
tree232d5f4dfca334cd06eff59157227deefea0d587
parent55db4b870f42b93af44182b86e64c06e331afd82 (diff)
downloadgdb-957c6e41daa2c75e9e88c85d0076f475a5810d49.zip
gdb-957c6e41daa2c75e9e88c85d0076f475a5810d49.tar.gz
gdb-957c6e41daa2c75e9e88c85d0076f475a5810d49.tar.bz2
PR 1147
elf32-arm.c (bfd_elf32_close_and_cleanup): Define. (elf32_arm_close_and_cleanup): New function - walk over the sections in the bfd that is being closed removing them from the list of recorded sections. (unrecord_section_via_map_over_sections): New helper function. (record_section_with_arm_elf_section_data): Call bfd_malloc instead of bfd_alloc. Remove unneeded abfd parameter. (elf32_arm_new_section_hook): Do not pass bfd to record_section_with_arm_elf_section_data. elfxx-target.h (bfd_elfNN_close_and_cleanup): Only define if not already defined by the target.
-rw-r--r--bfd/ChangeLog17
-rw-r--r--bfd/elf32-arm.c23
-rw-r--r--bfd/elfxx-target.h2
3 files changed, 39 insertions, 3 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 2b797d4..c9366e8 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,20 @@
+2005-08-07 Nick Clifton <nickc@redhat.com>
+ Paul Brook <paul@codesourcery.com>
+
+ PR 1147
+ * elf32-arm.c (bfd_elf32_close_and_cleanup): Define.
+ (elf32_arm_close_and_cleanup): New function - walk over the
+ sections in the bfd that is being closed removing them from the
+ list of recorded sections.
+ (unrecord_section_via_map_over_sections): New helper function.
+ (record_section_with_arm_elf_section_data): Call bfd_malloc
+ instead of bfd_alloc. Remove unneeded abfd parameter.
+ (elf32_arm_new_section_hook): Do not pass bfd to
+ record_section_with_arm_elf_section_data.
+
+ * elfxx-target.h (bfd_elfNN_close_and_cleanup): Only define if not
+ already defined by the target.
+
2005-08-05 Fred Fish <fnf@specifix.com>
* dwarf2.c (read_rangelist): Use addr_size instead of offset_size
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index 147a7a5..ae57dd2 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -6532,11 +6532,11 @@ section_list;
static section_list * sections_with_arm_elf_section_data = NULL;
static void
-record_section_with_arm_elf_section_data (bfd * abfd, asection * sec)
+record_section_with_arm_elf_section_data (asection * sec)
{
struct section_list * entry;
- entry = bfd_alloc (abfd, sizeof (* entry));
+ entry = bfd_malloc (sizeof (* entry));
if (entry == NULL)
return;
entry->sec = sec;
@@ -6642,7 +6642,7 @@ elf32_arm_new_section_hook (bfd *abfd, asection *sec)
return FALSE;
sec->used_by_bfd = sdata;
- record_section_with_arm_elf_section_data (abfd, sec);
+ record_section_with_arm_elf_section_data (sec);
return _bfd_elf_new_section_hook (abfd, sec);
}
@@ -6739,6 +6739,22 @@ elf32_arm_write_section (bfd *output_bfd ATTRIBUTE_UNUSED, asection *sec,
return FALSE;
}
+static void
+unrecord_section_via_map_over_sections (bfd * abfd ATTRIBUTE_UNUSED,
+ asection * sec,
+ void * ignore ATTRIBUTE_UNUSED)
+{
+ unrecord_section_with_arm_elf_section_data (sec);
+}
+
+static bfd_boolean
+elf32_arm_close_and_cleanup (bfd * abfd)
+{
+ bfd_map_over_sections (abfd, unrecord_section_via_map_over_sections, NULL);
+
+ return _bfd_elf_close_and_cleanup (abfd);
+}
+
/* Display STT_ARM_TFUNC symbols as functions. */
static void
@@ -6897,6 +6913,7 @@ const struct elf_size_info elf32_arm_size_info = {
#define bfd_elf32_find_inliner_info elf32_arm_find_inliner_info
#define bfd_elf32_new_section_hook elf32_arm_new_section_hook
#define bfd_elf32_bfd_is_target_special_symbol elf32_arm_is_target_special_symbol
+#define bfd_elf32_close_and_cleanup elf32_arm_close_and_cleanup
#define elf_backend_get_symbol_type elf32_arm_get_symbol_type
#define elf_backend_gc_mark_hook elf32_arm_gc_mark_hook
diff --git a/bfd/elfxx-target.h b/bfd/elfxx-target.h
index 624b31c..2c9aa19 100644
--- a/bfd/elfxx-target.h
+++ b/bfd/elfxx-target.h
@@ -26,7 +26,9 @@
There are two such structures here: one for big-endian machines and
one for little-endian machines. */
+#ifndef bfd_elfNN_close_and_cleanup
#define bfd_elfNN_close_and_cleanup _bfd_elf_close_and_cleanup
+#endif
#define bfd_elfNN_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
#ifndef bfd_elfNN_get_section_contents
#define bfd_elfNN_get_section_contents _bfd_generic_get_section_contents