This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
[patch] MIPS: Use BFD_RELOC_UNUSED when no relocation
- From: "Maciej W. Rozycki" <macro at linux-mips dot org>
- To: binutils at sources dot redhat dot com
- Date: Mon, 28 Jun 2004 17:45:35 +0200 (CEST)
- Subject: [patch] MIPS: Use BFD_RELOC_UNUSED when no relocation
Hello,
my_getSmallExpression() currently pretends a BFD_RELOC_LO16 relocation is
used for a constant expression. This obscures code unnecessarily.
This patch changes the result to BFD_RELOC_UNUSED for that case.
2004-06-28 Maciej W. Rozycki <macro@linux-mips.org>
* config/tc-mips.c (append_insn): Handle constant expressions with
no associated relocation.
(mips_ip): Cancel the expression after use for the Q format
specifier.
(parse_relocation): Return no relocation for unsupported
operators.
(my_getSmallExpression): Return no relocation if no relocation
operators are used.
This has been tested for the mipsel-linux-gnu target -- no new
regressions. OK to apply?
Maciej
binutils-2.15.91-20040625-mips-reloc-unused.patch
diff -up --recursive --new-file binutils-2.15.91-20040625.macro/gas/config/tc-mips.c binutils-2.15.91-20040625/gas/config/tc-mips.c
--- binutils-2.15.91-20040625.macro/gas/config/tc-mips.c 2004-06-15 03:25:28.000000000 +0000
+++ binutils-2.15.91-20040625/gas/config/tc-mips.c 2004-06-27 11:09:41.000000000 +0000
@@ -2079,7 +2079,7 @@ append_insn (struct mips_cl_insn *ip, ex
}
fixp[0] = fixp[1] = fixp[2] = NULL;
- if (address_expr != NULL && *reloc_type < BFD_RELOC_UNUSED)
+ if (address_expr != NULL)
{
if (address_expr->X_op == O_constant)
{
@@ -2112,6 +2112,7 @@ append_insn (struct mips_cl_insn *ip, ex
ip->insn_opcode |= (address_expr->X_add_number >> 16) & 0xffff;
break;
+ case BFD_RELOC_UNUSED:
case BFD_RELOC_LO16:
case BFD_RELOC_MIPS_GOT_DISP:
ip->insn_opcode |= address_expr->X_add_number & 0xffff;
@@ -2147,7 +2148,7 @@ append_insn (struct mips_cl_insn *ip, ex
internalError ();
}
}
- else
+ else if (*reloc_type < BFD_RELOC_UNUSED)
need_reloc:
{
reloc_howto_type *howto;
@@ -8596,6 +8597,7 @@ do_msbd:
ip->insn_opcode |= (imm_expr.X_add_number
<< (OP_SH_VSEL +
(is_qh ? 2 : 1)));
+ imm_expr.X_op = O_absent;
if (*s != ']')
as_warn(_("Expecting ']' found '%s'"), s);
else
@@ -9809,7 +9811,7 @@ parse_relocation (char **str, bfd_reloc_
{
as_bad ("relocation %s isn't supported by the current ABI",
percent_op[i].str);
- *reloc = BFD_RELOC_LO16;
+ *reloc = BFD_RELOC_UNUSED;
}
return TRUE;
}
@@ -9821,8 +9823,7 @@ parse_relocation (char **str, bfd_reloc_
expression in *EP and the relocations in the array starting
at RELOC. Return the number of relocation operators used.
- On exit, EXPR_END points to the first character after the expression.
- If no relocation operators are used, RELOC[0] is set to BFD_RELOC_LO16. */
+ On exit, EXPR_END points to the first character after the expression. */
static size_t
my_getSmallExpression (expressionS *ep, bfd_reloc_code_real_type *reloc,
@@ -9868,9 +9869,7 @@ my_getSmallExpression (expressionS *ep,
expr_end = str;
- if (reloc_index == 0)
- reloc[0] = BFD_RELOC_LO16;
- else
+ if (reloc_index != 0)
{
prev_reloc_op_frag = frag_now;
for (i = 0; i < reloc_index; i++)