/* Definitions of target machine for GNU compiler.
AT&T UNIX PC version (pc7300, 3b1)
-
- Written by Alex Crain
- bug reports to alex@umbc3.umd.edu
-
- Copyright (C) 1987 Free Software Foundation, Inc.
+ Copyright (C) 1987, 1993, 1996, 1999, 2000 Free Software Foundation, Inc.
+ Contributed by Alex Crain (alex@umbc3.umd.edu).
This file is part of GNU CC.
You should have received a copy of the GNU General Public License
along with GNU CC; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
-#define SGS_SWAP_W /* Use swap.w rather than just plain swap */
#define SGS_SWITCH_TABLES /* Different switch table handling */
-#include "hp320.h"
+#include "m68k/hp320.h"
/* See m68k.h. 0 means 680[01]0 with no 68881. */
#undef TARGET_DEFAULT
#define TARGET_DEFAULT 0
+/* Don't try using XFmode. */
+#undef LONG_DOUBLE_TYPE_SIZE
+#define LONG_DOUBLE_TYPE_SIZE 64
+
/* -m68020 requires special flags to the assembler. */
#undef ASM_SPEC
#define ASM_FILE_START(FILE) \
output_file_directive ((FILE), main_input_filename)
-/* Don't try to define `gcc_compiled.' since the assembler might not
- accept symbols with periods and GDB doesn't run on this machine anyway. */
-#define ASM_IDENTIFY_GCC(FILE)
-
/* Define __HAVE_68881__ in preprocessor if -m68881 is specified.
This will control the use of inline 68881 insns in certain macros. */
/* ihnp4!lmayk!lgm@eddie.mit.edu says mc68000 and m68k should not be here. */
#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dmc68k -Dunix -Dunixpc"
+#define CPP_PREDEFINES "-Dmc68k -Dunix -Dunixpc -D__motorola__ -Asystem=unix -Asystem=svr3 -Acpu=m68k -Amachine=m68k"
#undef REGISTER_NAMES
#define REGISTER_NAMES \
: GET_MODE_BITSIZE (MODE) < PARM_BOUNDARY) \
? downward : none)
-/* Override part of the obstack macros. */
+/* The 3b1 does not have `atexit'. */
-#define __PTR_TO_INT(P) ((int)(P))
-#define __INT_TO_PTR(P) ((char *)(P))
+#define NEED_ATEXIT
/* Override parts of m68k.h to fit the SGS-3b1 assembler. */
#undef ASM_OUTPUT_INTERNAL_LABEL
#undef ASM_OUTPUT_OPCODE
#undef ASM_OUTPUT_LOCAL
-#undef ASM_OUTPUT_LABELREF
+#undef USER_LABEL_PREFIX
#undef ASM_OUTPUT_ASCII
#define TARGET_VERSION fprintf (stderr, " (68k, SGS/AT&T unixpc syntax)");
/* The unixpc doesn't know about double's and float's */
#define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
-do { union { double d; long l[2]; } tem; \
- tem.d = (VALUE); \
- fprintf(FILE, "\tlong 0x%x,0x%x\n", tem.l[0], tem.l[1]); \
+do { long l[2]; \
+ REAL_VALUE_TO_TARGET_DOUBLE (VALUE, l); \
+ fprintf (FILE, "\tlong 0x%x,0x%x\n", l[0], l[1]); \
} while (0)
+#undef ASM_OUTPUT_LONG_DOUBLE
+#define ASM_OUTPUT_LONG_DOUBLE(FILE,VALUE) \
+do { long l[3]; \
+ REAL_VALUE_TO_TARGET_LONG_DOUBLE (VALUE, l); \
+ fprintf (FILE, "\tlong 0x%x,0x%x,0x%x\n", l[0], l[1], l[2]); \
+ } while (0)
+
+/* This is how to output an assembler line defining a `float' constant. */
+
#define ASM_OUTPUT_FLOAT(FILE,VALUE) \
-do { union { float f; long l;} tem; \
- tem.f = (VALUE); \
- fprintf (FILE, "\tlong 0x%x\n", tem.l); \
+do { long l; \
+ REAL_VALUE_TO_TARGET_SINGLE (VALUE, l); \
+ fprintf ((FILE), "\tlong 0x%x\n", l); \
} while (0)
#define ASM_OUTPUT_ALIGN(FILE,LOG) \
/* The beginnings of sdb support... */
#define ASM_OUTPUT_SOURCE_FILENAME(FILE, FILENAME) \
- fprintf (FILE, "\tfile\t\"%s\"\n", FILENAME)
+ do { fprintf (FILE, "\tfile\t"); \
+ output_quoted_string (FILE, FILENAME); \
+ fprintf (FILE, "\n"); \
+ } while (0)
#define ASM_OUTPUT_SOURCE_LINE(FILE, LINENO) \
fprintf (FILE, "\tln\t%d\n", \
(sdb_begin_function_line \
- ? last_linenum - sdb_begin_function_line : 1))
+ ? (LINENO) - sdb_begin_function_line : 1))
/* Yet another null terminated string format. */
#define ASM_OUTPUT_ASCII(FILE,PTR,LEN) \
- { register int sp = 0, lp = 0; \
+ do { register int sp = 0, lp = 0; \
fprintf ((FILE), "\tbyte\t"); \
loop: \
if ((PTR)[sp] > ' ' && ! ((PTR)[sp] & 0x80) && (PTR)[sp] != '\\') \
if (++sp < (LEN)) \
{ if (lp > 60) \
{ lp = 0; \
- fprintf ((FILE), "\n%s ", ASCII_DATA_ASM_OP); } \
+ fprintf ((FILE), "\n%s", ASCII_DATA_ASM_OP); } \
else \
putc (',', (FILE)); \
goto loop; } \
- putc ('\n', (FILE)); }
+ putc ('\n', (FILE)); } while (0)
/* Note that in the case of the movhi which fetches an element of
an ADDR_DIFF_VEC the offset output is too large by 2.
#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
fprintf (FILE, "\tlong L%%%d\n", (VALUE))
-#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
+#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
fprintf (FILE, "\tshort L%%%d-L%%%d\n", (VALUE), (REL))
/* ihnp4!lmayk!lgm says that `short 0' triggers assembler bug;
XVECLEN (PATTERN (TABLE), 1) + 1, (PREFIX), (NUM), \
(PREFIX), (NUM), (PREFIX), (NUM))
-/* At end of a switch table, define LD%n iff the symbol LI%n was defined. */
-#define ASM_OUTPUT_CASE_END(FILE,NUM,TABLE) \
- if (RTX_INTEGRATED_P (TABLE)) \
- fprintf (FILE, "\tset LD%%%d,L%%%d-LI%%%d\n", (NUM), (NUM), (NUM))
+/* At end of a switch table, define LDnnn iff the symbol LInnn was defined.
+ Some SGS assemblers have a bug such that "Lnnn-LInnn-2.b(pc,d0.l*2)"
+ fails to assemble. Luckily "LDnnn(pc,d0.l*2)" produces the results
+ we want. This difference can be accommodated by making the assembler
+ define such "LDnnn" to be either "Lnnn-LInnn-2.b", "Lnnn", or any other
+ string, as necessary. This is accomplished via the ASM_OUTPUT_CASE_END
+ macro. */
+
+#define ASM_OUTPUT_CASE_END(FILE,NUM,TABLE) \
+{ if (switch_table_difference_label_flag) \
+ fprintf (FILE, "\tset LD%%%d,L%%%d-LI%%%d\n", (NUM), (NUM), (NUM)); \
+ switch_table_difference_label_flag = 0; }
+
+int switch_table_difference_label_flag;
#define ASM_OUTPUT_OPCODE(FILE, PTR) \
{ if ((PTR)[0] == 'j' && (PTR)[1] == 'b') \
while (*(PTR) != ' ') \
{ putc (*(PTR), (FILE)); ++(PTR); } \
fprintf ((FILE), ".w"); } \
+ else if ((PTR)[0] == 's') \
+ { \
+ if (!strncmp ((PTR), "swap", 4)) \
+ { fprintf ((FILE), "swap.w"); (PTR) += 4; } \
+ } \
else if ((PTR)[0] == 'f') \
{ \
if (!strncmp ((PTR), "fmove", 5)) \
else if ((PTR)[0] == 'm' && (PTR)[1] == 'o' \
&& (PTR)[2] == 'v' && (PTR)[3] == 'e') \
{ fprintf ((FILE), "mov"); (PTR) += 4; \
- if ((PTR)[0] == 'q' || (PTR)[0] == 'a' || \
- (PTR)[0] == 'c') (PTR)++; } \
+ if ((PTR)[0] == 'q' || (PTR)[0] == 'a' \
+ || (PTR)[0] == 'c') (PTR)++; } \
/* SUB, SUBQ, SUBA, SUBI ==> SUB */ \
else if ((PTR)[0] == 's' && (PTR)[1] == 'u' \
&& (PTR)[2] == 'b') \
{ fprintf ((FILE), "sub"); (PTR) += 3; \
- if ((PTR)[0] == 'q' || (PTR)[0] == 'i' || \
- (PTR)[0] == 'a') (PTR)++; } \
+ if ((PTR)[0] == 'q' || (PTR)[0] == 'i' \
+ || (PTR)[0] == 'a') (PTR)++; } \
/* CMP, CMPA, CMPI, CMPM ==> CMP */ \
else if ((PTR)[0] == 'c' && (PTR)[1] == 'm' \
&& (PTR)[2] == 'p') \
{ fprintf ((FILE), "cmp"); (PTR) += 3; \
- if ((PTR)[0] == 'a' || (PTR)[0] == 'i' || \
- (PTR)[0] == 'm') (PTR)++; } \
+ if ((PTR)[0] == 'a' || (PTR)[0] == 'i' \
+ || (PTR)[0] == 'm') (PTR)++; } \
}
#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
assemble_name ((FILE), (NAME)), \
fprintf ((FILE), ",%u\n", (ROUNDED)))
-#define ASM_OUTPUT_LABELREF(FILE,NAME) \
- fprintf (FILE, "%s", NAME)
+#define USER_LABEL_PREFIX ""
\f
/* Override usual definitions of SDB output macros.
These definitions differ only in the absence of the period
#define UMODSI3_LIBCALL "*ulrem"
#define MULSI3_LIBCALL "*lmul"
#define UMULSI3_LIBCALL "*ulmul"
+
+/* Definitions for collect2. */
+
+#define OBJECT_FORMAT_COFF
+#define MY_ISCOFF(magic) \
+ ((magic) == MC68KWRMAGIC || (magic) == MC68KROMAGIC || (magic) == MC68KPGMAGIC)