|
|
1.1 root 1: /* Definitions for Motorola 68k running Linux with ELF format.
2: Copyright (C) 1995 Free Software Foundation, Inc.
3:
4: This file is part of GNU CC.
5:
6: GNU CC is free software; you can redistribute it and/or modify
7: it under the terms of the GNU General Public License as published by
8: the Free Software Foundation; either version 1, or (at your option)
9: any later version.
10:
11: GNU CC is distributed in the hope that it will be useful,
12: but WITHOUT ANY WARRANTY; without even the implied warranty of
13: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14: GNU General Public License for more details.
15:
16: You should have received a copy of the GNU General Public License
17: along with GNU CC; see the file COPYING. If not, write to
18: the Free Software Foundation, 59 Temple Place - Suite 330,
19: Boston, MA 02111-1307, USA. */
20:
21: #define LINUX_DEFAULT_ELF
22: #define MOTOROLA /* Use Motorola syntax */
23: #define USE_GAS /* But GAS wants jbsr instead of jsr */
24:
25: #include <m68k/m68k.h>
26: #include <linux.h> /* some common stuff */
27:
28: #undef TARGET_VERSION
29: #define TARGET_VERSION fprintf (stderr, " (68k Linux/ELF)");
30:
31: /* 68020 with 68881 */
32: #define TARGET_DEFAULT 7
33:
34: #undef SUBTARGET_SWITCHES
35: #define SUBTARGET_SWITCHES {"ieee-fp", 0},
36:
37: /* Here are four prefixes that are used by asm_fprintf to
38: facilitate customization for alternate assembler syntaxes.
39: Machines with no likelihood of an alternate syntax need not
40: define these and need not use asm_fprintf. */
41:
42: /* The prefix for register names. Note that REGISTER_NAMES
43: is supposed to include this prefix. Also note that this is NOT an
44: fprintf format string, it is a literal string */
45:
46: #undef REGISTER_PREFIX
47: #define REGISTER_PREFIX "%"
48:
49: /* The prefix for local (compiler generated) labels.
50: These labels will not appear in the symbol table. */
51:
52: #undef LOCAL_LABEL_PREFIX
53: #define LOCAL_LABEL_PREFIX "."
54:
55: /* The prefix to add to user-visible assembler symbols. */
56:
57: #undef USER_LABEL_PREFIX
58: #define USER_LABEL_PREFIX ""
59:
60: /* How to refer to registers in assembler output.
61: This sequence is indexed by compiler's hard-register-number.
62: Motorola format uses different register names than defined in m68k.h. */
63:
64: #undef REGISTER_NAMES
65:
66: #ifndef SUPPORT_SUN_FPA
67:
68: #define REGISTER_NAMES \
69: {"%d0", "%d1", "%d2", "%d3", "%d4", "%d5", "%d6", "%d7", \
70: "%a0", "%a1", "%a2", "%a3", "%a4", "%a5", "%a6", "%sp", \
71: "%fp0", "%fp1", "%fp2", "%fp3", "%fp4", "%fp5", "%fp6", "%fp7" }
72:
73: #else /* SUPPORTED_SUN_FPA */
74:
75: #define REGISTER_NAMES \
76: {"%d0", "%d1", "%d2", "%d3", "%d4", "%d5", "%d6", "%d7", \
77: "%a0", "%a1", "%a2", "%a3", "%a4", "%a5", "%a6", "%sp", \
78: "%fp0", "%fp1", "%fp2", "%fp3", "%fp4", "%fp5", "%fp6", "%fp7", \
79: "%fpa0", "%fpa1", "%fpa2", "%fpa3", "%fpa4", "%fpa5", "%fpa6", "%fpa7", \
80: "%fpa8", "%fpa9", "%fpa10","%fpa11","%fpa12","%fpa13","%fpa14","%fpa15", \
81: "%fpa16","%fpa17","%fpa18","%fpa19","%fpa20","%fpa21","%fpa22","%fpa23", \
82: "%fpa24","%fpa25","%fpa26","%fpa27","%fpa28","%fpa29","%fpa30","%fpa31" }
83:
84: #endif /* defined SUPPORT_SUN_FPA */
85:
86: #undef SIZE_TYPE
87: #define SIZE_TYPE "unsigned int"
88:
89: #undef PTRDIFF_TYPE
90: #define PTRDIFF_TYPE "int"
91:
92: #undef WCHAR_TYPE
93: #define WCHAR_TYPE "long int"
94:
95: #undef WCHAR_TYPE_SIZE
96: #define WCHAR_TYPE_SIZE BITS_PER_WORD
97:
98: #undef ASM_SPEC
99: #define ASM_SPEC "%{m68030} %{m68040} %{fpic:-k} %{fPIC:-k}"
100:
101: #define CPP_PREDEFINES \
102: "-D__ELF__ -Dunix -Dmc68000 -Dmc68020 -Dlinux -Asystem(unix) -Asystem(posix) -Acpu(m68k) -Amachine(m68k)"
103:
104: #undef CPP_SPEC
105: #if TARGET_DEFAULT & 2
106: #define CPP_SPEC \
107: "%{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{!msoft-float:-D__HAVE_68881__} %{posix:-D_POSIX_SOURCE}"
108: #else
109: #define CPP_SPEC \
110: "%{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{m68881:-D__HAVE_68881__} %{posix:-D_POSIX_SOURCE}"
111: #endif
112:
113: #undef LIB_SPEC
114: #if 1
115: /* We no longer link with libc_p.a or libg.a by default. If you want
116: to profile or debug the Linux C library, please add -lc_p or -ggdb
117: to LDFLAGS at the link time, respectively. */
118: #define LIB_SPEC \
119: "%{!shared:%{!symbolic: %{mieee-fp:-lieee} %{p:-lgmon} %{pg:-lgmon} \
120: %{!ggdb:-lc} %{ggdb:-lg}}}"
121: #else
122: #define LIB_SPEC \
123: "%{!shared:%{!symbolic: \
124: %{mieee-fp:-lieee} %{p:-lgmon -lc_p} %{pg:-lgmon -lc_p} \
125: %{!p:%{!pg:%{!g*:-lc} %{g*:-lg}}}}}"
126: #endif
127:
128: /* Provide a LINK_SPEC appropriate for Linux. Here we provide support
129: for the special GCC options -static and -shared, which allow us to
130: link things in one of these three modes by applying the appropriate
131: combinations of options at link-time. We like to support here for
132: as many of the other GNU linker options as possible. But I don't
133: have the time to search for those flags. I am sure how to add
134: support for -soname shared_object_name. H.J.
135:
136: I took out %{v:%{!V:-V}}. It is too much :-(. They can use
137: -Wl,-V.
138:
139: When the -shared link option is used a final link is not being
140: done. */
141:
142: /* If ELF is the default format, we should not use /lib/elf. */
143:
144: #undef LINK_SPEC
145: #ifndef LINUX_DEFAULT_ELF
146: #define LINK_SPEC "-m m68kelf %{shared} %{symbolic:-shared -Bsymbolic} \
147: %{!shared:%{!symbolic: \
148: %{!static: \
149: %{rdynamic:-export-dynamic} \
150: %{!dynamic-linker*:-dynamic-linker /lib/elf/ld-linux.so.1} \
151: %{!rpath*:-rpath /lib/elf/}} %{static}}}"
152: #else
153: #define LINK_SPEC "-m m68kelf %{shared} %{symbolic:-shared -Bsymbolic} \
154: %{!shared:%{!symbolic: \
155: %{!static: \
156: %{rdynamic:-export-dynamic} \
157: %{!dynamic-linker*:-dynamic-linker /lib/ld-linux.so.1}} \
158: %{static}}}"
159: #endif
160:
161: /* For compatibility with linux/a.out */
162:
163: #undef PCC_BITFIELD_TYPE_MATTERS
164:
165: /* Currently, JUMP_TABLES_IN_TEXT_SECTION must be defined in order to
166: keep switch tables in the text section. */
167:
168: #define JUMP_TABLES_IN_TEXT_SECTION 1
169:
170: /* Use the default action for outputting the case label. */
171: #undef ASM_OUTPUT_CASE_LABEL
172:
173: #define ASM_RETURN_CASE_JUMP \
174: return "jmp (2,%%pc,%0.w)"
175:
176: /* This is how to output an assembler line that says to advance the
177: location counter to a multiple of 2**LOG bytes. */
178:
179: #undef ASM_OUTPUT_ALIGN
180: #define ASM_OUTPUT_ALIGN(FILE,LOG) \
181: if ((LOG) > 0) \
182: fprintf ((FILE), "\t%s \t%u\n", ALIGN_ASM_OP, 1 << (LOG));
183:
184: /* Output assembler code to FILE to increment profiler label # LABELNO
185: for profiling a function entry. */
186:
187: #undef FUNCTION_PROFILER
188: #define FUNCTION_PROFILER(FILE, LABELNO) \
189: { \
190: asm_fprintf (FILE, "\tlea (%LLP%d,%Rpc),%Ra1\n", (LABELNO)); \
191: if (flag_pic) \
192: fprintf (FILE, "\tbsr.l _mcount@PLTPC\n"); \
193: else \
194: fprintf (FILE, "\tjbsr _mcount\n"); \
195: }
196:
197: /* How to renumber registers for dbx and gdb.
198: On the Sun-3, the floating point registers have numbers
199: 18 to 25, not 16 to 23 as they do in the compiler. */
200:
201: #define DBX_REGISTER_NUMBER(REGNO) ((REGNO) < 16 ? (REGNO) : (REGNO) + 2)
202:
203: /* Do not break .stabs pseudos into continuations. */
204:
205: #define DBX_CONTIN_LENGTH 0
206:
207: /* Allow folding division by zero. */
208: #define REAL_INFINITY
209:
210: /* 1 if N is a possible register number for a function value. For
211: m68k/SVR4 allow d0, a0, or fp0 as return registers, for integral,
212: pointer, or floating types, respectively. Reject fp0 if not using
213: a 68881 coprocessor. */
214:
215: #undef FUNCTION_VALUE_REGNO_P
216: #define FUNCTION_VALUE_REGNO_P(N) \
217: ((N) == 0 || (N) == 8 || (TARGET_68881 && (N) == 16))
218:
219: /* Define this to be true when FUNCTION_VALUE_REGNO_P is true for
220: more than one register. */
221:
222: #undef NEEDS_UNTYPED_CALL
223: #define NEEDS_UNTYPED_CALL 1
224:
225: /* Define how to generate (in the callee) the output value of a
226: function and how to find (in the caller) the value returned by a
227: function. VALTYPE is the data type of the value (as a tree). If
228: the precise function being called is known, FUNC is its
229: FUNCTION_DECL; otherwise, FUNC is 0. For m68k/SVR4 generate the
230: result in d0, a0, or fp0 as appropriate. */
231:
232: #undef FUNCTION_VALUE
233: #define FUNCTION_VALUE(VALTYPE, FUNC) \
234: (TREE_CODE (VALTYPE) == REAL_TYPE && TARGET_68881 \
235: ? gen_rtx (REG, TYPE_MODE (VALTYPE), 16) \
236: : (POINTER_TYPE_P (VALTYPE) \
237: ? gen_rtx (REG, TYPE_MODE (VALTYPE), 8) \
238: : gen_rtx (REG, TYPE_MODE (VALTYPE), 0)))
239:
240: /* For compatibility with the large body of existing code which does
241: not always properly declare external functions returning pointer
242: types, the m68k/SVR4 convention is to copy the value returned for
243: pointer functions from a0 to d0 in the function epilogue, so that
244: callers that have neglected to properly declare the callee can
245: still find the correct return value. */
246:
247: extern int current_function_returns_pointer;
248: #define FUNCTION_EXTRA_EPILOGUE(FILE, SIZE) \
249: do { \
250: if ((current_function_returns_pointer) && \
251: ! find_equiv_reg (0, get_last_insn (), 0, 0, 0, 8, Pmode)) \
252: asm_fprintf (FILE, "\tmove.l %Ra0,%Rd0\n"); \
253: } while (0);
254:
255: /* Define how to find the value returned by a library function
256: assuming the value has mode MODE.
257: For m68k/SVR4 look for integer values in d0, pointer values in d0
258: (returned in both d0 and a0), and floating values in fp0. */
259:
260: #undef LIBCALL_VALUE
261: #define LIBCALL_VALUE(MODE) \
262: (((MODE) == SFmode || (MODE) == DFmode) && TARGET_68881 \
263: ? gen_rtx (REG, (MODE), 16) \
264: : gen_rtx (REG, (MODE), 0))
265:
266: /* In m68k svr4, a symbol_ref rtx can be a valid PIC operand if it is
267: an operand of a function call. */
268: #undef LEGITIMATE_PIC_OPERAND_P
269: #define LEGITIMATE_PIC_OPERAND_P(X) \
270: (! symbolic_operand (X, VOIDmode) \
271: || (GET_CODE (X) == SYMBOL_REF && SYMBOL_REF_FLAG (X)))
272:
273: /* Turn off function cse if we are doing PIC. We always want function
274: call to be done as `bsr foo@PLTPC', so it will force the assembler
275: to create the PLT entry for `foo'. Doing function cse will cause
276: the address of `foo' to be loaded into a register, which is exactly
277: what we want to avoid when we are doing PIC on svr4 m68k. */
278: #undef SUBTARGET_OVERRIDE_OPTIONS
279: #define SUBTARGET_OVERRIDE_OPTIONS \
280: if (flag_pic) flag_no_function_cse = 1;
281:
282: /* For m68k SVR4, structures are returned using the reentrant
283: technique. */
284: #undef PCC_STATIC_STRUCT_RETURN
285: #define DEFAULT_PCC_STRUCT_RETURN 0
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.