1 |
38 |
julius |
/* Definitions for GCC. Part of the machine description for CRIS.
|
2 |
|
|
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
|
3 |
|
|
Contributed by Axis Communications. Written by Hans-Peter Nilsson.
|
4 |
|
|
|
5 |
|
|
This file is part of GCC.
|
6 |
|
|
|
7 |
|
|
GCC is free software; you can redistribute it and/or modify
|
8 |
|
|
it under the terms of the GNU General Public License as published by
|
9 |
|
|
the Free Software Foundation; either version 3, or (at your option)
|
10 |
|
|
any later version.
|
11 |
|
|
|
12 |
|
|
GCC is distributed in the hope that it will be useful,
|
13 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15 |
|
|
GNU General Public License for more details.
|
16 |
|
|
|
17 |
|
|
You should have received a copy of the GNU General Public License
|
18 |
|
|
along with GCC; see the file COPYING3. If not see
|
19 |
|
|
<http://www.gnu.org/licenses/>. */
|
20 |
|
|
|
21 |
|
|
/* After the first "Node:" comment comes all preprocessor directives and
|
22 |
|
|
attached declarations described in the info files, the "Using and
|
23 |
|
|
Porting GCC" manual (uapgcc), in the same order as found in the "Target
|
24 |
|
|
macros" section in the gcc-2.9x CVS edition of 2000-03-17. FIXME: Not
|
25 |
|
|
really, but needs an update anyway.
|
26 |
|
|
|
27 |
|
|
There is no generic copy-of-uapgcc comment, you'll have to see uapgcc
|
28 |
|
|
for that. If applicable, there is a CRIS-specific comment. The order
|
29 |
|
|
of macro definitions follow the order in the manual. Every section in
|
30 |
|
|
the manual (node in the info pages) has an introductory `Node:
|
31 |
|
|
<subchapter>' comment. If no macros are defined for a section, only
|
32 |
|
|
the section-comment is present. */
|
33 |
|
|
|
34 |
|
|
/* This file defines the macros for a.out that are not covered by cris.h.
|
35 |
|
|
Many macros are copied from elfos.h and should be in some generic
|
36 |
|
|
config/gas-aout.h. */
|
37 |
|
|
|
38 |
|
|
/* Node: Driver */
|
39 |
|
|
|
40 |
|
|
#undef STARTFILE_SPEC
|
41 |
|
|
#define STARTFILE_SPEC \
|
42 |
|
|
"%{melinux:crt0.o%s}\
|
43 |
|
|
%{!melinux:%{sim*:crt1.o%s}%{!sim*:crt0.o%s}}"
|
44 |
|
|
|
45 |
|
|
/* Override cris.h define. */
|
46 |
|
|
#undef ENDFILE_SPEC
|
47 |
|
|
|
48 |
|
|
#undef CRIS_CPP_SUBTARGET_SPEC
|
49 |
|
|
#define CRIS_CPP_SUBTARGET_SPEC \
|
50 |
|
|
"%{melinux:-D__gnu_linux__ -D__linux__ -D__unix__ -D__elinux__ -D__uclinux__\
|
51 |
|
|
%{!ansi:%{!std=*:%{!undef:-Dlinux -Dunix -Delinux -Duclinux}}}}\
|
52 |
|
|
%{mbest-lib-options:\
|
53 |
|
|
%{!moverride-best-lib-options:\
|
54 |
|
|
%{!march=*:%{!metrax*:%{!mcpu=*:-D__tune_v8 -D__CRIS_arch_tune=8}}}}}"
|
55 |
|
|
|
56 |
|
|
#undef CRIS_CC1_SUBTARGET_SPEC
|
57 |
|
|
#define CRIS_CC1_SUBTARGET_SPEC \
|
58 |
|
|
"%{mbest-lib-options:\
|
59 |
|
|
%{!moverride-best-lib-options:\
|
60 |
|
|
%{!march=*:%{!mcpu=*:-mtune=v8}}}}"
|
61 |
|
|
|
62 |
|
|
#undef CRIS_ASM_SUBTARGET_SPEC
|
63 |
|
|
#define CRIS_ASM_SUBTARGET_SPEC "--em=crisaout"
|
64 |
|
|
|
65 |
|
|
#undef CRIS_LINK_SUBTARGET_SPEC
|
66 |
|
|
#define CRIS_LINK_SUBTARGET_SPEC \
|
67 |
|
|
"-mcrisaout\
|
68 |
|
|
%{sim2:%{!T*:-Tdata 0x4000000 -Tbss 0x8000000}}\
|
69 |
|
|
%{melinux:-Ur -d\
|
70 |
|
|
%{!shlib:%{!symbolic:-Bstatic}}\
|
71 |
|
|
%{shlib:-Bdynamic}\
|
72 |
|
|
%{symbolic:-Bdynamic}\
|
73 |
|
|
%{static:-Bstatic}}\
|
74 |
|
|
%{melinux-stacksize=*:-defsym __Stacksize=%*}"
|
75 |
|
|
|
76 |
|
|
/* Previously controlled by target_flags. */
|
77 |
|
|
#undef TARGET_ELF
|
78 |
|
|
#define TARGET_ELF 0
|
79 |
|
|
|
80 |
|
|
#undef CRIS_SUBTARGET_HANDLE_OPTION
|
81 |
|
|
#define CRIS_SUBTARGET_HANDLE_OPTION(CODE, ARG, VALUE) \
|
82 |
|
|
do \
|
83 |
|
|
{ \
|
84 |
|
|
switch (CODE) \
|
85 |
|
|
{ \
|
86 |
|
|
case OPT_melinux: \
|
87 |
|
|
target_flags \
|
88 |
|
|
|= (MASK_SVINTO \
|
89 |
|
|
+ MASK_STACK_ALIGN \
|
90 |
|
|
+ MASK_CONST_ALIGN \
|
91 |
|
|
+ MASK_DATA_ALIGN \
|
92 |
|
|
+ MASK_ETRAX4_ADD \
|
93 |
|
|
+ MASK_ALIGN_BY_32); \
|
94 |
|
|
break; \
|
95 |
|
|
\
|
96 |
|
|
default: \
|
97 |
|
|
break; \
|
98 |
|
|
} \
|
99 |
|
|
} \
|
100 |
|
|
while (0)
|
101 |
|
|
|
102 |
|
|
#undef CRIS_SUBTARGET_VERSION
|
103 |
|
|
#define CRIS_SUBTARGET_VERSION " - a.out"
|
104 |
|
|
|
105 |
|
|
#undef CRIS_SUBTARGET_DEFAULT
|
106 |
|
|
#define CRIS_SUBTARGET_DEFAULT 0
|
107 |
|
|
|
108 |
|
|
|
109 |
|
|
/* Node: Run-time Target */
|
110 |
|
|
|
111 |
|
|
/* For the cris-*-aout subtarget. */
|
112 |
|
|
#undef TARGET_OS_CPP_BUILTINS
|
113 |
|
|
#define TARGET_OS_CPP_BUILTINS() \
|
114 |
|
|
do \
|
115 |
|
|
{ \
|
116 |
|
|
builtin_define ("__AOUT__"); \
|
117 |
|
|
} \
|
118 |
|
|
while (0)
|
119 |
|
|
|
120 |
|
|
|
121 |
|
|
/* Node: Storage Layout */
|
122 |
|
|
|
123 |
|
|
/* All sections but the .bss is rounded up to a 4-byte multiple size. */
|
124 |
|
|
#define MAX_OFILE_ALIGNMENT 32
|
125 |
|
|
|
126 |
|
|
|
127 |
|
|
/* Node: Data Output */
|
128 |
|
|
|
129 |
|
|
#define ESCAPES \
|
130 |
|
|
"\1\1\1\1\1\1\1\1btn\1fr\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\
|
131 |
|
|
\0\0\"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\
|
132 |
|
|
\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\\\0\0\0\
|
133 |
|
|
\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\
|
134 |
|
|
\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\
|
135 |
|
|
\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\
|
136 |
|
|
\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\
|
137 |
|
|
\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1"
|
138 |
|
|
|
139 |
|
|
/* Some svr4 assemblers have a limit on the number of characters which
|
140 |
|
|
can appear in the operand of a .string directive. If your assembler
|
141 |
|
|
has such a limitation, you should define STRING_LIMIT to reflect that
|
142 |
|
|
limit. Note that at least some svr4 assemblers have a limit on the
|
143 |
|
|
actual number of bytes in the double-quoted string, and that they
|
144 |
|
|
count each character in an escape sequence as one byte. Thus, an
|
145 |
|
|
escape sequence like \377 would count as four bytes.
|
146 |
|
|
|
147 |
|
|
If your target assembler doesn't support the .string directive, you
|
148 |
|
|
should define this to zero. */
|
149 |
|
|
|
150 |
|
|
#define STRING_LIMIT ((unsigned) 256)
|
151 |
|
|
|
152 |
|
|
#define STRING_ASM_OP "\t.string\t"
|
153 |
|
|
#define ASCII_DATA_ASM_OP "\t.ascii\t"
|
154 |
|
|
#define TYPE_ASM_OP "\t.type\t"
|
155 |
|
|
#define SIZE_ASM_OP "\t.size\t"
|
156 |
|
|
#define TYPE_OPERAND_FMT "@%s"
|
157 |
|
|
|
158 |
|
|
/* The routine used to output NUL terminated strings. We use a special
|
159 |
|
|
version of this for most svr4 targets because doing so makes the
|
160 |
|
|
generated assembly code more compact (and thus faster to assemble)
|
161 |
|
|
as well as more readable, especially for targets like the i386
|
162 |
|
|
(where the only alternative is to output character sequences as
|
163 |
|
|
comma separated lists of numbers). */
|
164 |
|
|
|
165 |
|
|
#define ASM_OUTPUT_LIMITED_STRING(FILE, STR) \
|
166 |
|
|
do \
|
167 |
|
|
{ \
|
168 |
|
|
register const unsigned char *_limited_str = \
|
169 |
|
|
(const unsigned char *) (STR); \
|
170 |
|
|
register unsigned ch; \
|
171 |
|
|
\
|
172 |
|
|
fprintf ((FILE), "%s\"", STRING_ASM_OP); \
|
173 |
|
|
\
|
174 |
|
|
for (; (ch = *_limited_str); _limited_str++) \
|
175 |
|
|
{ \
|
176 |
|
|
register int escape; \
|
177 |
|
|
\
|
178 |
|
|
switch (escape = ESCAPES[ch]) \
|
179 |
|
|
{ \
|
180 |
|
|
case 0: \
|
181 |
|
|
putc (ch, (FILE)); \
|
182 |
|
|
break; \
|
183 |
|
|
case 1: \
|
184 |
|
|
fprintf ((FILE), "\\%03o", ch); \
|
185 |
|
|
break; \
|
186 |
|
|
default: \
|
187 |
|
|
putc ('\\', (FILE)); \
|
188 |
|
|
putc (escape, (FILE)); \
|
189 |
|
|
break; \
|
190 |
|
|
} \
|
191 |
|
|
} \
|
192 |
|
|
\
|
193 |
|
|
fprintf ((FILE), "\"\n"); \
|
194 |
|
|
} \
|
195 |
|
|
while (0)
|
196 |
|
|
|
197 |
|
|
/* The routine used to output sequences of byte values. We use a special
|
198 |
|
|
version of this for most svr4 targets because doing so makes the
|
199 |
|
|
generated assembly code more compact (and thus faster to assemble)
|
200 |
|
|
as well as more readable. Note that if we find subparts of the
|
201 |
|
|
character sequence which end with NUL (and which are shorter than
|
202 |
|
|
STRING_LIMIT) we output those using ASM_OUTPUT_LIMITED_STRING. */
|
203 |
|
|
|
204 |
|
|
#undef ASM_OUTPUT_ASCII
|
205 |
|
|
#define ASM_OUTPUT_ASCII(FILE, STR, LENGTH) \
|
206 |
|
|
do \
|
207 |
|
|
{ \
|
208 |
|
|
register const unsigned char *_ascii_bytes = \
|
209 |
|
|
(const unsigned char *) (STR); \
|
210 |
|
|
register const unsigned char *limit = _ascii_bytes + (LENGTH); \
|
211 |
|
|
register unsigned bytes_in_chunk = 0; \
|
212 |
|
|
\
|
213 |
|
|
for (; _ascii_bytes < limit; _ascii_bytes++) \
|
214 |
|
|
{ \
|
215 |
|
|
register const unsigned char *p; \
|
216 |
|
|
\
|
217 |
|
|
if (bytes_in_chunk >= 60) \
|
218 |
|
|
{ \
|
219 |
|
|
fprintf ((FILE), "\"\n"); \
|
220 |
|
|
bytes_in_chunk = 0; \
|
221 |
|
|
} \
|
222 |
|
|
\
|
223 |
|
|
for (p = _ascii_bytes; p < limit && *p != '\0'; p++) \
|
224 |
|
|
continue; \
|
225 |
|
|
\
|
226 |
|
|
if (p < limit && (p - _ascii_bytes) <= (long)STRING_LIMIT) \
|
227 |
|
|
{ \
|
228 |
|
|
if (bytes_in_chunk > 0) \
|
229 |
|
|
{ \
|
230 |
|
|
fprintf ((FILE), "\"\n"); \
|
231 |
|
|
bytes_in_chunk = 0; \
|
232 |
|
|
} \
|
233 |
|
|
\
|
234 |
|
|
ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes); \
|
235 |
|
|
_ascii_bytes = p; \
|
236 |
|
|
} \
|
237 |
|
|
else \
|
238 |
|
|
{ \
|
239 |
|
|
register int escape; \
|
240 |
|
|
register unsigned ch; \
|
241 |
|
|
\
|
242 |
|
|
if (bytes_in_chunk == 0) \
|
243 |
|
|
fprintf ((FILE), "%s\"", ASCII_DATA_ASM_OP); \
|
244 |
|
|
\
|
245 |
|
|
switch (escape = ESCAPES[ch = *_ascii_bytes]) \
|
246 |
|
|
{ \
|
247 |
|
|
case 0: \
|
248 |
|
|
putc (ch, (FILE)); \
|
249 |
|
|
bytes_in_chunk++; \
|
250 |
|
|
break; \
|
251 |
|
|
case 1: \
|
252 |
|
|
fprintf ((FILE), "\\%03o", ch); \
|
253 |
|
|
bytes_in_chunk += 4; \
|
254 |
|
|
break; \
|
255 |
|
|
default: \
|
256 |
|
|
putc ('\\', (FILE)); \
|
257 |
|
|
putc (escape, (FILE)); \
|
258 |
|
|
bytes_in_chunk += 2; \
|
259 |
|
|
break; \
|
260 |
|
|
} \
|
261 |
|
|
} \
|
262 |
|
|
} \
|
263 |
|
|
\
|
264 |
|
|
if (bytes_in_chunk > 0) \
|
265 |
|
|
fprintf ((FILE), "\"\n"); \
|
266 |
|
|
} \
|
267 |
|
|
while (0)
|
268 |
|
|
|
269 |
|
|
|
270 |
|
|
/* Node: Label Output */
|
271 |
|
|
|
272 |
|
|
#define SET_ASM_OP "\t.set\t"
|
273 |
|
|
|
274 |
|
|
#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
|
275 |
|
|
(*targetm.asm_out.globalize_label) (FILE, XSTR (FUN, 0))
|
276 |
|
|
|
277 |
|
|
#define ASM_WEAKEN_LABEL(FILE, NAME) \
|
278 |
|
|
do \
|
279 |
|
|
{ \
|
280 |
|
|
fputs ("\t.weak\t", (FILE)); \
|
281 |
|
|
assemble_name ((FILE), (NAME)); \
|
282 |
|
|
fputc ('\n', (FILE)); \
|
283 |
|
|
} \
|
284 |
|
|
while (0)
|
285 |
|
|
|
286 |
|
|
#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
|
287 |
|
|
do \
|
288 |
|
|
{ \
|
289 |
|
|
ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function"); \
|
290 |
|
|
ASM_OUTPUT_LABEL(FILE, NAME); \
|
291 |
|
|
} \
|
292 |
|
|
while (0)
|
293 |
|
|
|
294 |
|
|
#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
|
295 |
|
|
do \
|
296 |
|
|
{ \
|
297 |
|
|
HOST_WIDE_INT size; \
|
298 |
|
|
\
|
299 |
|
|
ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \
|
300 |
|
|
\
|
301 |
|
|
size_directive_output = 0; \
|
302 |
|
|
if (!flag_inhibit_size_directive \
|
303 |
|
|
&& (DECL) && DECL_SIZE (DECL)) \
|
304 |
|
|
{ \
|
305 |
|
|
size_directive_output = 1; \
|
306 |
|
|
size = int_size_in_bytes (TREE_TYPE (DECL)); \
|
307 |
|
|
ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, size); \
|
308 |
|
|
} \
|
309 |
|
|
\
|
310 |
|
|
ASM_OUTPUT_LABEL (FILE, NAME); \
|
311 |
|
|
} \
|
312 |
|
|
while (0)
|
313 |
|
|
|
314 |
|
|
#undef ASM_FINISH_DECLARE_OBJECT
|
315 |
|
|
#define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END)\
|
316 |
|
|
do \
|
317 |
|
|
{ \
|
318 |
|
|
const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
|
319 |
|
|
HOST_WIDE_INT size; \
|
320 |
|
|
\
|
321 |
|
|
if (!flag_inhibit_size_directive \
|
322 |
|
|
&& DECL_SIZE (DECL) \
|
323 |
|
|
&& ! AT_END && TOP_LEVEL \
|
324 |
|
|
&& DECL_INITIAL (DECL) == error_mark_node \
|
325 |
|
|
&& !size_directive_output) \
|
326 |
|
|
{ \
|
327 |
|
|
size_directive_output = 1; \
|
328 |
|
|
size = int_size_in_bytes (TREE_TYPE (DECL)); \
|
329 |
|
|
ASM_OUTPUT_SIZE_DIRECTIVE (FILE, name, size); \
|
330 |
|
|
} \
|
331 |
|
|
} \
|
332 |
|
|
while (0)
|
333 |
|
|
|
334 |
|
|
#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
|
335 |
|
|
do \
|
336 |
|
|
{ \
|
337 |
|
|
if (!flag_inhibit_size_directive) \
|
338 |
|
|
ASM_OUTPUT_MEASURED_SIZE (FILE, FNAME); \
|
339 |
|
|
} \
|
340 |
|
|
while (0)
|
341 |
|
|
|
342 |
|
|
/* The configure machinery invokes the assembler without options, which is
|
343 |
|
|
not how gcc invokes it. Without options, the multi-target assembler
|
344 |
|
|
will probably be found, which is ELF by default. To counter that, we
|
345 |
|
|
need to override ELF auto-host.h config stuff which we know collides
|
346 |
|
|
with a.out. */
|
347 |
|
|
#undef HAVE_GAS_HIDDEN
|
348 |
|
|
|
349 |
|
|
|
350 |
|
|
/* Node: Alignment Output */
|
351 |
|
|
|
352 |
|
|
#define SKIP_ASM_OP "\t.zero\t"
|
353 |
|
|
|
354 |
|
|
#undef ASM_OUTPUT_SKIP
|
355 |
|
|
#define ASM_OUTPUT_SKIP(FILE, SIZE) \
|
356 |
|
|
fprintf (FILE, "%s%u\n", SKIP_ASM_OP, (int)(SIZE))
|
357 |
|
|
|
358 |
|
|
/* Node: All Debuggers */
|
359 |
|
|
|
360 |
|
|
#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
|
361 |
|
|
|
362 |
|
|
|
363 |
|
|
/* Node: Misc */
|
364 |
|
|
|
365 |
|
|
#define HANDLE_SYSV_PRAGMA 1
|
366 |
|
|
|
367 |
|
|
/* In theory, this one isn't necessary, but over time, external tools have
|
368 |
|
|
been primed on names with "." rather than "$". */
|
369 |
|
|
#define NO_DOLLAR_IN_LABEL
|
370 |
|
|
|
371 |
|
|
/* These are undocumented, but to keep a single
|
372 |
|
|
CRIS_ASM_OUTPUT_ALIGNED_DECL_COMMON, we set this to an asm that will
|
373 |
|
|
emit an error if ever output. It will not be emitted for a.out modulo
|
374 |
|
|
careless hacking. */
|
375 |
|
|
#define COMMON_ASM_OP "\t.err\t"
|
376 |
|
|
#define LOCAL_ASM_OP "\t.err\t"
|
377 |
|
|
|
378 |
|
|
#if defined(__CRIS__) && defined (__AOUT__) && defined (IN_GCC)
|
379 |
|
|
|
380 |
|
|
#define CRIS_ABI_VERSION_SYMBOL_STRING ".$CRIS_ABI_V2"
|
381 |
|
|
|
382 |
|
|
/* Make all a.out library functions have undefined references to the
|
383 |
|
|
.$CRIS_ABI_V2 symbol, so it will be picked up. Used by GDB. GDB has
|
384 |
|
|
a bug with reading a.out symbols; it does not see the GNU weak
|
385 |
|
|
extensions, so we can't have .$CRIS_ABI_V2 weak. Weak. */
|
386 |
|
|
__asm__ (".set .$abi_referer," CRIS_ABI_VERSION_SYMBOL_STRING);
|
387 |
|
|
#endif
|
388 |
|
|
|
389 |
|
|
/*
|
390 |
|
|
* Local variables:
|
391 |
|
|
* eval: (c-set-style "gnu")
|
392 |
|
|
* indent-tabs-mode: t
|
393 |
|
|
* End:
|
394 |
|
|
*/
|