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 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];


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