Merged with mainline at revision 128810.
[official-gcc.git] / gcc / config / cris / aout.h
blob5d39a6039dd36a0e18f457848808e53c2eea6ab2
1 /* 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.
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 3, or (at your option)
10 any later version.
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 COPYING3. If not see
19 <http://www.gnu.org/licenses/>. */
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.
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. */
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. */
38 /* Node: Driver */
40 #undef STARTFILE_SPEC
41 #define STARTFILE_SPEC \
42 "%{melinux:crt0.o%s}\
43 %{!melinux:%{sim*:crt1.o%s}%{!sim*:crt0.o%s}}"
45 /* Override cris.h define. */
46 #undef ENDFILE_SPEC
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}}}}}"
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}}}}"
62 #undef CRIS_ASM_SUBTARGET_SPEC
63 #define CRIS_ASM_SUBTARGET_SPEC "--em=crisaout"
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=%*}"
76 /* Previously controlled by target_flags. */
77 #undef TARGET_ELF
78 #define TARGET_ELF 0
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; \
96 default: \
97 break; \
98 } \
99 } \
100 while (0)
102 #undef CRIS_SUBTARGET_VERSION
103 #define CRIS_SUBTARGET_VERSION " - a.out"
105 #undef CRIS_SUBTARGET_DEFAULT
106 #define CRIS_SUBTARGET_DEFAULT 0
109 /* Node: Run-time Target */
111 /* For the cris-*-aout subtarget. */
112 #undef TARGET_OS_CPP_BUILTINS
113 #define TARGET_OS_CPP_BUILTINS() \
114 do \
116 builtin_define ("__AOUT__"); \
118 while (0)
121 /* Node: Storage Layout */
123 /* All sections but the .bss is rounded up to a 4-byte multiple size. */
124 #define MAX_OFILE_ALIGNMENT 32
127 /* Node: Data Output */
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"
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.
147 If your target assembler doesn't support the .string directive, you
148 should define this to zero. */
150 #define STRING_LIMIT ((unsigned) 256)
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"
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). */
165 #define ASM_OUTPUT_LIMITED_STRING(FILE, STR) \
166 do \
168 register const unsigned char *_limited_str = \
169 (const unsigned char *) (STR); \
170 register unsigned ch; \
172 fprintf ((FILE), "%s\"", STRING_ASM_OP); \
174 for (; (ch = *_limited_str); _limited_str++) \
176 register int escape; \
178 switch (escape = ESCAPES[ch]) \
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; \
193 fprintf ((FILE), "\"\n"); \
195 while (0)
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. */
204 #undef ASM_OUTPUT_ASCII
205 #define ASM_OUTPUT_ASCII(FILE, STR, LENGTH) \
206 do \
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; \
213 for (; _ascii_bytes < limit; _ascii_bytes++) \
215 register const unsigned char *p; \
217 if (bytes_in_chunk >= 60) \
219 fprintf ((FILE), "\"\n"); \
220 bytes_in_chunk = 0; \
223 for (p = _ascii_bytes; p < limit && *p != '\0'; p++) \
224 continue; \
226 if (p < limit && (p - _ascii_bytes) <= (long)STRING_LIMIT) \
228 if (bytes_in_chunk > 0) \
230 fprintf ((FILE), "\"\n"); \
231 bytes_in_chunk = 0; \
234 ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes); \
235 _ascii_bytes = p; \
237 else \
239 register int escape; \
240 register unsigned ch; \
242 if (bytes_in_chunk == 0) \
243 fprintf ((FILE), "%s\"", ASCII_DATA_ASM_OP); \
245 switch (escape = ESCAPES[ch = *_ascii_bytes]) \
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; \
264 if (bytes_in_chunk > 0) \
265 fprintf ((FILE), "\"\n"); \
267 while (0)
270 /* Node: Label Output */
272 #define SET_ASM_OP "\t.set\t"
274 #define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
275 (*targetm.asm_out.globalize_label) (FILE, XSTR (FUN, 0))
277 #define ASM_WEAKEN_LABEL(FILE, NAME) \
278 do \
280 fputs ("\t.weak\t", (FILE)); \
281 assemble_name ((FILE), (NAME)); \
282 fputc ('\n', (FILE)); \
284 while (0)
286 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
287 do \
289 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function"); \
290 ASM_OUTPUT_LABEL(FILE, NAME); \
292 while (0)
294 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
295 do \
297 HOST_WIDE_INT size; \
299 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \
301 size_directive_output = 0; \
302 if (!flag_inhibit_size_directive \
303 && (DECL) && DECL_SIZE (DECL)) \
305 size_directive_output = 1; \
306 size = int_size_in_bytes (TREE_TYPE (DECL)); \
307 ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, size); \
310 ASM_OUTPUT_LABEL (FILE, NAME); \
312 while (0)
314 #undef ASM_FINISH_DECLARE_OBJECT
315 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END)\
316 do \
318 const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
319 HOST_WIDE_INT size; \
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) \
327 size_directive_output = 1; \
328 size = int_size_in_bytes (TREE_TYPE (DECL)); \
329 ASM_OUTPUT_SIZE_DIRECTIVE (FILE, name, size); \
332 while (0)
334 #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
335 do \
337 if (!flag_inhibit_size_directive) \
338 ASM_OUTPUT_MEASURED_SIZE (FILE, FNAME); \
340 while (0)
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
350 /* Node: Alignment Output */
352 #define SKIP_ASM_OP "\t.zero\t"
354 #undef ASM_OUTPUT_SKIP
355 #define ASM_OUTPUT_SKIP(FILE, SIZE) \
356 fprintf (FILE, "%s%u\n", SKIP_ASM_OP, (int)(SIZE))
358 /* Node: All Debuggers */
360 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
363 /* Node: Misc */
365 #define HANDLE_SYSV_PRAGMA 1
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
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"
378 #if defined(__CRIS__) && defined (__AOUT__) && defined (IN_GCC)
380 #define CRIS_ABI_VERSION_SYMBOL_STRING ".$CRIS_ABI_V2"
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
390 * Local variables:
391 * eval: (c-set-style "gnu")
392 * indent-tabs-mode: t
393 * End: