aboutsummaryrefslogtreecommitdiff
path: root/gas/config
diff options
context:
space:
mode:
Diffstat (limited to 'gas/config')
-rw-r--r--gas/config/obj-coffbfd.c4
-rw-r--r--gas/config/obj-coffbfd.h14
-rw-r--r--gas/config/tc-m88k.c170
-rw-r--r--gas/config/tc-m88k.h34
4 files changed, 209 insertions, 13 deletions
diff --git a/gas/config/obj-coffbfd.c b/gas/config/obj-coffbfd.c
index d62bea7..0496739 100644
--- a/gas/config/obj-coffbfd.c
+++ b/gas/config/obj-coffbfd.c
@@ -178,6 +178,10 @@ const pseudo_typeS obj_pseudo_table[] =
{"ident", obj_coff_ident, 0},
{"ABORT", s_abort, 0},
{"lcomm", obj_coff_lcomm, 0},
+#ifdef TC_M88K
+ /* The m88k uses sdef instead of def. */
+ {"sdef", obj_coff_def, 0},
+#endif
{NULL} /* end sentinel */
}; /* obj_pseudo_table */
diff --git a/gas/config/obj-coffbfd.h b/gas/config/obj-coffbfd.h
index 9984a72..c96e6bf 100644
--- a/gas/config/obj-coffbfd.h
+++ b/gas/config/obj-coffbfd.h
@@ -64,6 +64,11 @@
#define TARGET_FORMAT "coff-m68k"
#endif
+#ifdef TC_M88K
+#include "coff/m88k.h"
+#define TARGET_FORMAT "coff-m88kbcs"
+#endif
+
#ifdef TC_I386
#include "coff/i386.h"
#define TARGET_FORMAT "coff-i386"
@@ -156,10 +161,11 @@ obj_symbol_type;
/* True if a debug special symbol entry */
#define S_IS_DEBUG(s) ((s)->sy_symbol.ost_entry.n_scnum == C_DEBUG_SECTION)
/* True if a symbol is local symbol name */
-/* A symbol name whose name begin with ^A is a gas internal pseudo symbol */
-#define S_IS_LOCAL(s) (S_GET_NAME(s)[0] == '\001' || \
- (s)->sy_symbol.ost_entry.n_scnum == C_REGISTER_SECTION || \
- (S_LOCAL_NAME(s) && !flagseen['L']))
+/* A symbol name whose name includes ^A is a gas internal pseudo symbol */
+#define S_IS_LOCAL(s) \
+ ((s)->sy_symbol.ost_entry.n_scnum == C_REGISTER_SECTION \
+ || (S_LOCAL_NAME(s) && !flagseen['L']) \
+ || (strchr (s, '\001') != NULL))
/* True if a symbol is not defined in this file */
#define S_IS_EXTERN(s) ((s)->sy_symbol.ost_entry.n_scnum == 0 \
&& S_GET_VALUE (s) == 0)
diff --git a/gas/config/tc-m88k.c b/gas/config/tc-m88k.c
index 9f3a8e4..2178be3 100644
--- a/gas/config/tc-m88k.c
+++ b/gas/config/tc-m88k.c
@@ -155,20 +155,19 @@ const char EXP_CHARS[] = "eE";
/* or 0H1.234E-12 (see exp chars above) */
const char FLT_CHARS[] = "dDfF";
-extern void float_cons (), cons (), s_globl (), s_line (), s_space (),
+extern void float_cons (), cons (), s_globl (), s_space (),
s_set (), s_lcomm ();
static void s_file ();
-static void s_bss ();
const pseudo_typeS md_pseudo_table[] =
{
+ {"align", s_align_bytes, 4},
{"def", s_set, 0},
{"dfloat", float_cons, 'd'},
{"ffloat", float_cons, 'f'},
{"global", s_globl, 0},
{"half", cons, 2},
- {"bss", s_bss, 0},
- {"ln", s_line, 0},
+ {"bss", s_lcomm, 1},
{"string", stringer, 0},
{"word", cons, 4},
{"zero", s_space, 0},
@@ -222,6 +221,7 @@ md_assemble (op)
char *op;
{
char *param, *thisfrag;
+ char c;
struct m88k_opcode *format;
struct m88k_insn insn;
@@ -231,14 +231,46 @@ md_assemble (op)
for (param = op; *param != 0 && !isspace (*param); param++)
;
- if (*param != 0)
- *param++ = 0;
+ c = *param;
+ *param++ = '\0';
/* try to find the instruction in the hash table */
if ((format = (struct m88k_opcode *) hash_find (op_hash, op)) == NULL)
{
- as_fatal ("Invalid mnemonic '%s'", op);
+ extern struct hash_control *po_hash;
+ pseudo_typeS *pop;
+ char *hold;
+
+ /* The m88k assembler does not use `.' before pseudo-ops, for
+ some reason. So if don't find an opcode, try for a
+ pseudo-op. */
+ pop = (pseudo_typeS *) hash_find (po_hash, op);
+
+ if (pop == NULL)
+ {
+ as_bad ("Invalid mnemonic '%s'", op);
+ return;
+ }
+
+ /* Restore the character after the opcode. */
+ *--param = c;
+
+ /* Now we have to hack. The pseudo-op code expects
+ input_line_pointer to point to the first non-whitespace
+ character after the pseudo-op itself. The calling code has
+ already advanced input_line_pointer to the end of the line
+ and inserted a null byte. We set things up for the pseudo-op
+ code, and then prepare to return from this function. */
+ hold = input_line_pointer;
+ *hold = ';';
+ input_line_pointer = param;
+ SKIP_WHITESPACE ();
+
+ (*pop->poc_handler) (pop->poc_val);
+
+ input_line_pointer = hold;
+
return;
}
@@ -943,6 +975,11 @@ md_number_to_chars (buf, val, nbytes)
}
}
+#if 0
+
+/* This routine is never called. What is it for?
+ Ian Taylor, Cygnus Support 13 Jul 1993 */
+
void
md_number_to_imm (buf, val, nbytes, fixP, seg_type)
unsigned char *buf;
@@ -1014,6 +1051,8 @@ md_number_to_imm (buf, val, nbytes, fixP, seg_type)
}
}
+#endif /* 0 */
+
void
md_number_to_disp (buf, val, nbytes)
char *buf;
@@ -1157,6 +1196,13 @@ md_end ()
{
}
+#if 0
+
+/* As far as I can tell, this routine is never called. What is it
+ doing here?
+ Ian Taylor, Cygnus Support 13 Jul 1993 */
+
+
/*
* Risc relocations are completely different, so it needs
* this machine dependent routine to emit them.
@@ -1213,6 +1259,14 @@ emit_relocations (fixP, segment_address_in_file)
return;
}
+#endif /* 0 */
+
+#if 0
+
+/* This routine can be subsumed by s_lcomm in read.c.
+ Ian Taylor, Cygnus Support 13 Jul 1993 */
+
+
static void
s_bss ()
{
@@ -1290,3 +1344,105 @@ s_bss ()
return;
}
+
+#endif /* 0 */
+
+#ifdef M88KCOFF
+
+/* These functions are needed if we are linking with obj-coffbfd.c.
+ That file may be replaced by a more BFD oriented version at some
+ point. If that happens, these functions should be rexamined.
+
+ Ian Lance Taylor, Cygnus Support, 13 July 1993. */
+
+/* Given a fixS structure (created by a call to fix_new, above),
+ return the BFD relocation type to use for it. */
+
+short
+tc_coff_fix2rtype (fixp)
+ fixS *fixp;
+{
+ switch (fixp->fx_r_type)
+ {
+ case RELOC_LO16:
+ return R_LVRT16;
+ case RELOC_HI16:
+ return R_HVRT16;
+ case RELOC_PC16:
+ return R_PCR16L;
+ case RELOC_PC26:
+ return R_PCR26L;
+ case RELOC_32:
+ return R_VRT32;
+ case RELOC_IW16:
+ return R_VRT16;
+ default:
+ abort ();
+ }
+}
+
+/* Apply a fixS to the object file. Since COFF does not use addends
+ in relocs, the addend is actually stored directly in the object
+ file itself. */
+
+void
+md_apply_fix (fixp, val)
+ fixS *fixp;
+ long val;
+{
+ char *buf;
+
+ buf = fixp->fx_frag->fr_literal + fixp->fx_where;
+
+ switch (fixp->fx_r_type)
+ {
+ case RELOC_IW16:
+ buf[2] = val >> 8;
+ buf[3] = val;
+ break;
+
+ case RELOC_LO16:
+ buf[0] = val >> 8;
+ buf[1] = val;
+ break;
+
+ case RELOC_HI16:
+ buf[0] = val >> 24;
+ buf[1] = val >> 16;
+ break;
+
+ case RELOC_PC16:
+ buf[0] = val >> 10;
+ buf[1] = val >> 2;
+ break;
+
+ case RELOC_PC26:
+ buf[0] |= (val >> 26) & 0x03;
+ buf[1] = val >> 18;
+ buf[2] = val >> 10;
+ buf[3] = val >> 2;
+ break;
+
+ case RELOC_32:
+ buf[0] = val >> 24;
+ buf[1] = val >> 16;
+ buf[2] = val >> 8;
+ buf[3] = val;
+ break;
+
+ default:
+ abort ();
+ }
+}
+
+/* Where a PC relative offset is calculated from. On the m88k they
+ are calculated from just after the instruction. */
+
+long
+md_pcrel_from (fixp)
+ fixS *fixp;
+{
+ return fixp->fx_frag->fr_address + fixp->fx_where + 4;
+}
+
+#endif /* M88KCOFF */
diff --git a/gas/config/tc-m88k.h b/gas/config/tc-m88k.h
index 677cdb7..eaec784 100644
--- a/gas/config/tc-m88k.h
+++ b/gas/config/tc-m88k.h
@@ -20,6 +20,14 @@ 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, 675 Mass Ave, Cambridge, MA 02139, USA. */
+#define TC_M88K
+
+#ifdef M88KCOFF
+#define COFF_MAGIC MC88OMAGIC
+#define BFD_ARCH bfd_arch_m88k
+#define COFF_FLAGS F_AR32W
+#endif
+
#define NEED_FX_R_TYPE
/* different type of relocation available in the m88k */
@@ -47,11 +55,33 @@ struct reloc_info_m88k
#define relocation_info reloc_info_m88k
-#define LOCAL_LABEL(name) (name[0] =='@' \
- && ( name [1] == 'L' || name [1] == '.' ))
+/* The m88k uses '@' to start local labels. */
+#define LEX_AT (LEX_BEGIN_NAME | LEX_NAME)
+#define LOCAL_LABEL(name) \
+ ((name[0] =='@' && (name [1] == 'L' || name [1] == '.')) \
+ || (name[0] == 'L' && name[1] == '0' && name[2] == '\001'))
#ifndef BFD_ASSEMBLER
#define md_convert_frag(h,f) {as_fatal ("m88k convert_frag\n");}
#else
#define md_convert_frag(b,s,f) {as_fatal ("m88k convert_frag\n");}
#endif
+
+/* We don't need to do anything special for undefined symbols. */
+#define md_undefined_symbol(s) 0
+
+/* We have no special operand handling. */
+#define md_operand(e)
+
+#ifdef M88KCOFF
+
+/* Whether a reloc should be output. */
+#define TC_COUNT_RELOC(fixp) ((fixp)->fx_addsy != NULL)
+
+/* Get the BFD reloc type to use for a gas fixS structure. */
+#define TC_COFF_FIX2RTYPE(fixp) tc_coff_fix2rtype (fixp)
+
+/* No special hook needed for symbols. */
+#define tc_coff_symbol_emit_hook(s)
+
+#endif /* M88KCOFF */