Update FSF address.
[official-gcc.git] / gcc / config / cris / aout.h
blobdadbca8747462aafcbec980e08b99fee3aa34516
1 /* Definitions for GCC. Part of the machine description for CRIS.
2 Copyright (C) 2001, 2002, 2003, 2004, 2005 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)
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 COPYING. If not, write to
19 the Free Software Foundation, 51 Franklin Street, Fifth Floor,
20 Boston, MA 02110-1301, 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
37 config/gas-aout.h. */
39 /* Node: Driver */
41 #undef STARTFILE_SPEC
42 #define STARTFILE_SPEC \
43 "%{melinux:crt0.o%s}\
44 %{!melinux:%{sim*:crt1.o%s}%{!sim*:crt0.o%s}}"
46 /* Override cris.h define. */
47 #undef ENDFILE_SPEC
49 #undef CRIS_CPP_SUBTARGET_SPEC
50 #define CRIS_CPP_SUBTARGET_SPEC \
51 "%{melinux:-D__gnu_linux__ -D__linux__ -D__unix__ -D__elinux__ -D__uclinux__\
52 %{!ansi:%{!std=*:%{!undef:-Dlinux -Dunix -Delinux -Duclinux}}}}\
53 %{mbest-lib-options:\
54 %{!moverride-best-lib-options:\
55 %{!march=*:%{!metrax*:%{!mcpu=*:-D__tune_v8 -D__CRIS_arch_tune=8}}}}}"
57 #undef CRIS_CC1_SUBTARGET_SPEC
58 #define CRIS_CC1_SUBTARGET_SPEC \
59 "%{mbest-lib-options:\
60 %{!moverride-best-lib-options:\
61 %{!march=*:%{!mcpu=*:-mtune=v8}}}}"
63 #undef CRIS_ASM_SUBTARGET_SPEC
64 #define CRIS_ASM_SUBTARGET_SPEC "--em=crisaout"
66 #undef CRIS_LINK_SUBTARGET_SPEC
67 #define CRIS_LINK_SUBTARGET_SPEC \
68 "-mcrisaout\
69 %{sim2:%{!T*:-Tdata 0x4000000 -Tbss 0x8000000}}\
70 %{melinux:-Ur -d\
71 %{!shlib:%{!symbolic:-Bstatic}}\
72 %{shlib:-Bdynamic}\
73 %{symbolic:-Bdynamic}\
74 %{static:-Bstatic}}\
75 %{melinux-stacksize=*:-defsym __Stacksize=%*}"
77 /* Previously controlled by target_flags. */
78 #undef TARGET_ELF
79 #define TARGET_ELF 0
81 #undef CRIS_SUBTARGET_HANDLE_OPTION
82 #define CRIS_SUBTARGET_HANDLE_OPTION(CODE, ARG, VALUE) \
83 do \
84 { \
85 switch (CODE) \
86 { \
87 case OPT_melinux: \
88 target_flags \
89 |= (MASK_SVINTO \
90 + MASK_STACK_ALIGN \
91 + MASK_CONST_ALIGN \
92 + MASK_DATA_ALIGN \
93 + MASK_ETRAX4_ADD \
94 + MASK_ALIGN_BY_32); \
95 break; \
97 default: \
98 break; \
99 } \
101 while (0)
103 #undef CRIS_SUBTARGET_VERSION
104 #define CRIS_SUBTARGET_VERSION " - a.out"
106 #undef CRIS_SUBTARGET_DEFAULT
107 #define CRIS_SUBTARGET_DEFAULT 0
110 /* Node: Run-time Target */
112 /* For the cris-*-aout subtarget. */
113 #undef TARGET_OS_CPP_BUILTINS
114 #define TARGET_OS_CPP_BUILTINS() \
115 do \
117 builtin_define ("__AOUT__"); \
119 while (0)
122 /* Node: Storage Layout */
124 /* All sections but the .bss is rounded up to a 4-byte multiple size. */
125 #define MAX_OFILE_ALIGNMENT 32
128 /* Node: Data Output */
130 #define ESCAPES \
131 "\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\
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\
134 \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\
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 \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 /* Some svr4 assemblers have a limit on the number of characters which
141 can appear in the operand of a .string directive. If your assembler
142 has such a limitation, you should define STRING_LIMIT to reflect that
143 limit. Note that at least some svr4 assemblers have a limit on the
144 actual number of bytes in the double-quoted string, and that they
145 count each character in an escape sequence as one byte. Thus, an
146 escape sequence like \377 would count as four bytes.
148 If your target assembler doesn't support the .string directive, you
149 should define this to zero. */
151 #define STRING_LIMIT ((unsigned) 256)
153 #define STRING_ASM_OP "\t.string\t"
154 #define ASCII_DATA_ASM_OP "\t.ascii\t"
155 #define TYPE_ASM_OP "\t.type\t"
156 #define SIZE_ASM_OP "\t.size\t"
157 #define TYPE_OPERAND_FMT "@%s"
159 /* The routine used to output NUL terminated strings. We use a special
160 version of this for most svr4 targets because doing so makes the
161 generated assembly code more compact (and thus faster to assemble)
162 as well as more readable, especially for targets like the i386
163 (where the only alternative is to output character sequences as
164 comma separated lists of numbers). */
166 #define ASM_OUTPUT_LIMITED_STRING(FILE, STR) \
167 do \
169 register const unsigned char *_limited_str = \
170 (const unsigned char *) (STR); \
171 register unsigned ch; \
173 fprintf ((FILE), "%s\"", STRING_ASM_OP); \
175 for (; (ch = *_limited_str); _limited_str++) \
177 register int escape; \
179 switch (escape = ESCAPES[ch]) \
181 case 0: \
182 putc (ch, (FILE)); \
183 break; \
184 case 1: \
185 fprintf ((FILE), "\\%03o", ch); \
186 break; \
187 default: \
188 putc ('\\', (FILE)); \
189 putc (escape, (FILE)); \
190 break; \
194 fprintf ((FILE), "\"\n"); \
196 while (0)
198 /* The routine used to output sequences of byte values. We use a special
199 version of this for most svr4 targets because doing so makes the
200 generated assembly code more compact (and thus faster to assemble)
201 as well as more readable. Note that if we find subparts of the
202 character sequence which end with NUL (and which are shorter than
203 STRING_LIMIT) we output those using ASM_OUTPUT_LIMITED_STRING. */
205 #undef ASM_OUTPUT_ASCII
206 #define ASM_OUTPUT_ASCII(FILE, STR, LENGTH) \
207 do \
209 register const unsigned char *_ascii_bytes = \
210 (const unsigned char *) (STR); \
211 register const unsigned char *limit = _ascii_bytes + (LENGTH); \
212 register unsigned bytes_in_chunk = 0; \
214 for (; _ascii_bytes < limit; _ascii_bytes++) \
216 register const unsigned char *p; \
218 if (bytes_in_chunk >= 60) \
220 fprintf ((FILE), "\"\n"); \
221 bytes_in_chunk = 0; \
224 for (p = _ascii_bytes; p < limit && *p != '\0'; p++) \
225 continue; \
227 if (p < limit && (p - _ascii_bytes) <= (long)STRING_LIMIT) \
229 if (bytes_in_chunk > 0) \
231 fprintf ((FILE), "\"\n"); \
232 bytes_in_chunk = 0; \
235 ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes); \
236 _ascii_bytes = p; \
238 else \
240 register int escape; \
241 register unsigned ch; \
243 if (bytes_in_chunk == 0) \
244 fprintf ((FILE), "%s\"", ASCII_DATA_ASM_OP); \
246 switch (escape = ESCAPES[ch = *_ascii_bytes]) \
248 case 0: \
249 putc (ch, (FILE)); \
250 bytes_in_chunk++; \
251 break; \
252 case 1: \
253 fprintf ((FILE), "\\%03o", ch); \
254 bytes_in_chunk += 4; \
255 break; \
256 default: \
257 putc ('\\', (FILE)); \
258 putc (escape, (FILE)); \
259 bytes_in_chunk += 2; \
260 break; \
265 if (bytes_in_chunk > 0) \
266 fprintf ((FILE), "\"\n"); \
268 while (0)
271 /* Node: Label Output */
273 #define SET_ASM_OP "\t.set\t"
275 #define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
276 (*targetm.asm_out.globalize_label) (FILE, XSTR (FUN, 0))
278 #define ASM_WEAKEN_LABEL(FILE, NAME) \
279 do \
281 fputs ("\t.weak\t", (FILE)); \
282 assemble_name ((FILE), (NAME)); \
283 fputc ('\n', (FILE)); \
285 while (0)
287 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
288 do \
290 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function"); \
291 ASM_OUTPUT_LABEL(FILE, NAME); \
293 while (0)
295 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
296 do \
298 HOST_WIDE_INT size; \
300 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \
302 size_directive_output = 0; \
303 if (!flag_inhibit_size_directive \
304 && (DECL) && DECL_SIZE (DECL)) \
306 size_directive_output = 1; \
307 size = int_size_in_bytes (TREE_TYPE (DECL)); \
308 ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, size); \
311 ASM_OUTPUT_LABEL (FILE, NAME); \
313 while (0)
315 #undef ASM_FINISH_DECLARE_OBJECT
316 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END)\
317 do \
319 const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
320 HOST_WIDE_INT size; \
322 if (!flag_inhibit_size_directive \
323 && DECL_SIZE (DECL) \
324 && ! AT_END && TOP_LEVEL \
325 && DECL_INITIAL (DECL) == error_mark_node \
326 && !size_directive_output) \
328 size_directive_output = 1; \
329 size = int_size_in_bytes (TREE_TYPE (DECL)); \
330 ASM_OUTPUT_SIZE_DIRECTIVE (FILE, name, size); \
333 while (0)
335 #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
336 do \
338 if (!flag_inhibit_size_directive) \
339 ASM_OUTPUT_MEASURED_SIZE (FILE, FNAME); \
341 while (0)
343 /* The configure machinery invokes the assembler without options, which is
344 not how gcc invokes it. Without options, the multi-target assembler
345 will probably be found, which is ELF by default. To counter that, we
346 need to override ELF auto-host.h config stuff which we know collides
347 with a.out. */
348 #undef HAVE_GAS_HIDDEN
351 /* Node: Alignment Output */
353 #define SKIP_ASM_OP "\t.zero\t"
355 #undef ASM_OUTPUT_SKIP
356 #define ASM_OUTPUT_SKIP(FILE, SIZE) \
357 fprintf (FILE, "%s%u\n", SKIP_ASM_OP, (int)(SIZE))
359 /* Node: All Debuggers */
361 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
364 /* Node: Misc */
366 #define HANDLE_SYSV_PRAGMA 1
368 /* In theory, this one isn't necessary, but over time, external tools have
369 been primed on names with "." rather than "$". */
370 #define NO_DOLLAR_IN_LABEL
372 /* These are undocumented, but to keep a single
373 CRIS_ASM_OUTPUT_ALIGNED_DECL_COMMON, we set this to an asm that will
374 emit an error if ever output. It will not be emitted for a.out modulo
375 careless hacking. */
376 #define COMMON_ASM_OP "\t.err\t"
377 #define LOCAL_ASM_OP "\t.err\t"
379 #if defined(__CRIS__) && defined (__AOUT__) && defined (IN_GCC)
381 #define CRIS_ABI_VERSION_SYMBOL_STRING ".$CRIS_ABI_V2"
383 /* Make all a.out library functions have undefined references to the
384 .$CRIS_ABI_V2 symbol, so it will be picked up. Used by GDB. GDB has
385 a bug with reading a.out symbols; it does not see the GNU weak
386 extensions, so we can't have .$CRIS_ABI_V2 weak. Weak. */
387 __asm__ (".set .$abi_referer," CRIS_ABI_VERSION_SYMBOL_STRING);
388 #endif
391 * Local variables:
392 * eval: (c-set-style "gnu")
393 * indent-tabs-mode: t
394 * End: