/* tc-d10v.c -- Assembler code for the Mitsubishi D10V
- Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005
- Free Software Foundation, Inc.
+ Copyright (C) 1996-2015 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
GAS is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
+ the Free Software Foundation; either version 3, or (at your option)
any later version.
GAS is distributed in the hope that it will be useful,
the Free Software Foundation, 51 Franklin Street - Fifth Floor,
Boston, MA 02110-1301, USA. */
-#include <stdio.h>
#include "as.h"
#include "safe-ctype.h"
#include "subsegs.h"
#include "opcode/d10v.h"
#include "elf/ppc.h"
+#include "dwarf2dbg.h"
const char comment_chars[] = ";";
const char line_comment_chars[] = "#";
return 0;
}
-/* Turn a string in input_line_pointer into a floating point constant
- of type TYPE, and store the appropriate bytes in *LITP. The number
- of LITTLENUMS emitted is stored in *SIZEP. An error message is
- returned, or NULL on OK. */
-
char *
md_atof (int type, char *litP, int *sizeP)
{
- int prec;
- LITTLENUM_TYPE words[4];
- char *t;
- int i;
-
- switch (type)
- {
- case 'f':
- prec = 2;
- break;
- case 'd':
- prec = 4;
- break;
- default:
- *sizeP = 0;
- return _("bad call to md_atof");
- }
-
- t = atof_ieee (input_line_pointer, type, words);
- if (t)
- input_line_pointer = t;
-
- *sizeP = prec * 2;
-
- for (i = 0; i < prec; i++)
- {
- md_number_to_chars (litP, (valueT) words[i], 2);
- litP += 2;
- }
- return NULL;
+ return ieee_md_atof (type, litP, sizeP, TRUE);
}
void
int i, where;
char *f = frag_more (4);
+ dwarf2_emit_insn (4);
insn |= FM11;
number_to_chars_bigendian (f, insn, 4);
char *f = frag_more (4);
int i, where;
+ dwarf2_emit_insn (4);
if (opcode->exec_type & PARONLY)
as_fatal (_("Instruction must be executed in parallel with another instruction."));
}
f = frag_more (4);
+ dwarf2_emit_insn (4);
number_to_chars_bigendian (f, insn, 4);
/* Process fixup chains. fx refers to insn2 when j == 0, and to
static unsigned long prev_insn;
static struct d10v_opcode *prev_opcode = 0;
static subsegT prev_subseg;
-static segT prev_seg = 0;;
+static segT prev_seg = 0;
/* Find the symbol which has the same name as the register in exp. */
for (i = 0; opcode->operands[i + 1]; i++)
{
int bits = d10v_operands[next_opcode->operands[opnum]].bits;
- int flags = d10v_operands[next_opcode->operands[opnum]].flags;
+
+ flags = d10v_operands[next_opcode->operands[opnum]].flags;
+
if (flags & OPERAND_ADDR)
bits += 2;
sym_frag = symbol_get_frag (myops[opnum].X_add_symbol);
found_symbol = FALSE;
- current_position =
- obstack_next_free (&frchain_now->frch_obstack)
- - frag_now->fr_literal;
+ current_position = frag_now_fix_octets ();
symbol_position = S_GET_VALUE (myops[opnum].X_add_symbol);
for (f = frchain_now->frch_root; f; f = f->fr_next)
char name[20];
int nlen = 0;
expressionS myops[6];
- unsigned long insn;
/* Drop leading whitespace. */
while (*str == ' ')
/* Find the opcode end. */
for (op_start = op_end = (unsigned char *) str;
- *op_end && nlen < 20 && !is_end_of_line[*op_end] && *op_end != ' ';
+ *op_end && !is_end_of_line[*op_end] && *op_end != ' ';
op_end++)
{
name[nlen] = TOLOWER (op_start[nlen]);
nlen++;
+ if (nlen == sizeof (name) - 1)
+ break;
}
name[nlen] = 0;
/* Find the first opcode with the proper name. */
*opcode = (struct d10v_opcode *) hash_find (d10v_hash, name);
if (*opcode == NULL)
- as_fatal (_("unknown opcode: %s"), name);
+ return -1;
save = input_line_pointer;
input_line_pointer = (char *) op_end;
return -1;
input_line_pointer = save;
- insn = build_insn ((*opcode), myops, 0);
- return insn;
+ return build_insn ((*opcode), myops, 0);
}
/* If while processing a fixup, a reloc really needs to be created.
return 1;
}
+void
+d10v_frob_label (symbolS *lab)
+{
+ d10v_cleanup ();
+ symbol_set_frag (lab, frag_now);
+ S_SET_VALUE (lab, (valueT) frag_now_fix ());
+ dwarf2_emit_label (lab);
+}
+
/* Like normal .word, except support @word.
Clobbers input_line_pointer, checks end-of-line. */
prev_seg = now_seg;
prev_subseg = now_subseg;
if (prev_insn == (unsigned long) -1)
- as_fatal (_("can't find opcode "));
+ as_fatal (_("can't find previous opcode "));
fixups = fixups->next;
str = str2 + 2;
}
if (insn == (unsigned long) -1)
{
if (extype != PACK_UNSPEC)
- {
- etype = extype;
- return;
- }
- as_fatal (_("can't find opcode "));
+ etype = extype;
+ else
+ as_bad (_("could not assemble: %s"), str);
+ return;
}
if (etype != PACK_UNSPEC)