/* tc-z8k.c -- Assemble code for the Zilog Z800n
- Copyright 1992, 1993, 1994, 1995, 1996, 1998, 2000, 2001, 2002, 2003,
- 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
+ Copyright (C) 1992-2016 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
extern int coff_flags;
int segmented_mode;
-/* This is non-zero if target was set from the command line. */
+/* This is non-zero if target was set from the command line.
+ If non-zero, 1 means Z8002 (non-segmented), 2 means Z8001 (segmented). */
static int z8k_target_from_cmdline;
static void
}
/* Default to z8002. */
- if (! z8k_target_from_cmdline)
- s_segm (0);
+ s_segm (z8k_target_from_cmdline ? z8k_target_from_cmdline - 1 : 0);
/* Insert the pseudo ops, too. */
for (idx = 0; md_pseudo_table[idx].poc_name; idx++)
{
opcode_entry_type *fake_opcode;
- fake_opcode = (opcode_entry_type *) malloc (sizeof (opcode_entry_type));
+ fake_opcode = XNEW (opcode_entry_type);
fake_opcode->name = md_pseudo_table[idx].poc_name;
fake_opcode->func = (void *) (md_pseudo_table + idx);
fake_opcode->opcode = 250;
/* Make sure the mode supplied is the size of a word. */
static void
-regword (int mode, char *string)
+regword (int mode, const char *string)
{
int ok;
/* Make sure the mode supplied is the size of an address. */
static void
-regaddr (int mode, char *string)
+regaddr (int mode, const char *string)
{
int ok;
struct ctrl_names {
int value;
- char *name;
+ const char *name;
};
static struct ctrl_names ctrl_table[] = {
struct flag_names {
int value;
- char *name;
+ const char *name;
};
static struct flag_names flag_table[] = {
struct interrupt_names {
int value;
- char *name;
+ const char *name;
};
static struct interrupt_names intr_table[] = {
struct cc_names {
int value;
- char *name;
+ const char *name;
};
static struct cc_names table[] = {
/* Various routines to kill one day. */
-char *
+const char *
md_atof (int type, char *litP, int *sizeP)
{
return ieee_md_atof (type, litP, sizeP, TRUE);
size_t md_longopts_size = sizeof (md_longopts);
int
-md_parse_option (int c, char *arg)
+md_parse_option (int c, const char *arg)
{
switch (c)
{
case 'z':
if (!strcmp (arg, "8001"))
- s_segm (1);
+ z8k_target_from_cmdline = 2;
else if (!strcmp (arg, "8002"))
- s_segm (0);
+ z8k_target_from_cmdline = 1;
else
{
as_bad (_("invalid architecture -z%s"), arg);
return 0;
}
- z8k_target_from_cmdline = 1;
break;
case OPTION_RELAX:
{
arelent *reloc;
- reloc = xmalloc (sizeof (*reloc));
- reloc->sym_ptr_ptr = xmalloc (sizeof (asymbol *));
+ reloc = XNEW (arelent);
+ reloc->sym_ptr_ptr = XNEW (asymbol *);
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
reloc->addend = fixp->fx_offset;