This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: arm-elf-ld 2.16.1 crash at bfd/elf32-arm.c:5536
- From: Paul Brook <paul at codesourcery dot com>
- To: binutils at sources dot redhat dot com
- Cc: Nick Clifton <nickc at redhat dot com>,Shaun Jackman <sjackman at gmail dot com>
- Date: Sun, 7 Aug 2005 13:32:22 +0100
- Subject: Re: arm-elf-ld 2.16.1 crash at bfd/elf32-arm.c:5536
- References: <7f45d939050728162929bb9286@mail.gmail.com> <200508052302.59210.paul@codesourcery.com> <42F5D267.7010706@redhat.com>
On Sunday 07 August 2005 10:20, Nick Clifton wrote:
> Hi Paul,
>
> > This has broken arm-unknown-eabi-ar.
>
> I have reopened PR 1147 and placed a second patch there - please could
> you try it out and let me know if you have any problems with it.
Nearly. A couple of bugs: You were only defining bfd_elf32_close_and_cleanup
for the symbian configuration, and and
unrecord_section_with_arm_elf_section_data was trying to free() memory not
allocated with malloc.
Updated patch attached.
Ok?
Paul
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.
(unrecord_section_with_arm_elf_section_data): Remove call to free.
* elfxx-target.h (bfd_elfNN_close_and_cleanup): Only define if not
already defined by the target.
Index: bfd/elf32-arm.c
===================================================================
RCS file: /var/cvsroot/src-cvs/src/bfd/elf32-arm.c,v
retrieving revision 1.50
diff -u -p -r1.50 elf32-arm.c
--- bfd/elf32-arm.c 2 Aug 2005 08:17:45 -0000 1.50
+++ bfd/elf32-arm.c 7 Aug 2005 11:27:13 -0000
@@ -6572,7 +6572,6 @@ unrecord_section_with_arm_elf_section_da
entry->next->prev = entry->prev;
if (entry == sections_with_arm_elf_section_data)
sections_with_arm_elf_section_data = entry->next;
- free (entry);
break;
}
}
@@ -6739,6 +6738,22 @@ elf32_arm_write_section (bfd *output_bfd
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 +6912,7 @@ const struct elf_size_info elf32_arm_siz
#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
Index: bfd/elfxx-target.h
===================================================================
RCS file: /var/cvsroot/src-cvs/src/bfd/elfxx-target.h,v
retrieving revision 1.88
diff -u -p -r1.88 elfxx-target.h
--- bfd/elfxx-target.h 29 Jul 2005 02:46:04 -0000 1.88
+++ bfd/elfxx-target.h 7 Aug 2005 10:27:18 -0000
@@ -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