#include "elf/m68k.h"
static void m68k_elf_cons (int);
+static void m68k_elf_gnu_attribute (int);
/* This string holds the chars that always start a comment. If the
pre-processor is disabled, these aren't very useful. The macro
{"arch", s_m68k_arch, 0},
{"cpu", s_m68k_cpu, 0},
+ {"gnu_attribute", m68k_elf_gnu_attribute, 0},
/* The following pseudo-ops are supported for MRI compatibility. */
{"chip", s_chip, 0},
/* Handle of the OPCODE hash table. NULL means any use before
m68k_ip_begin() will crash. */
-static struct hash_control *op_hash;
+static htab_t op_hash;
\f
/* Assemble an m68k instruction. */
c = *p;
*p = '\0';
- opcode = (const struct m68k_incant *) hash_find (op_hash, instring);
+ opcode = (const struct m68k_incant *) str_hash_find (op_hash, instring);
*p = c;
if (pdot != NULL)
&& opP->index.reg <= ZDATA7)
nextword |= (opP->index.reg - ZDATA0) << 12;
else if (opP->index.reg >= ZADDR0
- || opP->index.reg <= ZADDR7)
+ && opP->index.reg <= ZADDR7)
nextword |= (opP->index.reg - ZADDR0 + 8) << 12;
}
}
#endif
- symbol_table_insert (symbol_new (regname, reg_section, regnum,
- &zero_address_frag));
+ symbol_table_insert (symbol_new (regname, reg_section,
+ &zero_address_frag, regnum));
for (i = 0; regname[i]; i++)
buf[i] = TOUPPER (regname[i]);
buf[i] = '\0';
- symbol_table_insert (symbol_new (buf, reg_section, regnum,
- &zero_address_frag));
+ symbol_table_insert (symbol_new (buf, reg_section,
+ &zero_address_frag, regnum));
}
struct init_entry
{
const struct m68k_opcode *ins;
struct m68k_incant *hack, *slak;
- const char *retval = 0; /* Empty string, or error msg text. */
int i;
/* Set up hash tables with 68000 instructions.
qsort (m68k_sorted_opcodes, m68k_numopcodes,
sizeof (m68k_sorted_opcodes[0]), m68k_compare_opcode);
- op_hash = hash_new ();
+ op_hash = str_htab_create ();
obstack_begin (&robyn, 4000);
for (i = 0; i < m68k_numopcodes; i++)
}
while (slak);
- retval = hash_insert (op_hash, ins->name, (char *) hack);
- if (retval)
- as_fatal (_("Internal Error: Can't hash %s: %s"), ins->name, retval);
+ str_hash_insert (op_hash, ins->name, (char *) hack);
}
for (i = 0; i < m68k_numaliases; i++)
{
const char *name = m68k_opcode_aliases[i].primary;
const char *alias = m68k_opcode_aliases[i].alias;
- void *val = hash_find (op_hash, name);
+ void *val = (void *)str_hash_find (op_hash, name);
if (!val)
as_fatal (_("Internal Error: Can't find %s in hash table"), name);
- retval = hash_insert (op_hash, alias, val);
- if (retval)
- as_fatal (_("Internal Error: Can't hash %s: %s"), alias, retval);
+ str_hash_insert (op_hash, alias, val);
}
/* In MRI mode, all unsized branches are variable sized. Normally,
{
const char *name = mri_aliases[i].primary;
const char *alias = mri_aliases[i].alias;
- void *val = hash_find (op_hash, name);
+ void *val = (void *)str_hash_find (op_hash, name);
if (!val)
as_fatal (_("Internal Error: Can't find %s in hash table"), name);
- retval = hash_jam (op_hash, alias, val);
- if (retval)
- as_fatal (_("Internal Error: Can't hash %s: %s"), alias, retval);
+ str_hash_insert (op_hash, alias, val);
}
}
while (mote_pseudo_table[n].poc_name)
{
hack = XOBNEW (&robyn, struct m68k_incant);
- hash_insert (op_hash,
+ str_hash_insert (op_hash,
mote_pseudo_table[n].poc_name, (char *) hack);
hack->m_operands = 0;
hack->m_opnum = n;
alignment is needed. */
int
-m68k_conditional_pseudoop (pseudo_typeS *pop)
+m68k_conditional_pseudoop (const pseudo_typeS *pop)
{
return (pop->poc_handler == s_mri_if
|| pop->poc_handler == s_mri_else);
n = mri_control_stack;
mri_control_stack = n->outer;
- if (n->top != NULL)
- free (n->top);
+ free (n->top);
free (n->next);
free (n->bottom);
free (n);
demand_empty_rest_of_line ();
}
+/* Parse a .gnu_attribute directive. */
+static void
+m68k_elf_gnu_attribute (int ignored ATTRIBUTE_UNUSED)
+{
+ int tag = obj_elf_vendor_attribute (OBJ_ATTR_GNU);
+
+ /* Check validity of defined m68k tags. */
+ if (tag == Tag_GNU_M68K_ABI_FP)
+ {
+ unsigned int val;
+
+ val = bfd_elf_get_obj_attr_int (stdoutput, OBJ_ATTR_GNU, tag);
+
+ if (tag == Tag_GNU_M68K_ABI_FP && val > 2)
+ as_warn (_("unknown .gnu_attribute value"));
+ }
+}
+
int
tc_m68k_regname_to_dw2regnum (const char *regname)
{