[PATCH, gas] PC-relative fx_offset calculation

Chung-Lin Tang cltang@codesourcery.com
Fri Mar 8 10:19:00 GMT 2013

On 2013/3/8 06:31 AM, Alan Modra wrote:
> On Thu, Mar 07, 2013 at 01:39:00PM +0800, Chung-Lin Tang wrote:
>> On 2013/3/6 06:28 PM, Alan Modra wrote:
>>> On Wed, Mar 06, 2013 at 02:37:00PM +0800, Chung-Lin Tang wrote:
>>>> This is only lightly tested so far, WDYT? (I believe this patch should
>>>> make more sense now...)
>>> Yes, it makes sense, but why is it that you need to call frag_more in
>>> the middle of assembling an instruction?  The normal course of action
>>> is to parse the insn, call frag_more when you know the size (or max
>>> size) of the insn, then emit insn bytes and any fixups.
>> I don't think the nios2 port is calling frag_more() like that. The
>> overall sequence of actions is like the way you described.
> OK.
>> However it seems that, dot_value is recorded during the parsing (when
>> expression() is called), and the subsequent frag_more() call may create
>> a new frag, causing mismatch of fx_frag and fx_dot_value when creating
>> the new fix.
> Huh.  I think you're correct.  If you can commit your patch, please do
> so.
>> I am not sure why this has not been seen in other ports, as the
>> dot_value patch seems to have been there for a decade...
> Possibly the reason other ports haven't seen the problem is that they
> don't use fx_offset.  I do see a comment in tc-tilepro.c and
> tc-tilegx.c that indicates those ports have hit the problem.

Thanks, patch committed after comparing make -k check results of many
targets, including tilegx/tilepro.


More information about the Binutils mailing list