[PATCH, gas] PC-relative fx_offset calculation
Fri Mar 1 15:50:00 GMT 2013
On 2013/3/1 10:30 PM, Ian Lance Taylor wrote:
> On Fri, Mar 1, 2013 at 6:02 AM, Chung-Lin Tang <firstname.lastname@example.org> wrote:
>> Hi, this patch corrects the PC-relative case in write.c:fixup_segment()
>> where the location of the fix seems to incorrectly use fx_dot_value +
>> fx_frag->fr_address, rather than fx_where + fx_frag->fr_address.
> When making this sort of change to gas internals, it's important to
> test a range of targets to see whether they break or not.
A make check of x86_64 and nios2 (what I'm working on) shows no
regressions, I'll check a few more.
> The fx_dot_value field was introduced here:
> http://sourceware.org/ml/binutils/2002-09/msg00359.html . You should
> go look at the test case in that thread and see what happens with your
Thanks for pointing to this. I checked the alpha testcase in the
beginning of that thread, and it does display correctly:
Relocation section '.relafoo' at offset 0x3b8 contains 1 entries:
Offset Info Type Sym. Value Sym. Name
000000000004 00060000000a R_ALPHA_SREL32 0000000000000000 BAR + 0
I do believe my change tries to do conceptually the same thing as the
original patch in that thread.
> Perhaps the code that is calling frag_more needs to set dot_value.
I don't think the nios2 port is doing anything special, so I sort of
doubt that's the case. In fact, the current code actually works most of
the time, except when we have the unfortunate condition of a new frag
created exactly on the low-part addi insn of a GOT offset calculation :P
CCing the people that appeared in the above thread, any comments on the
More information about the Binutils