/* tc-rx.c -- Assembler for the Renesas RX
- Copyright 2008-2013 Free Software Foundation, Inc.
+ Copyright (C) 2008-2015 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
#include "as.h"
#include "struc-symbol.h"
-#include "obstack.h"
#include "safe-ctype.h"
#include "dwarf2dbg.h"
#include "libbfd.h"
OPTION_USES_GCC_ABI,
OPTION_USES_RX_ABI,
OPTION_CPU,
+ OPTION_DISALLOW_STRING_INSNS,
};
#define RX_SHORTOPTS ""
{"mint-register", required_argument, NULL, OPTION_INT_REGS},
{"mgcc-abi", no_argument, NULL, OPTION_USES_GCC_ABI},
{"mrx-abi", no_argument, NULL, OPTION_USES_RX_ABI},
- {"mcpu",required_argument,NULL,OPTION_CPU},
+ {"mcpu", required_argument, NULL, OPTION_CPU},
+ {"mno-allow-string-insns", no_argument, NULL, OPTION_DISALLOW_STRING_INSNS},
{NULL, no_argument, NULL, 0}
};
size_t md_longopts_size = sizeof (md_longopts);
break;
}
return 1;
+
+ case OPTION_DISALLOW_STRING_INSNS:
+ elf_flags |= E_FLAG_RX_SINSNS_SET | E_FLAG_RX_SINSNS_NO;
+ return 1;
}
return 0;
}
fprintf (stream, _(" --mpid\n"));
fprintf (stream, _(" --mint-register=<value>\n"));
fprintf (stream, _(" --mcpu=<rx100|rx200|rx600|rx610>\n"));
+ fprintf (stream, _(" --mno-allow-string-insns"));
}
static void
void
rx_op (expressionS exp, int nbytes, int type)
{
- int v = 0;
+ offsetT v = 0;
if ((exp.X_op == O_constant || exp.X_op == O_big)
&& type != RXREL_PCREL)
{
- if (exp.X_op == O_big && exp.X_add_number <= 0)
+ if (exp.X_op == O_big)
{
- LITTLENUM_TYPE w[2];
- char * ip = rx_bytes.ops + rx_bytes.n_ops;
+ if (exp.X_add_number == -1)
+ {
+ LITTLENUM_TYPE w[2];
+ char * ip = rx_bytes.ops + rx_bytes.n_ops;
- gen_to_words (w, F_PRECISION, 8);
+ gen_to_words (w, F_PRECISION, 8);
#if RX_OPCODE_BIG_ENDIAN
- ip[0] = w[0] >> 8;
- ip[1] = w[0];
- ip[2] = w[1] >> 8;
- ip[3] = w[1];
+ ip[0] = w[0] >> 8;
+ ip[1] = w[0];
+ ip[2] = w[1] >> 8;
+ ip[3] = w[1];
#else
- ip[3] = w[0] >> 8;
- ip[2] = w[0];
- ip[1] = w[1] >> 8;
- ip[0] = w[1];
+ ip[3] = w[0] >> 8;
+ ip[2] = w[0];
+ ip[1] = w[1] >> 8;
+ ip[0] = w[1];
#endif
- rx_bytes.n_ops += 4;
+ rx_bytes.n_ops += 4;
+ return;
+ }
+
+ v = ((generic_bignum[1] & LITTLENUM_MASK) << LITTLENUM_NUMBER_OF_BITS)
+ | (generic_bignum[0] & LITTLENUM_MASK);
+
}
else
+ v = exp.X_add_number;
+
+ while (nbytes)
{
- v = exp.X_add_number;
- while (nbytes)
- {
#if RX_OPCODE_BIG_ENDIAN
- OP ((v >> (8 * (nbytes - 1))) & 0xff);
+ OP ((v >> (8 * (nbytes - 1))) & 0xff);
#else
- OP (v & 0xff);
- v >>= 8;
+ OP (v & 0xff);
+ v >>= 8;
#endif
- nbytes --;
- }
+ nbytes --;
}
}
else
rx_cons_fix_new (fragS * frag,
int where,
int size,
- expressionS * exp)
+ expressionS * exp,
+ bfd_reloc_code_real_type type)
{
- bfd_reloc_code_real_type type;
-
switch (size)
{
case 1:
}
else if (sec)
is_opcode = sec->flags & SEC_CODE;
-
+
/* Certain BFD relocations cannot be translated directly into
a single (non-Red Hat) RX relocation, but instead need
multiple RX relocations - handle them here. */
return reloc;
}
+void
+rx_note_string_insn_use (void)
+{
+ if ((elf_flags & E_FLAG_RX_SINSNS_MASK) == (E_FLAG_RX_SINSNS_SET | E_FLAG_RX_SINSNS_NO))
+ as_bad (_("Use of an RX string instruction detected in a file being assembled without string instruction support"));
+ elf_flags |= E_FLAG_RX_SINSNS_SET | E_FLAG_RX_SINSNS_YES;
+}
+
/* Set the ELF specific flags. */
void