Merge -r 127928:132243 from trunk
[official-gcc.git] / gcc / config / cris / aout.h
blob32533d6475e3b5ebe99f722b008bf31274712115
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_DEFAULT
103 #define CRIS_SUBTARGET_DEFAULT 0
106 /* Node: Run-time Target */
108 /* For the cris-*-aout subtarget. */
109 #undef TARGET_OS_CPP_BUILTINS
110 #define TARGET_OS_CPP_BUILTINS() \
111 do \
113 builtin_define ("__AOUT__"); \
115 while (0)
118 /* Node: Storage Layout */
120 /* All sections but the .bss is rounded up to a 4-byte multiple size. */
121 #define MAX_OFILE_ALIGNMENT 32
124 /* Node: Data Output */
126 #define ESCAPES \
127 "\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\
128 \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\
129 \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\
130 \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\
131 \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\
132 \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\
133 \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\
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"
136 /* Some svr4 assemblers have a limit on the number of characters which
137 can appear in the operand of a .string directive. If your assembler
138 has such a limitation, you should define STRING_LIMIT to reflect that
139 limit. Note that at least some svr4 assemblers have a limit on the
140 actual number of bytes in the double-quoted string, and that they
141 count each character in an escape sequence as one byte. Thus, an
142 escape sequence like \377 would count as four bytes.
144 If your target assembler doesn't support the .string directive, you
145 should define this to zero. */
147 #define STRING_LIMIT ((unsigned) 256)
149 #define STRING_ASM_OP "\t.string\t"
150 #define ASCII_DATA_ASM_OP "\t.ascii\t"
151 #define TYPE_ASM_OP "\t.type\t"
152 #define SIZE_ASM_OP "\t.size\t"
153 #define TYPE_OPERAND_FMT "@%s"
155 /* The routine used to output NUL terminated strings. We use a special
156 version of this for most svr4 targets because doing so makes the
157 generated assembly code more compact (and thus faster to assemble)
158 as well as more readable, especially for targets like the i386
159 (where the only alternative is to output character sequences as
160 comma separated lists of numbers). */
162 #define ASM_OUTPUT_LIMITED_STRING(FILE, STR) \
163 do \
165 register const unsigned char *_limited_str = \
166 (const unsigned char *) (STR); \
167 register unsigned ch; \
169 fprintf ((FILE), "%s\"", STRING_ASM_OP); \
171 for (; (ch = *_limited_str); _limited_str++) \
173 register int escape; \
175 switch (escape = ESCAPES[ch]) \
177 case 0: \
178 putc (ch, (FILE)); \
179 break; \
180 case 1: \
181 fprintf ((FILE), "\\%03o", ch); \
182 break; \
183 default: \
184 putc ('\\', (FILE)); \
185 putc (escape, (FILE)); \
186 break; \
190 fprintf ((FILE), "\"\n"); \
192 while (0)
194 /* The routine used to output sequences of byte values. We use a special
195 version of this for most svr4 targets because doing so makes the
196 generated assembly code more compact (and thus faster to assemble)
197 as well as more readable. Note that if we find subparts of the
198 character sequence which end with NUL (and which are shorter than
199 STRING_LIMIT) we output those using ASM_OUTPUT_LIMITED_STRING. */
201 #undef ASM_OUTPUT_ASCII
202 #define ASM_OUTPUT_ASCII(FILE, STR, LENGTH) \
203 do \
205 register const unsigned char *_ascii_bytes = \
206 (const unsigned char *) (STR); \
207 register const unsigned char *limit = _ascii_bytes + (LENGTH); \
208 register unsigned bytes_in_chunk = 0; \
210 for (; _ascii_bytes < limit; _ascii_bytes++) \
212 register const unsigned char *p; \
214 if (bytes_in_chunk >= 60) \
216 fprintf ((FILE), "\"\n"); \
217 bytes_in_chunk = 0; \
220 for (p = _ascii_bytes; p < limit && *p != '\0'; p++) \
221 continue; \
223 if (p < limit && (p - _ascii_bytes) <= (long)STRING_LIMIT) \
225 if (bytes_in_chunk > 0) \
227 fprintf ((FILE), "\"\n"); \
228 bytes_in_chunk = 0; \
231 ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes); \
232 _ascii_bytes = p; \
234 else \
236 register int escape; \
237 register unsigned ch; \
239 if (bytes_in_chunk == 0) \
240 fprintf ((FILE), "%s\"", ASCII_DATA_ASM_OP); \
242 switch (escape = ESCAPES[ch = *_ascii_bytes]) \
244 case 0: \
245 putc (ch, (FILE)); \
246 bytes_in_chunk++; \
247 break; \
248 case 1: \
249 fprintf ((FILE), "\\%03o", ch); \
250 bytes_in_chunk += 4; \
251 break; \
252 default: \
253 putc ('\\', (FILE)); \
254 putc (escape, (FILE)); \
255 bytes_in_chunk += 2; \
256 break; \
261 if (bytes_in_chunk > 0) \
262 fprintf ((FILE), "\"\n"); \
264 while (0)
267 /* Node: Label Output */
269 #define SET_ASM_OP "\t.set\t"
271 #define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
272 (*targetm.asm_out.globalize_label) (FILE, XSTR (FUN, 0))
274 #define ASM_WEAKEN_LABEL(FILE, NAME) \
275 do \
277 fputs ("\t.weak\t", (FILE)); \
278 assemble_name ((FILE), (NAME)); \
279 fputc ('\n', (FILE)); \
281 while (0)
283 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
284 do \
286 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function"); \
287 ASM_OUTPUT_LABEL(FILE, NAME); \
289 while (0)
291 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
292 do \
294 HOST_WIDE_INT size; \
296 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \
298 size_directive_output = 0; \
299 if (!flag_inhibit_size_directive \
300 && (DECL) && DECL_SIZE (DECL)) \
302 size_directive_output = 1; \
303 size = int_size_in_bytes (TREE_TYPE (DECL)); \
304 ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, size); \
307 ASM_OUTPUT_LABEL (FILE, NAME); \
309 while (0)
311 #undef ASM_FINISH_DECLARE_OBJECT
312 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END)\
313 do \
315 const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
316 HOST_WIDE_INT size; \
318 if (!flag_inhibit_size_directive \
319 && DECL_SIZE (DECL) \
320 && ! AT_END && TOP_LEVEL \
321 && DECL_INITIAL (DECL) == error_mark_node \
322 && !size_directive_output) \
324 size_directive_output = 1; \
325 size = int_size_in_bytes (TREE_TYPE (DECL)); \
326 ASM_OUTPUT_SIZE_DIRECTIVE (FILE, name, size); \
329 while (0)
331 #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
332 do \
334 if (!flag_inhibit_size_directive) \
335 ASM_OUTPUT_MEASURED_SIZE (FILE, FNAME); \
337 while (0)
339 /* The configure machinery invokes the assembler without options, which is
340 not how gcc invokes it. Without options, the multi-target assembler
341 will probably be found, which is ELF by default. To counter that, we
342 need to override ELF auto-host.h config stuff which we know collides
343 with a.out. */
344 #undef HAVE_GAS_HIDDEN
347 /* Node: Alignment Output */
349 #define SKIP_ASM_OP "\t.zero\t"
351 #undef ASM_OUTPUT_SKIP
352 #define ASM_OUTPUT_SKIP(FILE, SIZE) \
353 fprintf (FILE, "%s%u\n", SKIP_ASM_OP, (int)(SIZE))
355 /* Node: All Debuggers */
357 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
360 /* Node: Misc */
362 #define HANDLE_SYSV_PRAGMA 1
364 /* In theory, this one isn't necessary, but over time, external tools have
365 been primed on names with "." rather than "$". */
366 #define NO_DOLLAR_IN_LABEL
368 /* These are undocumented, but to keep a single
369 CRIS_ASM_OUTPUT_ALIGNED_DECL_COMMON, we set this to an asm that will
370 emit an error if ever output. It will not be emitted for a.out modulo
371 careless hacking. */
372 #define COMMON_ASM_OP "\t.err\t"
373 #define LOCAL_ASM_OP "\t.err\t"
375 #if defined(__CRIS__) && defined (__AOUT__) && defined (IN_GCC)
377 #define CRIS_ABI_VERSION_SYMBOL_STRING ".$CRIS_ABI_V2"
379 /* Make all a.out library functions have undefined references to the
380 .$CRIS_ABI_V2 symbol, so it will be picked up. Used by GDB. GDB has
381 a bug with reading a.out symbols; it does not see the GNU weak
382 extensions, so we can't have .$CRIS_ABI_V2 weak. Weak. */
383 __asm__ (".set .$abi_referer," CRIS_ABI_VERSION_SYMBOL_STRING);
384 #endif
387 * Local variables:
388 * eval: (c-set-style "gnu")
389 * indent-tabs-mode: t
390 * End: