This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [ARM] fix handling of "merge strings" sections
- From: Paul Brook <paul at codesourcery dot com>
- To: binutils at sourceware dot org
- Cc: Christophe LYON <christophe dot lyon at st dot com>
- Date: Wed, 28 Nov 2007 00:26:47 +0000
- Subject: Re: [ARM] fix handling of "merge strings" sections
- References: <474C4470.1040903@st.com>
On Tuesday 27 November 2007, Christophe LYON wrote:
> 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).
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.
One of the justifications for the GCC case is that C allows you to address one
past the end of an object. e.g.
const char * foo = "bar" + 4;
I'm fairly sure this will break if you use the ARM semantics, and I believe
there were other examples. GCC also exploits this property to fold constant
offsets into relocation addends. e.g.:
char *foo(int x)
{
return &("foo")[x + 10];
}
Paul