-/*-
- tc-pj.c -- Assemble code for Pico Java
- Copyright 1999, 2000, 2001, 2002, 2003, 2005
- Free Software Foundation, Inc.
+/* tc-pj.c -- Assemble code for Pico Java
+ Copyright (C) 1999-2021 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,
You should have received a copy of the GNU General Public License
along with GAS; see the file COPYING. If not, write to
- the Free Software Foundation, 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
+ the Free Software Foundation, 51 Franklin Street - Fifth Floor,
+ Boston, MA 02110-1301, USA. */
/* Contributed by Steve Chamberlain of Transmeta <sac@pobox.com>. */
const char line_comment_chars[] = "/!#";
static int pending_reloc;
-static struct hash_control *opcode_hash_control;
+static htab_t opcode_hash_control;
static void
little (int ignore ATTRIBUTE_UNUSED)
we want to handle magic pending reloc expressions specially. */
void
-pj_cons_fix_new_pj (fragS *frag, int where, int nbytes, expressionS *exp)
+pj_cons_fix_new_pj (fragS *frag, int where, int nbytes, expressionS *exp,
+ bfd_reloc_code_real_type r ATTRIBUTE_UNUSED)
{
static int rv[5][2] =
{ { 0, 0 },
fake_opcode (const char *name,
void (*func) (struct pj_opc_info_t *, char *))
{
- pj_opc_info_t * fake = xmalloc (sizeof (pj_opc_info_t));
+ pj_opc_info_t * fake = XNEW (pj_opc_info_t);
fake->opcode = -1;
fake->opcode_next = -1;
fake->u.func = func;
- hash_insert (opcode_hash_control, name, (char *) fake);
+ str_hash_insert (opcode_hash_control, name, fake, 0);
}
/* Enter another entry into the opcode hash table so the same opcode
can have another name. */
static void
-alias (const char *new, const char *old)
+alias (const char *new_name, const char *old)
{
- hash_insert (opcode_hash_control, new,
- (char *) hash_find (opcode_hash_control, old));
+ str_hash_insert (opcode_hash_control, new_name,
+ str_hash_find (opcode_hash_control, old), 0);
}
/* This function is called once, at assembler startup time. It sets
md_begin (void)
{
const pj_opc_info_t *opcode;
- opcode_hash_control = hash_new ();
+ opcode_hash_control = str_htab_create ();
/* Insert names into hash table. */
for (opcode = pj_opc_info; opcode->u.name; opcode++)
- hash_insert (opcode_hash_control, opcode->u.name, (char *) opcode);
+ str_hash_insert (opcode_hash_control, opcode->u.name, opcode, 0);
/* Insert the only fake opcode. */
fake_opcode ("ipush", ipush_code);
if (nlen == 0)
as_bad (_("can't find opcode "));
- opcode = (pj_opc_info_t *) hash_find (opcode_hash_control, op_start);
+ opcode = (pj_opc_info_t *) str_hash_find (opcode_hash_control, op_start);
*op_end = pend;
if (opcode == NULL)
return;
}
+ dwarf2_emit_insn (0);
if (opcode->opcode == -1)
{
/* It's a fake opcode. Dig out the args and pretend that was
}
else
{
- int an;
+ unsigned int an;
output = frag_more (opcode->len);
output[idx++] = opcode->opcode;
if (opcode->opcode_next != -1)
output[idx++] = opcode->opcode_next;
- for (an = 0; opcode->arg[an]; an++)
+ for (an = 0; an < ARRAY_SIZE (opcode->arg) && opcode->arg[an]; an++)
{
expressionS arg;
op_end++;
if (*op_end == 0)
- as_bad ("expected expresssion");
+ as_bad (_("expected expression"));
op_end = parse_exp_save_ilp (op_end, &arg);
op_end++;
if (*op_end != 0)
- as_warn ("extra stuff on line ignored");
+ as_warn (_("extra stuff on line ignored"));
}
if (pending_reloc)
- as_bad ("Something forgot to clean up\n");
-
+ as_bad (_("Something forgot to clean up\n"));
}
-/* 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 *
+const 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;
-
- if (!target_big_endian)
- {
- for (i = prec - 1; i >= 0; i--)
- {
- md_number_to_chars (litP, (valueT) words[i], 2);
- litP += 2;
- }
- }
- else
- {
- 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, target_big_endian);
}
\f
const char *md_shortopts = "";
size_t md_longopts_size = sizeof (md_longopts);
int
-md_parse_option (int c, char *arg ATTRIBUTE_UNUSED)
+md_parse_option (int c, const char *arg ATTRIBUTE_UNUSED)
{
switch (c)
{
/* Apply a fixup to the object file. */
void
-md_apply_fix3 (fixS *fixP, valueT * valP, segT seg ATTRIBUTE_UNUSED)
+md_apply_fix (fixS *fixP, valueT * valP, segT seg ATTRIBUTE_UNUSED)
{
char *buf = fixP->fx_where + fixP->fx_frag->fr_literal;
long val = *valP;
long max, min;
- int shift;
max = min = 0;
- shift = 0;
switch (fixP->fx_r_type)
{
case BFD_RELOC_VTABLE_INHERIT:
}
break;
+ case BFD_RELOC_PJ_CODE_REL32:
+ fixP->fx_done = 0;
+ return;
+
default:
abort ();
}
arelent *rel;
bfd_reloc_code_real_type r_type;
- rel = xmalloc (sizeof (arelent));
- rel->sym_ptr_ptr = xmalloc (sizeof (asymbol *));
+ rel = XNEW (arelent);
+ rel->sym_ptr_ptr = XNEW (asymbol *);
*rel->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
rel->address = fixp->fx_frag->fr_address + fixp->fx_where;
bfd_get_reloc_code_name (r_type));
/* Set howto to a garbage value so that we can keep going. */
rel->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_32);
- assert (rel->howto != NULL);
+ gas_assert (rel->howto != NULL);
}
return rel;