/* tc-a29k.c -- Assemble for the AMD 29000.
- Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1998, 2000
+ Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1998, 2000, 2001, 2002
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
to convert it to new machines' assemblers as desired. There was too
much bloody rewriting required before. There still probably is. */
-#include <ctype.h>
#include "as.h"
+#include "safe-ctype.h"
#include "opcode/a29k.h"
static void s_data1 PARAMS ((void));
static void s_use PARAMS ((int));
#endif
+static void insert_sreg PARAMS ((char *, int));
+static void define_some_regs PARAMS ((void));
+static char *parse_operand PARAMS ((char *, expressionS *, int));
const pseudo_typeS
md_pseudo_table[] =
symbol_table_insert (symbol_new (regname, SEG_REGISTER, (valueT) regnum,
&zero_address_frag));
for (i = 0; regname[i]; i++)
- buf[i] = islower (regname[i]) ? toupper (regname[i]) : regname[i];
+ buf[i] = TOUPPER (regname[i]);
buf[i] = '\0';
symbol_table_insert (symbol_new (buf, SEG_REGISTER, (valueT) regnum,
/* Install symbol definitions for assorted special registers.
See ASM29K Ref page 2-9. */
-void
+static void
define_some_regs ()
{
#define SREG 256
}
}
-char *
+static char *
parse_operand (s, operandp, opt)
char *s;
expressionS *operandp;
/* Must handle `div0' opcode. */
s = str;
- if (isalpha (*s))
- for (; isalnum (*s); ++s)
- if (isupper (*s))
- *s = tolower (*s);
+ if (ISALPHA (*s))
+ for (; ISALNUM (*s); ++s)
+ *s = TOLOWER (*s);
switch (*s)
{
}
void
-md_apply_fix (fixP, val)
+md_apply_fix3 (fixP, valP, seg)
fixS *fixP;
- long val;
+ valueT * valP;
+ segT seg ATTRIBUTE_UNUSED;
{
+ long val = *valP;
char *buf = fixP->fx_where + fixP->fx_frag->fr_literal;
- fixP->fx_addnumber = val; /* Remember value for emit_reloc */
+ fixP->fx_addnumber = val; /* Remember value for emit_reloc. */
know (fixP->fx_size == 4);
know (fixP->fx_r_type < NO_RELOC);
/* This is a hack. There should be a better way to handle this. */
if (fixP->fx_r_type == RELOC_WDISP30 && fixP->fx_addsy)
- {
- val += fixP->fx_where + fixP->fx_frag->fr_address;
- }
+ val += fixP->fx_where + fixP->fx_frag->fr_address;
switch (fixP->fx_r_type)
{
-
case RELOC_32:
buf[0] = val >> 24;
buf[1] = val >> 16;
break;
case RELOC_WDISP30:
- val = (val >>= 2) + 1;
+ val = (val >> 2) + 1;
buf[0] |= (val >> 24) & 0x3f;
buf[1] = (val >> 16);
buf[2] = val >> 8;
break;
case RELOC_WDISP22:
- val = (val >>= 2) + 1;
+ val = (val >> 2) + 1;
/* FALLTHROUGH */
case RELOC_BASE22:
buf[1] |= (val >> 16) & 0x3f;
else if (fixP->fx_pcrel)
{
long v = val >> 17;
+
if (v != 0 && v != -1)
as_bad_where (fixP->fx_file, fixP->fx_line,
"call/jmp target out of range");
}
else
- /* this case was supposed to be handled in machine_ip */
+ /* This case was supposed to be handled in machine_ip. */
abort ();
buf[1] = val >> 10; /* Holds bits 0003FFFC of address */
buf[3] = val >> 2;
as_bad (_("bad relocation type: 0x%02x"), fixP->fx_r_type);
break;
}
+
+ if (fixP->fx_addsy == NULL && fixP->fx_pcrel == 0)
+ fixP->fx_done = 1;
}
#ifdef OBJ_COFF
/* should never be called for 29k */
void
md_convert_frag (headers, seg, fragP)
- object_headers *headers;
- segT seg;
- register fragS *fragP;
+ object_headers *headers ATTRIBUTE_UNUSED;
+ segT seg ATTRIBUTE_UNUSED;
+ register fragS *fragP ATTRIBUTE_UNUSED;
{
as_fatal (_("a29k_convert_frag\n"));
}
/* should never be called for a29k */
int
md_estimate_size_before_relax (fragP, segtype)
- register fragS *fragP;
- segT segtype;
+ register fragS *fragP ATTRIBUTE_UNUSED;
+ segT segtype ATTRIBUTE_UNUSED;
{
as_fatal (_("a29k_estimate_size_before_relax\n"));
return 0;
#endif /* OBJ_AOUT */
\f
-CONST char *md_shortopts = "";
+const char *md_shortopts = "";
struct option md_longopts[] = {
{NULL, no_argument, NULL, 0}
};
int
md_parse_option (c, arg)
- int c;
- char *arg;
+ int c ATTRIBUTE_UNUSED;
+ char *arg ATTRIBUTE_UNUSED;
{
return 0;
}
void
md_show_usage (stream)
- FILE *stream;
+ FILE *stream ATTRIBUTE_UNUSED;
{
}
\f
char *s;
if (c != '$'
- || ! isdigit ((unsigned char) input_line_pointer[0]))
+ || ! ISDIGIT (input_line_pointer[0]))
return 0;
s = input_line_pointer;
lab = 0;
- while (isdigit ((unsigned char) *s))
+ while (ISDIGIT (*s))
{
lab = lab * 10 + *s - '0';
++s;
expressionP->X_op = O_constant;
}
else if (input_line_pointer[0] == '$'
- && isdigit ((unsigned char) input_line_pointer[1]))
+ && ISDIGIT (input_line_pointer[1]))
{
long lab;
char *name;
return;
}
- if (isdigit (*s))
+ if (ISDIGIT (*s))
{
fieldnum = *s - '0';
++s;
/* Round up a section size to the appropriate boundary. */
valueT
md_section_align (segment, size)
- segT segment;
+ segT segment ATTRIBUTE_UNUSED;
valueT size;
{
return size; /* Byte alignment is fine */