]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/config/m68k/linux.h
m68k.md: Add Coldfire FPU support.
[thirdparty/gcc.git] / gcc / config / m68k / linux.h
CommitLineData
956d6950
JL
1/* Definitions for Motorola 68k running Linux-based GNU systems with
2 ELF format.
dcc21c4c 3 Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2006
3b4b85c9 4 Free Software Foundation, Inc.
8291155f 5
7ec022b2 6This file is part of GCC.
8291155f 7
7ec022b2 8GCC is free software; you can redistribute it and/or modify
8291155f 9it under the terms of the GNU General Public License as published by
c30b6330 10the Free Software Foundation; either version 2, or (at your option)
8291155f
RK
11any later version.
12
7ec022b2 13GCC is distributed in the hope that it will be useful,
8291155f
RK
14but WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16GNU General Public License for more details.
17
18You should have received a copy of the GNU General Public License
7ec022b2 19along with GCC; see the file COPYING. If not, write to
39d14dda
KC
20the Free Software Foundation, 51 Franklin Street, Fifth Floor,
21Boston, MA 02110-1301, USA. */
8291155f 22
8291155f 23#undef TARGET_VERSION
956d6950 24#define TARGET_VERSION fprintf (stderr, " (68k GNU/Linux with ELF)");
8291155f 25
3704aae9
RZ
26/* Default target comes from config.gcc. */
27
28#undef TARGET_DEFAULT
29#ifdef TARGET_CPU_DEFAULT
30#define TARGET_DEFAULT TARGET_CPU_DEFAULT
31#else
9811059c 32#define TARGET_DEFAULT (MASK_BITFIELD|MASK_68881|MASK_68020)
3704aae9 33#endif
8291155f 34
270eeaa5
RK
35/* for 68k machines this only needs to be TRUE for the 68000 */
36
3b4b85c9 37#undef STRICT_ALIGNMENT
270eeaa5
RK
38#define STRICT_ALIGNMENT 0
39
8291155f
RK
40/* Here are four prefixes that are used by asm_fprintf to
41 facilitate customization for alternate assembler syntaxes.
42 Machines with no likelihood of an alternate syntax need not
43 define these and need not use asm_fprintf. */
44
45/* The prefix for register names. Note that REGISTER_NAMES
46 is supposed to include this prefix. Also note that this is NOT an
47 fprintf format string, it is a literal string */
48
49#undef REGISTER_PREFIX
50#define REGISTER_PREFIX "%"
51
52/* The prefix for local (compiler generated) labels.
7a1929e1 53 These labels will not appear in the symbol table. */
8291155f
RK
54
55#undef LOCAL_LABEL_PREFIX
56#define LOCAL_LABEL_PREFIX "."
57
7a1929e1 58/* The prefix to add to user-visible assembler symbols. */
8291155f
RK
59
60#undef USER_LABEL_PREFIX
61#define USER_LABEL_PREFIX ""
62
0a22948f
RK
63#define ASM_COMMENT_START "|"
64
8291155f
RK
65#undef SIZE_TYPE
66#define SIZE_TYPE "unsigned int"
3b4b85c9 67
8291155f
RK
68#undef PTRDIFF_TYPE
69#define PTRDIFF_TYPE "int"
3b4b85c9 70
8291155f
RK
71#undef WCHAR_TYPE
72#define WCHAR_TYPE "long int"
3b4b85c9 73
8291155f
RK
74#undef WCHAR_TYPE_SIZE
75#define WCHAR_TYPE_SIZE BITS_PER_WORD
76
a7fbe404
NB
77/* Target OS builtins. */
78#define TARGET_OS_CPP_BUILTINS() \
79 do \
80 { \
26b0ad13 81 LINUX_TARGET_OS_CPP_BUILTINS(); \
a7fbe404
NB
82 builtin_define_std ("mc68000"); \
83 builtin_define_std ("mc68020"); \
a7fbe404
NB
84 } \
85 while (0)
8291155f 86
4e2e315f
NB
87#define TARGET_OBJFMT_CPP_BUILTINS() \
88 do \
89 { \
90 builtin_define ("__ELF__"); \
91 } \
92 while (0)
93
8291155f 94#undef CPP_SPEC
89d9619d
RK
95#if TARGET_DEFAULT & MASK_68881
96#define CPP_SPEC \
3d119f8f 97 "%{!msoft-float:-D__HAVE_68881__} %{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
89d9619d
RK
98#else
99#define CPP_SPEC \
3d119f8f 100 "%{m68881:-D__HAVE_68881__} %{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
89d9619d 101#endif
8291155f 102
53c87bfd
RK
103/* We override the ASM_SPEC from svr4.h because we must pass -m68040 down
104 to the assembler. */
105#undef ASM_SPEC
106#define ASM_SPEC \
107 "%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*} \
108%{m68040} %{m68060:-m68040}"
109
956d6950 110/* Provide a LINK_SPEC appropriate for GNU/Linux. Here we provide support
8291155f
RK
111 for the special GCC options -static and -shared, which allow us to
112 link things in one of these three modes by applying the appropriate
113 combinations of options at link-time. We like to support here for
114 as many of the other GNU linker options as possible. But I don't
115 have the time to search for those flags. I am sure how to add
116 support for -soname shared_object_name. H.J.
117
118 I took out %{v:%{!V:-V}}. It is too much :-(. They can use
119 -Wl,-V.
120
121 When the -shared link option is used a final link is not being
122 done. */
123
7a1929e1 124/* If ELF is the default format, we should not use /lib/elf. */
8291155f
RK
125
126#undef LINK_SPEC
e91bc805
RK
127#define LINK_SPEC "-m m68kelf %{shared} \
128 %{!shared: \
89d9619d 129 %{!static: \
e91bc805
RK
130 %{rdynamic:-export-dynamic} \
131 %{!dynamic-linker*:-dynamic-linker /lib/ld.so.1}} \
132 %{static}}"
8291155f
RK
133
134/* For compatibility with linux/a.out */
135
136#undef PCC_BITFIELD_TYPE_MATTERS
137
138/* Currently, JUMP_TABLES_IN_TEXT_SECTION must be defined in order to
139 keep switch tables in the text section. */
140
141#define JUMP_TABLES_IN_TEXT_SECTION 1
142
143/* Use the default action for outputting the case label. */
144#undef ASM_OUTPUT_CASE_LABEL
c1c1d123
AS
145#define ASM_RETURN_CASE_JUMP \
146 do { \
9425fb04 147 if (TARGET_COLDFIRE) \
c1c1d123
AS
148 { \
149 if (ADDRESS_REG_P (operands[0])) \
150 return "jmp %%pc@(2,%0:l)"; \
151 else \
152 return "ext%.l %0\n\tjmp %%pc@(2,%0:l)"; \
153 } \
154 else \
155 return "jmp %%pc@(2,%0:w)"; \
9fb9ea4a 156 } while (0)
8291155f
RK
157
158/* This is how to output an assembler line that says to advance the
159 location counter to a multiple of 2**LOG bytes. */
160
161#undef ASM_OUTPUT_ALIGN
162#define ASM_OUTPUT_ALIGN(FILE,LOG) \
163 if ((LOG) > 0) \
016c8440 164 fprintf ((FILE), "%s%u\n", ALIGN_ASM_OP, 1 << (LOG));
8291155f 165
bdf3e90e
RK
166/* If defined, a C expression whose value is a string containing the
167 assembler operation to identify the following data as uninitialized global
168 data. */
169
6e7b07a7 170#define BSS_SECTION_ASM_OP "\t.section\t.bss"
bdf3e90e
RK
171
172/* A C statement (sans semicolon) to output to the stdio stream
09ea387b 173 FILE the assembler definition of uninitialized global DECL named
bdf3e90e
RK
174 NAME whose size is SIZE bytes and alignment is ALIGN bytes.
175 Try to use asm_output_aligned_bss to implement this macro. */
176
09ea387b
DE
177#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
178 asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
bdf3e90e 179
8291155f
RK
180/* Output assembler code to FILE to increment profiler label # LABELNO
181 for profiling a function entry. */
182
183#undef FUNCTION_PROFILER
184#define FUNCTION_PROFILER(FILE, LABELNO) \
185{ \
186 asm_fprintf (FILE, "\tlea (%LLP%d,%Rpc),%Ra1\n", (LABELNO)); \
187 if (flag_pic) \
188 fprintf (FILE, "\tbsr.l _mcount@PLTPC\n"); \
189 else \
190 fprintf (FILE, "\tjbsr _mcount\n"); \
191}
192
193/* How to renumber registers for dbx and gdb.
194 On the Sun-3, the floating point registers have numbers
195 18 to 25, not 16 to 23 as they do in the compiler. */
196
197#define DBX_REGISTER_NUMBER(REGNO) ((REGNO) < 16 ? (REGNO) : (REGNO) + 2)
198
199/* Do not break .stabs pseudos into continuations. */
200
201#define DBX_CONTIN_LENGTH 0
202
8291155f
RK
203/* 1 if N is a possible register number for a function value. For
204 m68k/SVR4 allow d0, a0, or fp0 as return registers, for integral,
205 pointer, or floating types, respectively. Reject fp0 if not using
206 a 68881 coprocessor. */
207
208#undef FUNCTION_VALUE_REGNO_P
209#define FUNCTION_VALUE_REGNO_P(N) \
210 ((N) == 0 || (N) == 8 || (TARGET_68881 && (N) == 16))
211
212/* Define this to be true when FUNCTION_VALUE_REGNO_P is true for
213 more than one register. */
214
215#undef NEEDS_UNTYPED_CALL
216#define NEEDS_UNTYPED_CALL 1
217
218/* Define how to generate (in the callee) the output value of a
219 function and how to find (in the caller) the value returned by a
220 function. VALTYPE is the data type of the value (as a tree). If
221 the precise function being called is known, FUNC is its
222 FUNCTION_DECL; otherwise, FUNC is 0. For m68k/SVR4 generate the
7a1929e1 223 result in d0, a0, or fp0 as appropriate. */
3b4b85c9 224
8291155f
RK
225#undef FUNCTION_VALUE
226#define FUNCTION_VALUE(VALTYPE, FUNC) \
dcc21c4c 227 m68k_function_value (VALTYPE, FUNC)
8291155f
RK
228
229/* For compatibility with the large body of existing code which does
230 not always properly declare external functions returning pointer
231 types, the m68k/SVR4 convention is to copy the value returned for
232 pointer functions from a0 to d0 in the function epilogue, so that
233 callers that have neglected to properly declare the callee can
234 still find the correct return value. */
235
8291155f
RK
236#define FUNCTION_EXTRA_EPILOGUE(FILE, SIZE) \
237do { \
49ad7cfa
BS
238 if (current_function_returns_pointer \
239 && ! find_equiv_reg (0, get_last_insn (), 0, 0, 0, 8, Pmode)) \
8291155f
RK
240 asm_fprintf (FILE, "\tmove.l %Ra0,%Rd0\n"); \
241} while (0);
242
243/* Define how to find the value returned by a library function
244 assuming the value has mode MODE.
245 For m68k/SVR4 look for integer values in d0, pointer values in d0
246 (returned in both d0 and a0), and floating values in fp0. */
247
248#undef LIBCALL_VALUE
249#define LIBCALL_VALUE(MODE) \
dcc21c4c 250 m68k_libcall_value (MODE)
8291155f 251
8291155f 252/* For m68k SVR4, structures are returned using the reentrant
7a1929e1 253 technique. */
8291155f
RK
254#undef PCC_STATIC_STRUCT_RETURN
255#define DEFAULT_PCC_STRUCT_RETURN 0
d649cc96 256
31fa03e5 257/* Finalize the trampoline by flushing the insn cache. */
f12d26af 258
31fa03e5
RK
259#undef FINALIZE_TRAMPOLINE
260#define FINALIZE_TRAMPOLINE(TRAMP) \
1d8eaa6b 261 emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__clear_cache"), \
31fa03e5
RK
262 0, VOIDmode, 2, TRAMP, Pmode, \
263 plus_constant (TRAMP, TRAMPOLINE_SIZE), Pmode);
f12d26af 264
31fa03e5
RK
265/* Clear the instruction cache from `beg' to `end'. This makes an
266 inline system call to SYS_cacheflush. The arguments are as
267 follows:
268
269 cacheflush (addr, scope, cache, len)
270
271 addr - the start address for the flush
272 scope - the scope of the flush (see the cpush insn)
273 cache - which cache to flush (see the cpush insn)
274 len - a factor relating to the number of flushes to perform:
3b4b85c9 275 len/16 lines, or len/4096 pages. */
31fa03e5
RK
276
277#define CLEAR_INSN_CACHE(BEG, END) \
278{ \
279 register unsigned long _beg __asm ("%d1") = (unsigned long) (BEG); \
280 unsigned long _end = (unsigned long) (END); \
281 register unsigned long _len __asm ("%d4") = (_end - _beg + 32); \
282 __asm __volatile \
3b4b85c9
BI
283 ("move%.l #123, %/d0\n\t" /* system call nr */ \
284 "move%.l #1, %/d2\n\t" /* clear lines */ \
285 "move%.l #3, %/d3\n\t" /* insn+data caches */ \
286 "trap #0" \
31fa03e5
RK
287 : /* no outputs */ \
288 : "d" (_beg), "d" (_len) \
289 : "%d0", "%d2", "%d3"); \
f12d26af 290}
3edc56a9 291
a5fe455b 292#define TARGET_ASM_FILE_END file_end_indicate_exec_stack