[ARM] fix handling of "merge strings" sections
Christophe LYON
christophe.lyon@st.com
Tue Nov 27 16:23:00 GMT 2007
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.
More information about the Binutils
mailing list