PATCH: Fix gas/mips
H. J. Lu
hjl@lucon.org
Mon Sep 30 01:34:00 GMT 2002
On Sun, Sep 29, 2002 at 11:08:30PM -0700, Eric Christopher wrote:
> >
> > * config/tc-mips.c (md_apply_fix3): Subtract the symbol value
> > twice if howto->pcrel_offset is true.
> >
> *groan* :)
>
> I need to look up Ian's mail (I think it was his mail) on why we
> subtract the addend twice on these - it _can't_ be right.
>
> OK for now. Please add a comment on this about subtracting the reloc
> twice and describe the situations where it comes about.
>
> I really gotta find time to fix this.
>
There are enough comments on this already. I added R_MIPS_PC16. Here
is the new patch. I will check it in shortly.
H.J.
-------------- next part --------------
2002-09-29 H.J. Lu <hjl@gnu.org>
* config/tc-mips.c (md_apply_fix3): Subtract the symbol value
twice if howto->pcrel_offset is true.
--- gas/config/tc-mips.c.reloc Fri Sep 27 00:21:51 2002
+++ gas/config/tc-mips.c Sun Sep 29 14:18:18 2002
@@ -10754,11 +10796,23 @@ md_apply_fix3 (fixP, valP, seg)
value -= symval;
howto = bfd_reloc_type_lookup (stdoutput, fixP->fx_r_type);
- if (value != 0 && howto->partial_inplace && ! fixP->fx_pcrel)
+ if (value != 0 && howto->partial_inplace
+ && (! fixP->fx_pcrel || howto->pcrel_offset))
{
/* In this case, the bfd_install_relocation routine will
incorrectly add the symbol value back in. We just want
- the addend to appear in the object file. */
+ the addend to appear in the object file.
+
+ howto->pcrel_offset is added for R_MIPS_PC16, which is
+ generated for code like
+
+ globl g1 .text
+ .text
+ .space 20
+ g1:
+ x:
+ bal g1
+ */
value -= symval;
/* Make sure the addend is still non-zero. If it became zero
More information about the Binutils
mailing list