This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
a couple of small patches
- From: Phil Blundell <pb at reciva dot com>
- To: binutils at sourceware dot org
- Date: Wed, 10 Jun 2009 11:05:15 +0100
- Subject: a couple of small patches
With the current cvs head, ld configured for --target=arm-linuxgnueabi
will crash if invoked with something like "ld -b binary /dev/null".
(Useless though this seems, it appears to be a fairly common idiom for
programs to use when they're trying to check for supported linker
options from an autoconf script.)
Here are two patches, one for ld and one for bfd, which clear up the
segfault for me.
p.
2009-06-10 Philip Blundell <philb@gnu.org>
* emultempl/armelf.em (gld${EMULATION_NAME}_finish): Avoid crash
if section has no ELF data.
Index: ld/emultempl/armelf.em
===================================================================
RCS file: /cvs/src/src/ld/emultempl/armelf.em,v
retrieving revision 1.73
diff -u -r1.73 armelf.em
--- ld/emultempl/armelf.em 22 May 2009 11:58:45 -0000 1.73
+++ ld/emultempl/armelf.em 10 Jun 2009 09:28:47 -0000
@@ -309,6 +309,7 @@
asection *out_sec = sec->output_section;
if (out_sec
+ && elf_section_data (sec)
&& elf_section_type (sec) == SHT_PROGBITS
&& (elf_section_flags (sec) & SHF_EXECINSTR) != 0
&& (sec->flags & SEC_EXCLUDE) == 0
2009-06-10 Philip Blundell <philb@gnu.org>
* elf32-arm.c (elf32_arm_fix_exidx_coverage): Avoid crash if
elf_sec->this_hdr == NULL.
Index: bfd/elf32-arm.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-arm.c,v
retrieving revision 1.196
diff -u -r1.196 elf32-arm.c
--- bfd/elf32-arm.c 22 May 2009 11:58:44 -0000 1.196
+++ bfd/elf32-arm.c 10 Jun 2009 09:31:09 -0000
@@ -8960,7 +8960,7 @@
struct bfd_elf_section_data *elf_sec = elf_section_data (sec);
Elf_Internal_Shdr *hdr = &elf_sec->this_hdr;
- if (hdr->sh_type != SHT_ARM_EXIDX)
+ if (!hdr || hdr->sh_type != SHT_ARM_EXIDX)
continue;
if (elf_sec->linked_to)