1 /* Definitions for GCC. Part of the machine description for CRIS.
2 Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
3 Contributed by Axis Communications. Written by Hans-Peter Nilsson.
5 This file is part of GCC.
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 2, or (at your option)
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.
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING. If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
22 /* After the first "Node:" comment comes all preprocessor directives and
23 attached declarations described in the info files, the "Using and
24 Porting GCC" manual (uapgcc), in the same order as found in the "Target
25 macros" section in the gcc-2.9x CVS edition of 2000-03-17. FIXME: Not
26 really, but needs an update anyway.
28 There is no generic copy-of-uapgcc comment, you'll have to see uapgcc
29 for that. If applicable, there is a CRIS-specific comment. The order
30 of macro definitions follow the order in the manual. Every section in
31 the manual (node in the info pages) has an introductory `Node:
32 <subchapter>' comment. If no macros are defined for a section, only
33 the section-comment is present. */
35 /* This file defines the macros for a.out that are not covered by cris.h.
36 Many macros are copied from elfos.h and should be in some generic
42 #define STARTFILE_SPEC \
48 %{!sim:%{pg:gcrt0.o%s}\
49 %{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}}}}"
51 /* Which library to get. The only difference from the default is to get
52 libsc.a if -sim is given to the driver. Repeat -lc -lsysX
53 {X=sim,linux}, because libsysX needs (at least) errno from libc, and
54 then we want to resolve new unknowns in libc against libsysX, not
55 libnosys. Assume everything is in libc for -mlinux. */
58 "%{melinux:-lc -lsyslinux -lc -lsyslinux -lic}\
60 %{sim*:-lc -lsyssim -lc -lsyssim}\
62 %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} -lbsp}\
65 #undef CRIS_CPP_SUBTARGET_SPEC
66 #define CRIS_CPP_SUBTARGET_SPEC \
68 %{melinux:-D__gnu_linux__ -D__linux__ -D__unix__ -D__elinux__ -D__uclinux__\
70 %{!mbest-lib-options:%{isystem*}}\
71 -isystem elinux/include%s\
72 %{mbest-lib-options:%{isystem*}}}\
73 %{!ansi:%{!std=*:%{!undef:-Dlinux -Dunix -Delinux -Duclinux}}}}\
75 %{!moverride-best-lib-options:\
76 %{!march=*:%{!metrax*:%{!mcpu=*:-D__tune_v8 -D__CRIS_arch_tune=8}}}}}"
78 #undef CRIS_CC1_SUBTARGET_SPEC
79 #define CRIS_CC1_SUBTARGET_SPEC \
80 "%{mbest-lib-options:\
81 %{!moverride-best-lib-options:\
82 %{!march=*:%{!mcpu=*:-mtune=v8}}}}"
84 #undef CRIS_ASM_SUBTARGET_SPEC
85 #define CRIS_ASM_SUBTARGET_SPEC "--em=crisaout"
87 #undef CRIS_LINK_SUBTARGET_SPEC
88 #define CRIS_LINK_SUBTARGET_SPEC \
90 %{sim2:%{!T*:-Tdata 0x4000000 -Tbss 0x8000000}}\
92 %{!shlib:%{!symbolic:-Bstatic}}\
94 %{symbolic:-Bdynamic}\
96 %{melinux-stacksize=*:-defsym __Stacksize=%*}"
98 #undef CRIS_SUBTARGET_SWITCHES
99 #define CRIS_SUBTARGET_SWITCHES \
100 {"elinux", (TARGET_MASK_SVINTO \
101 + TARGET_MASK_STACK_ALIGN \
102 + TARGET_MASK_CONST_ALIGN \
103 + TARGET_MASK_DATA_ALIGN \
104 + TARGET_MASK_ETRAX4_ADD \
105 + TARGET_MASK_ALIGN_BY_32), \
106 N_("Compile for the MMU-less Etrax 100-based elinux system")}, \
107 /* Legacy option. */ \
110 #undef CRIS_SUBTARGET_LONG_OPTIONS
111 #define CRIS_SUBTARGET_LONG_OPTIONS \
112 {"elinux-stacksize=", &cris_elinux_stacksize_str, \
113 N_("For elinux, request a specified stack-size for this program")}, \
115 #undef CRIS_SUBTARGET_VERSION
116 #define CRIS_SUBTARGET_VERSION " - a.out"
118 #undef CRIS_SUBTARGET_DEFAULT
119 #define CRIS_SUBTARGET_DEFAULT 0
121 /* Node: Storage Layout */
123 /* We can align to 16 bits (only) with CRIS a.out. */
124 #define MAX_OFILE_ALIGNMENT 16
127 /* Node: Library Calls */
129 #define TARGET_MEM_FUNCTIONS
132 /* Node: Data Output */
135 "\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\
136 \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\
137 \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\
138 \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\
139 \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\
140 \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\
141 \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\
142 \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"
144 /* Some svr4 assemblers have a limit on the number of characters which
145 can appear in the operand of a .string directive. If your assembler
146 has such a limitation, you should define STRING_LIMIT to reflect that
147 limit. Note that at least some svr4 assemblers have a limit on the
148 actual number of bytes in the double-quoted string, and that they
149 count each character in an escape sequence as one byte. Thus, an
150 escape sequence like \377 would count as four bytes.
152 If your target assembler doesn't support the .string directive, you
153 should define this to zero. */
155 #define STRING_LIMIT ((unsigned) 256)
157 #define STRING_ASM_OP "\t.string\t"
158 #define ASCII_DATA_ASM_OP "\t.ascii\t"
159 #define TYPE_ASM_OP "\t.type\t"
160 #define SIZE_ASM_OP "\t.size\t"
161 #define TYPE_OPERAND_FMT "@%s"
163 /* The routine used to output NUL terminated strings. We use a special
164 version of this for most svr4 targets because doing so makes the
165 generated assembly code more compact (and thus faster to assemble)
166 as well as more readable, especially for targets like the i386
167 (where the only alternative is to output character sequences as
168 comma separated lists of numbers). */
170 #define ASM_OUTPUT_LIMITED_STRING(FILE, STR) \
173 register const unsigned char *_limited_str = \
174 (const unsigned char *) (STR); \
175 register unsigned ch; \
177 fprintf ((FILE), "%s\"", STRING_ASM_OP); \
179 for (; (ch = *_limited_str); _limited_str++) \
181 register int escape; \
183 switch (escape = ESCAPES[ch]) \
189 fprintf ((FILE), "\\%03o", ch); \
192 putc ('\\', (FILE)); \
193 putc (escape, (FILE)); \
198 fprintf ((FILE), "\"\n"); \
202 /* The routine used to output sequences of byte values. We use a special
203 version of this for most svr4 targets because doing so makes the
204 generated assembly code more compact (and thus faster to assemble)
205 as well as more readable. Note that if we find subparts of the
206 character sequence which end with NUL (and which are shorter than
207 STRING_LIMIT) we output those using ASM_OUTPUT_LIMITED_STRING. */
209 #undef ASM_OUTPUT_ASCII
210 #define ASM_OUTPUT_ASCII(FILE, STR, LENGTH) \
213 register const unsigned char *_ascii_bytes = \
214 (const unsigned char *) (STR); \
215 register const unsigned char *limit = _ascii_bytes + (LENGTH); \
216 register unsigned bytes_in_chunk = 0; \
218 for (; _ascii_bytes < limit; _ascii_bytes++) \
220 register const unsigned char *p; \
222 if (bytes_in_chunk >= 60) \
224 fprintf ((FILE), "\"\n"); \
225 bytes_in_chunk = 0; \
228 for (p = _ascii_bytes; p < limit && *p != '\0'; p++) \
231 if (p < limit && (p - _ascii_bytes) <= (long)STRING_LIMIT) \
233 if (bytes_in_chunk > 0) \
235 fprintf ((FILE), "\"\n"); \
236 bytes_in_chunk = 0; \
239 ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes); \
244 register int escape; \
245 register unsigned ch; \
247 if (bytes_in_chunk == 0) \
248 fprintf ((FILE), "%s\"", ASCII_DATA_ASM_OP); \
250 switch (escape = ESCAPES[ch = *_ascii_bytes]) \
257 fprintf ((FILE), "\\%03o", ch); \
258 bytes_in_chunk += 4; \
261 putc ('\\', (FILE)); \
262 putc (escape, (FILE)); \
263 bytes_in_chunk += 2; \
269 if (bytes_in_chunk > 0) \
270 fprintf ((FILE), "\"\n"); \
275 /* Node: Label Output */
277 #define SET_ASM_OP "\t.set\t"
279 #define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
280 (*targetm.asm_out.globalize_label) (FILE, XSTR (FUN, 0))
282 #define ASM_WEAKEN_LABEL(FILE, NAME) \
285 fputs ("\t.weak\t", (FILE)); \
286 assemble_name ((FILE), (NAME)); \
287 fputc ('\n', (FILE)); \
291 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
294 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function"); \
295 ASM_OUTPUT_LABEL(FILE, NAME); \
299 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
302 HOST_WIDE_INT size; \
304 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \
306 size_directive_output = 0; \
307 if (!flag_inhibit_size_directive \
308 && (DECL) && DECL_SIZE (DECL)) \
310 size_directive_output = 1; \
311 size = int_size_in_bytes (TREE_TYPE (DECL)); \
312 ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, size); \
315 ASM_OUTPUT_LABEL (FILE, NAME); \
319 #undef ASM_FINISH_DECLARE_OBJECT
320 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END)\
323 const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
324 HOST_WIDE_INT size; \
326 if (!flag_inhibit_size_directive \
327 && DECL_SIZE (DECL) \
328 && ! AT_END && TOP_LEVEL \
329 && DECL_INITIAL (DECL) == error_mark_node \
330 && !size_directive_output) \
332 size_directive_output = 1; \
333 size = int_size_in_bytes (TREE_TYPE (DECL)); \
334 ASM_OUTPUT_SIZE_DIRECTIVE (FILE, name, size); \
339 #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
342 if (!flag_inhibit_size_directive) \
343 ASM_OUTPUT_MEASURED_SIZE (FILE, FNAME); \
347 /* The configure machinery invokes the assembler without options, which is
348 not how gcc invokes it. Without options, the multi-target assembler
349 will probably be found, which is ELF by default. To counter that, we
350 need to override ELF auto-host.h config stuff which we know collides
352 #undef HAVE_GAS_HIDDEN
355 /* Node: Alignment Output */
357 #define SKIP_ASM_OP "\t.zero\t"
359 #undef ASM_OUTPUT_SKIP
360 #define ASM_OUTPUT_SKIP(FILE, SIZE) \
361 fprintf (FILE, "%s%u\n", SKIP_ASM_OP, (SIZE))
363 /* Node: All Debuggers */
365 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
370 #define HANDLE_SYSV_PRAGMA 1
372 /* In theory, this one isn't necessary, but over time, external tools have
373 been primed on names with "." rather than "$". */
374 #define NO_DOLLAR_IN_LABEL
376 /* These are undocumented, but to keep a single
377 CRIS_ASM_OUTPUT_ALIGNED_DECL_COMMON, we set this to an asm that will
378 emit an error if ever output. It will not be emitted for a.out modulo
380 #define COMMON_ASM_OP "\t.err\t"
381 #define LOCAL_ASM_OP "\t.err\t"
383 #if defined(__CRIS__) && defined (__AOUT__) && defined (IN_GCC)
385 #define CRIS_ABI_VERSION_SYMBOL_STRING ".$CRIS_ABI_V2"
387 /* Make all a.out library functions have undefined references to the
388 .$CRIS_ABI_V2 symbol, so it will be picked up. Used by GDB. GDB has
389 a bug with reading a.out symbols; it does not see the GNU weak
390 extensions, so we can't have .$CRIS_ABI_V2 weak. Weak. */
391 __asm__ (".set .$abi_referer," CRIS_ABI_VERSION_SYMBOL_STRING
);
396 * eval: (c-set-style "gnu")
397 * indent-tabs-mode: t