#include "opcode/or32.h"
#ifdef BFD_ASSEMBLER
-#include "elf/or32.h"
+#include "elf/or32.h"
#endif
#define DEBUG 0
{
{"align", s_align_bytes, 4 },
{"space", s_space, 0 },
- {"cputype", s_ignore, 0 },
+ {"cputype", s_ignore, 0 },
{"reg", s_lsym, 0 }, /* Register equate, same as equ. */
{"sect", s_ignore, 0 }, /* Creation of coff sections. */
{"proc", s_ignore, 0 }, /* Start of a function. */
#endif
/* Set bits in machine opcode according to insn->encoding
- description and passed operand. */
+ description and passed operand. */
-static void
+static void
encode (insn, opcode, param_val, param_ch)
const struct machine_opcode *insn;
unsigned long *opcode;
for (enc = insn->encoding; *enc != '\0';)
{
- if ((*enc == '0') && (*(enc + 1) == 'x'))
+ if ((*enc == '0') && (*(enc + 1) == 'x'))
{
int tmp = strtol (enc, NULL, 16);
*opcode |= tmp << opc_pos;
enc += 3;
}
- else if ((*enc == '0') || (*enc == '-'))
+ else if ((*enc == '0') || (*enc == '-'))
{
opc_pos--;
enc++;
}
- else if (*enc == '1')
+ else if (*enc == '1')
{
opc_pos--;
*opcode |= 1 << opc_pos;
enc++;
}
- else if (*enc == param_ch)
+ else if (*enc == param_ch)
{
opc_pos--;
param_pos--;
*opcode |= ((param_val >> param_pos) & 0x1) << opc_pos;
enc++;
}
- else if (ISALPHA (*enc))
+ else if (ISALPHA (*enc))
{
opc_pos--;
enc++;
else
enc++;
}
-
+
#if DEBUG
printf (" opcode=%.8lx\n", *opcode);
#endif
if ((*s == '(') && (*(s+1) == 'r'))
s++;
- if ((*s == 'r') && ISDIGIT (*(s + 1)))
+ if ((*s == 'r') && ISDIGIT (*(s + 1)))
{
operandp->X_add_number = strtol (s + 1, NULL, 10);
operandp->X_op = O_register;
for (; (*s != ',') && (*s != '\0');)
- s++;
+ s++;
input_line_pointer = save;
- return s;
+ return s;
}
expression (operandp);
operandp->X_op = O_constant;
}
}
-
+
new = input_line_pointer;
input_line_pointer = save;
-
+
#if DEBUG
printf (" %s=parse_operand(%s): operandp->X_op = %u\n", new, s, operandp->X_op);
#endif
operandp->X_op = O_constant;
}
}
-
+
new = input_line_pointer;
input_line_pointer = save;
-
- if ((operandp->X_op == O_symbol) && (*s != '_'))
+
+ if ((operandp->X_op == O_symbol) && (*s != '_'))
{
#if DEBUG
printf ("symbol: '%s'\n", save);
if ((*s == REGISTER_PREFIX) && (*(s + 1) == 'r')) /* Register prefix. */
s++;
- if ((*s == 'r') && ISDIGIT (*(s + 1)))
+ if ((*s == 'r') && ISDIGIT (*(s + 1)))
{
operandp->X_add_number = strtol (s + 1, NULL, 10);
operandp->X_op = O_register;
/* Build the opcode, checking as we go to make sure that the
operands match.
-
+
If an operand matches, we modify the_insn or opcode appropriately,
and do a "continue". If an operand fails to match, we "break". */
if (insn->args[0] != '\0')
/* We are truly done. */
the_insn.opcode = opcode;
if (check_invalid_opcode (opcode))
- as_bad (_("instruction not allowed: %s"), str);
+ as_bad (_("instruction not allowed: %s"), str);
return;
}
as_bad (_("too many operands: %s"), s);
#if DEBUG
printf (" ',' case: operand->X_add_number = %d, *args = %s, *s = %s\n",
operand->X_add_number, args, s);
-#endif
+#endif
continue;
}
break;
case '(': /* Must match a (. */
s = parse_operand (s, operand, args[1] == 'I');
continue;
-
+
case ')': /* Must match a ). */
continue;
if (operand->X_op != O_register)
break; /* Only registers. */
-
+
know (operand->X_add_symbol == 0);
know (operand->X_op_symbol == 0);
regno = operand->X_add_number;
default:
/* if (! ISALPHA (*args))
break; */ /* Only immediate values. */
-
+
if (mask_or_shift)
{
#if DEBUG
reloc = mask_or_shift;
}
mask_or_shift = 0;
-
- if (strncasecmp (args, "LO(", 3) == 0)
+
+ if (strncasecmp (args, "LO(", 3) == 0)
{
#if DEBUG
printf ("reloc_const\n");
#endif
reloc = BFD_RELOC_LO16;
}
- else if (strncasecmp (args, "HI(", 3) == 0)
+ else if (strncasecmp (args, "HI(", 3) == 0)
{
#if DEBUG
printf ("reloc_consth\n");
#endif
reloc = BFD_RELOC_HI16;
}
-
- if (*s == '(')
+
+ if (*s == '(')
{
operand->X_op = O_constant;
#if 0
the_insn.pcrel = 0;
encode (insn, &opcode, operand->X_add_number, *args);
/* the_insn.reloc = BFD_RELOC_NONE; */
- continue;
+ continue;
}
if (reloc == BFD_RELOC_NONE)
printf (" BFD_RELOC_NONE=%d\n", BFD_RELOC_NONE);
#endif
the_insn.exp = *operand;
-
+
/* the_insn.reloc_offset = 1; */
the_insn.pcrel = 1; /* Assume PC-relative jump. */
encode (insn, &opcode, operand->X_add_number, *args);
continue;
}
-
+
/* Types or values of args don't match. */
as_bad (_("invalid operands"));
return;
/* Build the opcode, checking as we go to make sure that the
operands match.
-
+
If an operand matches, we modify the_insn or opcode appropriately,
and do a "continue". If an operand fails to match, we "break". */
if (insn->args[0] != '\0')
- /* Prime the pump. */
+ /* Prime the pump. */
s = parse_operand (s, operand,
insn->args[0] == 'I'
|| strcmp (insn->name, "l.nop") == 0);
/* We are truly done. */
the_insn.opcode = opcode;
if (check_invalid_opcode (opcode))
- as_bad (_("instruction not allowed: %s"), str);
+ as_bad (_("instruction not allowed: %s"), str);
return;
}
as_bad (_("too many operands: %s"), s);
#if DEBUG
printf (" ',' case: operand->X_add_number = %d, *args = %s, *s = %s\n",
operand->X_add_number, args, s);
-#endif
+#endif
continue;
}
break;
case '(': /* Must match a (. */
s = parse_operand (s, operand, args[1] == 'I');
continue;
-
+
case ')': /* Must match a ). */
continue;
if (operand->X_op != O_register)
break; /* Only registers. */
-
+
know (operand->X_add_symbol == 0);
know (operand->X_op_symbol == 0);
regno = operand->X_add_number;
default:
/* if (! ISALPHA (*args))
break; */ /* Only immediate values. */
-
+
if (mask_or_shift)
{
#if DEBUG
reloc = mask_or_shift;
}
mask_or_shift = 0;
-
- if (strncasecmp (args, "LO(", 3) == 0)
+
+ if (strncasecmp (args, "LO(", 3) == 0)
{
#if DEBUG
printf ("reloc_const\n");
#endif
reloc = RELOC_CONST;
}
- else if (strncasecmp (args, "HI(", 3) == 0)
+ else if (strncasecmp (args, "HI(", 3) == 0)
{
#if DEBUG
printf ("reloc_consth\n");
#endif
reloc = RELOC_CONSTH;
}
-
- if (*s == '(')
+
+ if (*s == '(')
{
operand->X_op = O_constant;
#if 0
the_insn.pcrel = 0;
encode (insn, &opcode, operand->X_add_number, *args);
/* the_insn.reloc = NO_RELOC; */
- continue;
+ continue;
}
if (reloc == NO_RELOC)
printf (" NO_RELOC=%d\n", NO_RELOC);
#endif
the_insn.exp = *operand;
-
+
/* the_insn.reloc_offset = 1; */
the_insn.pcrel = 1; /* Assume PC-relative jump. */
encode (insn, &opcode, operand->X_add_number, *args);
continue;
}
-
+
/* Types or values of args don't match. */
as_bad (_("invalid operands"));
return;
valueT *valP;
segT seg ATTRIBUTE_UNUSED;
{
- long val = *(long*)valP;
+ long val = *valP;
char *buf = fixP->fx_where + fixP->fx_frag->fr_literal;
#if DEBUG
fragS * fragP ATTRIBUTE_UNUSED;
{
as_fatal ("or32_convert_frag\n");
-}
+}
#endif
/* Should never be called for or32. */
#if DEBUG
printf ("tc_aout_fix_to_chars\n");
-#endif
+#endif
know (fixP->fx_r_type < BFD_RELOC_NONE);
know (fixP->fx_addsy != NULL);
#if DEBUG
printf ("In tc_aout_pre_write_hook()\n");
#endif
-}
-*/
+}
+*/
#endif
/* Default the values of symbols known that should be "predefined". We
#endif
/* Register name. */
- if (name[0] == 'r' || name[0] == 'R' || name[0] == 'a' || name[0] == 'b')
- {
+ if (name[0] == 'r' || name[0] == 'R' || name[0] == 'a' || name[0] == 'b')
+ {
long maxreg;
/* Parse the number, make sure it has no extra zeroes or
long lab;
char *name;
symbolS *sym;
-
+
/* This is a local label. */
++input_line_pointer;
lab = (long) get_absolute_expression ();
type = 'x';
fieldlimit = 4;
}
- else
+ else
return;
if (ISDIGIT (*s))
SKIP_WHITESPACE ();
input_line_pointer = s;
- expressionP->X_op = O_constant;
+ expressionP->X_op = O_constant;
expressionP->X_unsigned = 1;
expressionP->X_add_number = ((floatbuf[fieldnum * 2]
<< LITTLENUM_NUMBER_OF_BITS)
return NULL;
}
- if ( fixp->fx_r_type == BFD_RELOC_VTABLE_ENTRY
- || fixp->fx_r_type == BFD_RELOC_VTABLE_INHERIT)
- reloc->addend = fixp->fx_offset;
- else
- reloc->addend = fixp->fx_addnumber;
+ if (fixp->fx_r_type == BFD_RELOC_VTABLE_ENTRY)
+ reloc->address = fixp->fx_offset;
+ reloc->addend = fixp->fx_addnumber;
return reloc;
}
#endif