summaryrefslogtreecommitdiff
path: root/opcodes
diff options
context:
space:
mode:
authorDJ Delorie <dj@delorie.com>2005-07-26 03:21:53 +0000
committerDJ Delorie <dj@delorie.com>2005-07-26 03:21:53 +0000
commit4e6a2a3c2af33664d74720447b73c585bbd7db3d (patch)
treef42e9fff26630f2113d7355f775f55953a5d8f0d /opcodes
parent93ba5c281aea7a3fe2c54f6ad2527e065abefe66 (diff)
downloadbinutils-redhat-4e6a2a3c2af33664d74720447b73c585bbd7db3d.tar.gz
[bfd]
* reloc.c: Remove unused M32C relocs, add BFD_RELOC_M32C_HI8. * libbfd.h: Regenerate. * bfd-in2.h: Regenerate. * elf32-m32c.c (m32c_elf_howto_table): Add R_M32C_8, R_M32C_LO16, R_M32C_HI8, R_M32C_HI16. (m32c_reloc_map): Likewise. (m32c_elf_relocate_section): Add R_M32C_HI8 and R_M32C_HI16. [cpu] * m32c.opc (parse_unsigned8): Add %dsp8(). (parse_signed8): Add %hi8(). (parse_unsigned16): Add %dsp16(). (parse_signed16): Add %lo16() and %hi16(). (parse_lab_5_3): Make valuep a bfd_vma *. [gas] * config/tc-m32c.c (md_cgen_lookup_reloc): Add 8 bit operands. Support %mod() modifiers from opcodes. * doc/c-m32c.texi (M32C-Modifiers): New section. [include/elf] * m32c.h: Add R_M32C_8, R_M32C_LO16, R_M32C_HI8, and R_M32C_HI16. [opcodes] * m32c-asm.c Regenerate. * m32c-dis.c Regenerate.
Diffstat (limited to 'opcodes')
-rw-r--r--opcodes/ChangeLog5
-rw-r--r--opcodes/m32c-asm.c118
-rw-r--r--opcodes/m32c-dis.c2
3 files changed, 120 insertions, 5 deletions
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index 2a5d475ea5..f764d0eb83 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,8 @@
+2005-07-25 DJ Delorie <dj@redhat.com>
+
+ * m32c-asm.c Regenerate.
+ * m32c-dis.c Regenerate.
+
2005-07-20 DJ Delorie <dj@redhat.com>
* disassemble.c (disassemble_init_for_target): M32C ISAs are
diff --git a/opcodes/m32c-asm.c b/opcodes/m32c-asm.c
index 60c1055c95..1bfa926efd 100644
--- a/opcodes/m32c-asm.c
+++ b/opcodes/m32c-asm.c
@@ -127,6 +127,28 @@ parse_unsigned8 (CGEN_CPU_DESC cd, const char **strp,
unsigned long value;
long have_zero = 0;
+ if (strncasecmp (*strp, "%dsp8(", 6) == 0)
+ {
+ enum cgen_parse_operand_result result_type;
+ bfd_vma value;
+ const char *errmsg;
+
+ *strp += 6;
+ errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_8,
+ & result_type, & value);
+ if (**strp != ')')
+ return _("missing `)'");
+ (*strp) ++;
+
+ if (errmsg == NULL
+ && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER)
+ {
+ return _("%dsp8() takes a symbolic address, not a number");
+ }
+ *valuep = value;
+ return errmsg;
+ }
+
if (strncmp (*strp, "0x0", 3) == 0
|| (**strp == '0' && *(*strp + 1) != 'x'))
have_zero = 1;
@@ -175,7 +197,29 @@ parse_signed8 (CGEN_CPU_DESC cd, const char **strp,
{
const char *errmsg = 0;
signed long value;
-
+
+ if (strncasecmp (*strp, "%hi8(", 5) == 0)
+ {
+ enum cgen_parse_operand_result result_type;
+ bfd_vma value;
+ const char *errmsg;
+
+ *strp += 5;
+ errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_M32C_HI8,
+ & result_type, & value);
+ if (**strp != ')')
+ return _("missing `)'");
+ (*strp) ++;
+
+ if (errmsg == NULL
+ && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER)
+ {
+ value >>= 16;
+ }
+ *valuep = value;
+ return errmsg;
+ }
+
PARSE_SIGNED;
if (value <= 255 && value > 127)
@@ -195,7 +239,29 @@ parse_unsigned16 (CGEN_CPU_DESC cd, const char **strp,
const char *errmsg = 0;
unsigned long value;
long have_zero = 0;
-
+
+ if (strncasecmp (*strp, "%dsp16(", 7) == 0)
+ {
+ enum cgen_parse_operand_result result_type;
+ bfd_vma value;
+ const char *errmsg;
+
+ *strp += 7;
+ errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_16,
+ & result_type, & value);
+ if (**strp != ')')
+ return _("missing `)'");
+ (*strp) ++;
+
+ if (errmsg == NULL
+ && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER)
+ {
+ return _("%dsp16() takes a symbolic address, not a number");
+ }
+ *valuep = value;
+ return errmsg;
+ }
+
/* Don't successfully parse literals beginning with '['. */
if (**strp == '[')
return "Invalid literal"; /* Anything -- will not be seen. */
@@ -233,6 +299,50 @@ parse_signed16 (CGEN_CPU_DESC cd, const char **strp,
const char *errmsg = 0;
signed long value;
+ if (strncasecmp (*strp, "%lo16(", 6) == 0)
+ {
+ enum cgen_parse_operand_result result_type;
+ bfd_vma value;
+ const char *errmsg;
+
+ *strp += 6;
+ errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_LO16,
+ & result_type, & value);
+ if (**strp != ')')
+ return _("missing `)'");
+ (*strp) ++;
+
+ if (errmsg == NULL
+ && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER)
+ {
+ value &= 0xffff;
+ }
+ *valuep = value;
+ return errmsg;
+ }
+
+ if (strncasecmp (*strp, "%hi16(", 6) == 0)
+ {
+ enum cgen_parse_operand_result result_type;
+ bfd_vma value;
+ const char *errmsg;
+
+ *strp += 6;
+ errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_HI16,
+ & result_type, & value);
+ if (**strp != ')')
+ return _("missing `)'");
+ (*strp) ++;
+
+ if (errmsg == NULL
+ && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER)
+ {
+ value >>= 16;
+ }
+ *valuep = value;
+ return errmsg;
+ }
+
PARSE_SIGNED;
if (value <= 65535 && value > 32767)
@@ -354,10 +464,10 @@ parse_lab_5_3 (CGEN_CPU_DESC cd,
int opindex ATTRIBUTE_UNUSED,
int opinfo,
enum cgen_parse_operand_result *type_addr,
- unsigned long *valuep)
+ bfd_vma *valuep)
{
const char *errmsg = 0;
- unsigned long value;
+ bfd_vma value;
enum cgen_parse_operand_result op_res;
errmsg = cgen_parse_address (cd, strp, M32C_OPERAND_LAB_5_3,
diff --git a/opcodes/m32c-dis.c b/opcodes/m32c-dis.c
index b2ddb16b99..70dc85f2df 100644
--- a/opcodes/m32c-dis.c
+++ b/opcodes/m32c-dis.c
@@ -1229,7 +1229,7 @@ print_insn_m32c (bfd_vma pc, disassemble_info *info)
break;
}
}
- }
+ }
/* If we haven't initialized yet, initialize the opcode table. */
if (! cd)