This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: pc-relative relocs on alpha
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: Richard Henderson <rth at redhat dot com>
- Cc: binutils at sources dot redhat dot com
- Date: Thu, 19 Sep 2002 10:17:51 +0930
- Subject: Re: pc-relative relocs on alpha
- References: <20020918161556.GA3886@redhat.com>
On Wed, Sep 18, 2002 at 09:15:56AM -0700, Richard Henderson wrote:
> I tried working my way through fixup_segment. The bits around
> line 2673 that convert the subtraction to a pc-relative fixup
> look ok, but then we get down to line 2718 and apply
> MD_PCREL_FROM_SECTION a second time, which is where things appear
> to fall over.
You've hit an area of fixup_segment that I'm still not happy with,
but wasn't game to change in any major way. Note that the two
applications of MD_PCREL_FROM_SECTION here cancel each other. (At
least that seems to be the intention. See hacks in the arm backend
md_pcrel_from, which is one of the reasons I didn't want to change
this code too much.) What _has_ changed here is that the new code
consistently folds symbol values back into fx_offset when removing
fx_subsy and/or fx_addsy.
> I _think_ the following patch may be necessary, but I'm not sure.
> (Certainly the last time I fiddled with all this it was via trial
> and error.) The fact to consider here is the branch relocations
> need to be relative to the end of the instruction rather than the
> beginning.
My opinion is that md_pcrel_from is _not_ the place to make such
hacks. In any case, I don't think it will work as md_pcrel_from
only affects add_number passed to md_apply_fix3, not fx_offset,
and alpha doesn't seem to use fx_addnumber to pass anything around.
You probably need something to handle this case in tc_gen_reloc,
or something in alpha_validate_fix..
--
Alan Modra
IBM OzLabs - Linux Technology Centre