This is the mail archive of the binutils@sources.redhat.com 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: Problem with string merging and PC relative relocations


On Mon, Feb 11, 2002 at 10:07:05AM -0800, Geoff Keating wrote:
> > Has anybody an idea how to fix this?
> 
> Remove the warning.

No.

> Relocs can have arbitrary offsets, and just
> because a reloc is to an address that doesn't appear to be inside the
> section doesn't mean that the final reference is to that address.
> 
> For instance, given
> 
> int foo(int b)
> {
>   return "abcdef"[b-10];
> }
> 
> it's perfectly valid to generate a reloc to the address of the string
> minus 10, and in fact this is the most efficient code.

This should result in relocation against .LCxyz - 10, not
.rodata.str1.1 + 752 (until final link), exactly so that this information is
preserved.
Previously, gas did not change any relocs against SHF_MERGE .L* symbols into
STT_SECTION + addend, now it does so if it points right to the start of the
string (the most common case).

	Jakub


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