|
|
1.1 root 1: /* Definitions of target machine for GNU compiler.
2: Motorola m88100 running the AT&T/Unisoft/Motorla V.3 reference port.
3: Copyright (C) 1990, 1991 Free Software Foundation, Inc.
4: Contributed by Ray Essick ([email protected])
5: Currently supported by Tom Wood ([email protected])
6:
7: This file is part of GNU CC.
8:
9: GNU CC is free software; you can redistribute it and/or modify
10: it under the terms of the GNU General Public License as published by
11: the Free Software Foundation; either version 2, or (at your option)
12: any later version.
13:
14: GNU CC is distributed in the hope that it will be useful,
15: but WITHOUT ANY WARRANTY; without even the implied warranty of
16: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17: GNU General Public License for more details.
18:
19: You should have received a copy of the GNU General Public License
20: along with GNU CC; see the file COPYING. If not, write to
21: the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
22:
23: #include "m88k.h"
24:
25: /* Default switches */
26: #undef TARGET_DEFAULT
27: #define TARGET_DEFAULT (MASK_CHECK_ZERO_DIV | \
28: MASK_OCS_DEBUG_INFO | \
29: MASK_OCS_FRAME_POSITION)
30:
31: /* Macros to be automatically defined. */
32: #undef CPP_PREDEFINES
33: #define CPP_PREDEFINES "-Dm88000 -Dm88k -DsysV88 -D__CLASSIFY_TYPE__=2"
34:
35: /* Override svr3.h to link with ?crt0.o instead of ?crt1.o and ?crtn.o.
36: From [email protected]. */
37: #undef STARTFILE_SPEC
38: #define STARTFILE_SPEC \
1.1.1.2 ! root 39: "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}} crtbegin.o%s"
1.1 root 40:
41: /* Profiled libraries live in a different directory but keep the same
42: names other than that. [email protected] says -lg is always needed. */
43: #undef LIB_SPEC
1.1.1.2 ! root 44: #define LIB_SPEC "%{p:-L/lib/libp}%{pg:%{!p:-L/lib/libp}} -lg -lc crtend.o%s"
1.1 root 45:
46: /* Hot version of the profiler that uses r10 to pass the address of
47: the counter. the _gcc_mcount routine knows not to screw with
48: the parameter registers.
49:
50: DG/UX does this; i wrote a gnu-c/88k specific version and put it
51: in libgcc2.c -- RBE; this macro knows about the leading underscore
52: convention. */
53: #undef FUNCTION_PROFILER
54: #define FUNCTION_PROFILER(FILE, LABELNO) \
55: output_function_profiler (FILE, LABELNO, "_gcc_mcount", 0)
56:
57: /* Various other changes that we want to have in place without
58: too many changes to the m88k.h file. */
59: #undef USE_LIBG
60: #define USE_LIBG
1.1.1.2 ! root 61:
! 62: /* Define a few machine-specific details of the implementation of
! 63: constructors. */
! 64:
! 65: /* Although the .init section is used, it is not automatically invoked. */
! 66: #define INVOKE__main
! 67:
! 68: /* State that atexit exists so __do_global_ctors will register
! 69: __do_global_dtors. */
! 70: #define HAVE_ATEXIT
! 71:
! 72: #if (STACK_BOUNDARY / BITS_PER_UNIT) == 16 && REG_PARM_STACK_SPACE (0) == 32
! 73: #define CTOR_LIST_BEGIN \
! 74: asm (INIT_SECTION_ASM_OP); \
! 75: asm ("\tsubu\t r31,r31,16"); \
! 76: asm ("\tst\t r0,r31,32");
! 77: #define CTOR_LIST_END
! 78: #endif
! 79:
! 80: /* ASM_OUTPUT_CONSTRUCTOR outputs code into the .init section to push the
! 81: address of the constructor. This becomes the body of __do_global_ctors
! 82: in crtstuff.c. r13 is a temporary register. */
! 83: #undef ASM_OUTPUT_CONSTRUCTOR
! 84: #define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
! 85: do { \
! 86: init_section (); \
! 87: fprintf (FILE, "\tor.u\t r13,r0,hi16("); \
! 88: assemble_name (FILE, NAME); \
! 89: fprintf (FILE, ")\n\tor\t r13,r13,lo16("); \
! 90: assemble_name (FILE, NAME); \
! 91: fprintf (FILE, ")\n\tsubu\t r31,r31,%d\n\tst\t r13,r31,%d\n", \
! 92: STACK_BOUNDARY / BITS_PER_UNIT, REG_PARM_STACK_SPACE (0)); \
! 93: } while (0)
! 94:
! 95: #undef DO_GLOBAL_CTORS_BODY
! 96: #define DO_GLOBAL_CTORS_BODY \
! 97: do { \
! 98: func_ptr *__CTOR_LIST__ = __builtin_alloca (0), *p; \
! 99: for (p = __CTOR_LIST__; *p; p += 4) \
! 100: (*p) (); \
! 101: } while (0)
! 102:
! 103: #define DTOR_LIST_BEGIN \
! 104: asm (FINI_SECTION_ASM_OP); \
! 105: func_ptr __DTOR_LIST__[4] = { (func_ptr) (-1), (func_ptr) (-1), \
! 106: (func_ptr) (-1), (func_ptr) (-1) }
! 107: #define DTOR_LIST_END \
! 108: asm (FINI_SECTION_ASM_OP); \
! 109: func_ptr __DTOR_END__[4] = { (func_ptr) 0, (func_ptr) 0, \
! 110: (func_ptr) 0, (func_ptr) 0 }
! 111:
! 112: /* A C statement (sans semicolon) to output an element in the table of
! 113: global destructors. The table is constructed in the .fini section
! 114: so that an explicit linker script is not required. The complication
! 115: is that this section is padded with NOP instructions and to either
! 116: 8 or 16 byte alignment depending on the specific system. A clever
! 117: way to avoid trouble is to output a block of 16 bytes where the
! 118: extra words are known values (-1). */
! 119: #undef ASM_OUTPUT_DESTRUCTOR
! 120: #define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
! 121: do { \
! 122: register int i; \
! 123: fini_section (); \
! 124: fprintf (FILE, "\t%s\t ", ASM_LONG); \
! 125: assemble_name (FILE,NAME); \
! 126: fprintf (FILE, "\n"); \
! 127: for (i = 1; i < 4; i++) \
! 128: fprintf (FILE, "\t%s\t -1\n", ASM_LONG); \
! 129: } while (0)
! 130:
! 131: /* Walk the list looking for the terminating zero and ignoring all values of
! 132: -1. */
! 133: #undef DO_GLOBAL_DTORS_BODY
! 134: #define DO_GLOBAL_DTORS_BODY \
! 135: do { \
! 136: int i; \
! 137: for (i = 0; __DTOR_LIST__[i] != 0; i++) \
! 138: if (((int *)__DTOR_LIST__)[i] != -1) \
! 139: __DTOR_LIST__[i] (); \
! 140: } while (0)
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.