/* tc-a29k.c -- Assemble for the AMD 29000.
- Copyright (C) 1989, 1990, 1991 Free Software Foundation, Inc.
+ Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
expressionS exp;
int pcrel;
int reloc_offset; /* Offset of reloc within insn */
- enum reloc_type reloc;
+
+ int reloc;
+
+
} the_insn;
-#ifdef __STDC__
+#if __STDC__ == 1
/* static int getExpression(char *str); */
static void machine_ip(char *str);
static void s_data1(void);
static void s_use(void);
-#else /* __STDC__ */
+#else /* not __STDC__ */
/* static int getExpression(); */
static void machine_ip();
static void s_data1();
static void s_use();
-#endif /* __STDC__ */
+#endif /* not __STDC__ */
const pseudo_typeS
md_pseudo_table[] = {
{ "reg", s_lsym, 0 }, /* Register equate, same as equ */
{ "space", s_ignore, 0 }, /* Listing control */
{ "sect", s_ignore, 0 }, /* Creation of coff sections */
+#ifndef OBJ_COFF
+ /* We can do this right with coff */
{ "use", s_use, 0 },
+#endif
{ "word", cons, 4 },
{ NULL, 0, 0 },
};
char *s;
expressionS *operandp;
{
- char *save = input_line_pointer;
- char *new;
- segT seg;
+ char *save = input_line_pointer;
+ char *new;
+ segT seg;
- input_line_pointer = s;
- seg = expr (0, operandp);
- new = input_line_pointer;
- input_line_pointer = save;
-
- switch (seg) {
- case SEG_ABSOLUTE:
- case SEG_TEXT:
- case SEG_DATA:
- case SEG_BSS:
- case SEG_UNKNOWN:
- case SEG_DIFFERENCE:
- case SEG_BIG:
- case SEG_REGISTER:
- return new;
-
- case SEG_ABSENT:
- as_bad("Missing operand");
- return new;
-
- default:
- as_bad("Don't understand operand of type %s", segment_name (seg));
- return new;
- }
+ input_line_pointer = s;
+ seg = expr (0, operandp);
+ new = input_line_pointer;
+ input_line_pointer = save;
+
+ if (seg == SEG_ABSENT)
+ as_bad("Missing operand");
+ return new;
}
/* Instruction parsing. Takes a string containing the opcode.
}
argsStart = s;
opcode = insn->opcode;
- bzero(&the_insn, sizeof(the_insn));
+ memset(&the_insn, '\0', sizeof(the_insn));
the_insn.reloc = NO_RELOC;
/*
fixS *fixP;
{
- /* FIXME-NOW: relocation type handling is not yet written for
- a29k. */
-
-
switch (fixP->fx_r_type) {
case RELOC_32: return(R_WORD);
case RELOC_8: return(R_BYTE);
case RELOC_CONSTH: return (R_IHIHALF);
case RELOC_JUMPTARG: return (R_IREL);
default: printf("need %o3\n", fixP->fx_r_type);
- abort(0);
+ abort();
} /* switch on type */
return(0);
/* should never be called for 29k */
void md_create_long_jump(ptr, from_addr, to_addr, frag, to_symbol)
char *ptr;
-long from_addr,
- to_addr;
+long from_addr;
+long to_addr;
fragS *frag;
symbolS *to_symbol;
{
as_fatal("sparc_create_long_jump\n");
}
-/* should never be called for sparc */
+/* should never be called for a29k */
int md_estimate_size_before_relax(fragP, segtype)
register fragS *fragP;
segT segtype;
{
as_fatal("sparc_estimate_size_before_relax\n");
+ return(0);
}
#if 0
fixS *fixP;
relax_addressT segment_address_in_file;
{
- long r_index;
+ long r_symbolnum;
know(fixP->fx_r_type < NO_RELOC);
know(fixP->fx_addsy != NULL);
- r_index = (S_IS_DEFINED(fixP->fx_addsy)
- ? S_GET_TYPE(fixP->fx_addsy)
- : fixP->fx_addsy->sy_number);
-
- /* this is easy */
md_number_to_chars(where,
fixP->fx_frag->fr_address + fixP->fx_where - segment_address_in_file,
4);
- /* now the fun stuff */
- where[4] = (r_index >> 16) & 0x0ff;
- where[5] = (r_index >> 8) & 0x0ff;
- where[6] = r_index & 0x0ff;
+ r_symbolnum = (S_IS_DEFINED(fixP->fx_addsy)
+ ? S_GET_TYPE(fixP->fx_addsy)
+ : fixP->fx_addsy->sy_number);
+
+ where[4] = (r_symbolnum >> 16) & 0x0ff;
+ where[5] = (r_symbolnum >> 8) & 0x0ff;
+ where[6] = r_symbolnum & 0x0ff;
where[7] = (((!S_IS_DEFINED(fixP->fx_addsy)) << 7) & 0x80) | (0 & 0x60) | (fixP->fx_r_type & 0x1F);
/* Also easy */
md_number_to_chars(&where[8], fixP->fx_addnumber, 4);