This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[ARM] fix handling of "merge strings" sections
- From: Christophe LYON <christophe dot lyon at st dot com>
- To: binutils at sourceware dot org
- Date: Tue, 27 Nov 2007 17:23:12 +0100
- Subject: [ARM] fix handling of "merge strings" sections
Hello,
I propose the following patch to address an issue with code generated by
ARM's RVCT 2.2 compiler (which was fixed by 3.0 SP1).
It occurs when the compiler generates data with pointers to strings.
You end up with something like (assembly file)
[...]
DCD ||.conststring$3||+0x1a4
[...]
AREA ||.conststring||, DATA, READONLY, MERGE=1, STRINGS, ALIGN=0
||.conststring$3||
DCB 0x44,0x4d,0x41,0x00
[...]
As the ".conststring" section has the MERGE attribute, the addend
attribute of the (.conststring$3 + 0x1a4) relocation should be patched,
but such patching is currently only performed on symbols with
STT_SECTION attribute (ie ".conststring + 0x1a4).
I propose:
2007-11-27 Christophe Lyon <christophe.lyon@st.com>
bfd/elf32-arm.c: Update addend for relocations to sections with
MERGE and STRINGS attributes.
Index: bfd/elf32-arm.c
===================================================================
--- bfd/elf32-arm.c (revision 220)
+++ bfd/elf32-arm.c (working copy)
@@ -5660,7 +5660,12 @@ elf32_arm_relocate_section (bfd *
+ sec->output_offset
+ sym->st_value);
if ((sec->flags & SEC_MERGE)
- && ELF_ST_TYPE (sym->st_info) == STT_SECTION)
+ && (
+ (ELF_ST_TYPE (sym->st_info) == STT_SECTION)
+ ||
+ (sec->flags & SEC_STRINGS)
+ )
+ )
{
asection *msec;
bfd_vma addend, value;
Christophe.