puzzle about "l.d" macro expansion on mips
Maciej W. Rozycki
macro@linux-mips.org
Thu May 20 23:27:00 GMT 2010
On Wed, 19 May 2010, Amker.Cheng wrote:
> Got:
> ---------------------------------
> 0: 27bdfff0 addiu sp,sp,-16
> 4: 3c010000 lui at,0x0
> 8: c426fffc lwc1 $f6,-4(at)
> c: c4270000 lwc1 $f7,0(at)
> 10: 03e00008 jr ra
> 14: 27bd0010 addiu sp,sp,16
>
> Is this right? It seems make no sense.
Indeed, is this change what you mean?
This requires a proper explanation and a test case that I'll supply
together with a suitable ChangeLog entry upon actual submission.
Maciej
binutils-2.20.1-l-d-reloc.patch
Index: binutils-2.20.1/gas/config/tc-mips.c
===================================================================
--- binutils-2.20.1.orig/gas/config/tc-mips.c
+++ binutils-2.20.1/gas/config/tc-mips.c
@@ -7140,26 +7140,7 @@ macro (struct mips_cl_insn *ip)
relax_switch ();
- /* We just generated two relocs. When tc_gen_reloc
- handles this case, it will skip the first reloc and
- handle the second. The second reloc already has an
- extra addend of 4, which we added above. We must
- subtract it out, and then subtract another 4 to make
- the first reloc come out right. The second reloc
- will come out right because we are going to add 4 to
- offset_expr when we build its instruction below.
-
- If we have a symbol, then we don't want to include
- the offset, because it will wind up being included
- when we generate the reloc. */
-
- if (offset_expr.X_op == O_constant)
- offset_expr.X_add_number -= 8;
- else
- {
- offset_expr.X_add_number = -4;
- offset_expr.X_op = O_constant;
- }
+ offset_expr.X_add_number -= 4;
}
used_at = 1;
macro_build_lui (&offset_expr, AT);
More information about the Binutils
mailing list