This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [ARM] fix handling of "merge strings" sections

On 28.11.2007 01:26, Paul Brook wrote:
On Tuesday 27 November 2007, Christophe LYON wrote:

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).

Code generated by RVCT2.2 and code generated by gcc are fundamentally incompatible in this area. ie. fixing one will break the other. rvct2.2 assumes that a relocation refers to the string at the location after applying the relocation addend. gcc assumes the relocation refers to the object at the location of the base symbol.

The ELF standard gives no clear indication which answer is correct. After consultation withe ARM is was decided that the the ARM EABI should follow the gcc semantics.

OK, I knew that last point.

Thanks for your examples breaking GCC semantics.

The problem I have is that I have to link using GNU ld, using libraries compiled with RVCT-2.2 (no way to upgrade the compiler), so the only possible workaround I see is modifying GNU ld to handle this corner case.
I propose to restrain further the condition to the ".conststring" section (which I believe is not used by GCC) to be safer.


Index: bfd/elf32-arm.c =================================================================== --- bfd/elf32-arm.c (revision 220) +++ bfd/elf32-arm.c (working copy) @@ -5660,7 +5660,13 @@ 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) + && strcmp(sec->name, ".conststring")==0 ) + ) + ) { asection *msec; bfd_vma addend, value;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]