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