This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
ARM: Fix mapping symbols for empty sections
- From: Daniel Jacobowitz <dan at codesourcery dot com>
- To: binutils at sourceware dot org
- Date: Wed, 3 Mar 2010 13:00:57 -0500
- Subject: ARM: Fix mapping symbols for empty sections
LD recently, correctly, began creating $d mapping symbols when a
section with contents but no mapping symbols was included in an output
section. Otherwise, a previous mapping symbol will be incorrectly
assumed to apply to the new data. However, we didn't check for empty
output sections - this is important, because we can end up with two
mapping symbols at the same offset otherwise. Then there's no way to
figure out which one applies.
I've tested this patch on arm-none-eabi, and committed it to HEAD.
The problem isn't present in binutils 2.20.
--
Daniel Jacobowitz
CodeSourcery
2010-03-03 Daniel Jacobowitz <dan@codesourcery.com>
* elf32-arm.c (elf32_arm_output_arch_local_syms): Do not add
a mapping symbol to an empty section.
Index: elf32-arm.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-arm.c,v
retrieving revision 1.225
diff -u -p -r1.225 elf32-arm.c
--- elf32-arm.c 2 Mar 2010 11:40:24 -0000 1.225
+++ elf32-arm.c 3 Mar 2010 17:55:17 -0000
@@ -13175,7 +13175,8 @@ elf32_arm_output_arch_local_syms (bfd *o
&& (osi.sec->flags & (SEC_HAS_CONTENTS | SEC_LINKER_CREATED))
== SEC_HAS_CONTENTS
&& get_arm_elf_section_data (osi.sec) != NULL
- && get_arm_elf_section_data (osi.sec)->mapcount == 0)
+ && get_arm_elf_section_data (osi.sec)->mapcount == 0
+ && osi.sec->size > 0)
{
osi.sec_shndx = _bfd_elf_section_from_bfd_section
(output_bfd, osi.sec->output_section);