PR c++/8795
[official-gcc.git] / gcc / config / cris / aout.h
blobe77c73ce4324c8f1cc842d451039dabb89678cc1
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)
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, 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
37 config/gas-aout.h. */
39 /* Node: Driver */
41 #undef STARTFILE_SPEC
42 #define STARTFILE_SPEC \
43 "%{melinux:crt0.o%s}\
44 %{!melinux:\
45 %{sim2:s2crt0.o%s}\
46 %{!sim2:\
47 %{sim:scrt0.o%s}\
48 %{!sim:%{pg:gcrt0.o%s}\
49 %{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}}}}"
51 /* Override cris.h define. */
52 #undef ENDFILE_SPEC
54 /* Which library to get. The only difference from the default is to get
55 libsc.a if -sim is given to the driver. Repeat -lc -lsysX
56 {X=sim,linux}, because libsysX needs (at least) errno from libc, and
57 then we want to resolve new unknowns in libc against libsysX, not
58 libnosys. Assume everything is in libc for -mlinux. */
59 #undef LIB_SPEC
60 #define LIB_SPEC \
61 "%{melinux:-lc -lsyslinux -lc -lsyslinux -lic}\
62 %{!melinux:\
63 %{sim*:-lc -lsyssim -lc -lsyssim}\
64 %{!sim*:%{g*:-lg}\
65 %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} -lbsp}\
66 -lnosys}"
68 #undef CRIS_CPP_SUBTARGET_SPEC
69 #define CRIS_CPP_SUBTARGET_SPEC \
70 "%{melinux:-D__gnu_linux__ -D__linux__ -D__unix__ -D__elinux__ -D__uclinux__\
71 %{!nostdinc:\
72 %{!mbest-lib-options:%{isystem*}}\
73 -isystem elinux/include%s\
74 %{mbest-lib-options:%{isystem*}}}\
75 %{!ansi:%{!std=*:%{!undef:-Dlinux -Dunix -Delinux -Duclinux}}}}\
76 %{mbest-lib-options:\
77 %{!moverride-best-lib-options:\
78 %{!march=*:%{!metrax*:%{!mcpu=*:-D__tune_v8 -D__CRIS_arch_tune=8}}}}}"
80 #undef CRIS_CC1_SUBTARGET_SPEC
81 #define CRIS_CC1_SUBTARGET_SPEC \
82 "%{mbest-lib-options:\
83 %{!moverride-best-lib-options:\
84 %{!march=*:%{!mcpu=*:-mtune=v8}}}}"
86 #undef CRIS_ASM_SUBTARGET_SPEC
87 #define CRIS_ASM_SUBTARGET_SPEC "--em=crisaout"
89 #undef CRIS_LINK_SUBTARGET_SPEC
90 #define CRIS_LINK_SUBTARGET_SPEC \
91 "-mcrisaout\
92 %{sim2:%{!T*:-Tdata 0x4000000 -Tbss 0x8000000}}\
93 %{melinux:-Ur -d\
94 %{!shlib:%{!symbolic:-Bstatic}}\
95 %{shlib:-Bdynamic}\
96 %{symbolic:-Bdynamic}\
97 %{static:-Bstatic}}\
98 %{melinux-stacksize=*:-defsym __Stacksize=%*}"
100 #undef CRIS_SUBTARGET_SWITCHES
101 #define CRIS_SUBTARGET_SWITCHES \
102 {"elinux", (TARGET_MASK_SVINTO \
103 + TARGET_MASK_STACK_ALIGN \
104 + TARGET_MASK_CONST_ALIGN \
105 + TARGET_MASK_DATA_ALIGN \
106 + TARGET_MASK_ETRAX4_ADD \
107 + TARGET_MASK_ALIGN_BY_32), \
108 N_("Compile for the MMU-less Etrax 100-based elinux system")}, \
109 /* Legacy option. */ \
110 {"aout", 0, ""},
112 #undef CRIS_SUBTARGET_LONG_OPTIONS
113 #define CRIS_SUBTARGET_LONG_OPTIONS \
114 {"elinux-stacksize=", &cris_elinux_stacksize_str, \
115 N_("For elinux, request a specified stack-size for this program"), 0}, \
117 #undef CRIS_SUBTARGET_VERSION
118 #define CRIS_SUBTARGET_VERSION " - a.out"
120 #undef CRIS_SUBTARGET_DEFAULT
121 #define CRIS_SUBTARGET_DEFAULT 0
124 /* Node: Run-time Target */
126 /* For the cris-*-aout subtarget. */
127 #undef TARGET_OS_CPP_BUILTINS
128 #define TARGET_OS_CPP_BUILTINS() \
129 do \
131 builtin_define ("__AOUT__"); \
133 while (0)
136 /* Node: Storage Layout */
138 /* We can align to 16 bits (only) with CRIS a.out. */
139 #define MAX_OFILE_ALIGNMENT 16
142 /* Node: Library Calls */
144 #define TARGET_MEM_FUNCTIONS
147 /* Node: Data Output */
149 #define ESCAPES \
150 "\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\
151 \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\
152 \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\
153 \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\
154 \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\
155 \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\
156 \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\
157 \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"
159 /* Some svr4 assemblers have a limit on the number of characters which
160 can appear in the operand of a .string directive. If your assembler
161 has such a limitation, you should define STRING_LIMIT to reflect that
162 limit. Note that at least some svr4 assemblers have a limit on the
163 actual number of bytes in the double-quoted string, and that they
164 count each character in an escape sequence as one byte. Thus, an
165 escape sequence like \377 would count as four bytes.
167 If your target assembler doesn't support the .string directive, you
168 should define this to zero. */
170 #define STRING_LIMIT ((unsigned) 256)
172 #define STRING_ASM_OP "\t.string\t"
173 #define ASCII_DATA_ASM_OP "\t.ascii\t"
174 #define TYPE_ASM_OP "\t.type\t"
175 #define SIZE_ASM_OP "\t.size\t"
176 #define TYPE_OPERAND_FMT "@%s"
178 /* The routine used to output NUL terminated strings. We use a special
179 version of this for most svr4 targets because doing so makes the
180 generated assembly code more compact (and thus faster to assemble)
181 as well as more readable, especially for targets like the i386
182 (where the only alternative is to output character sequences as
183 comma separated lists of numbers). */
185 #define ASM_OUTPUT_LIMITED_STRING(FILE, STR) \
186 do \
188 register const unsigned char *_limited_str = \
189 (const unsigned char *) (STR); \
190 register unsigned ch; \
192 fprintf ((FILE), "%s\"", STRING_ASM_OP); \
194 for (; (ch = *_limited_str); _limited_str++) \
196 register int escape; \
198 switch (escape = ESCAPES[ch]) \
200 case 0: \
201 putc (ch, (FILE)); \
202 break; \
203 case 1: \
204 fprintf ((FILE), "\\%03o", ch); \
205 break; \
206 default: \
207 putc ('\\', (FILE)); \
208 putc (escape, (FILE)); \
209 break; \
213 fprintf ((FILE), "\"\n"); \
215 while (0)
217 /* The routine used to output sequences of byte values. We use a special
218 version of this for most svr4 targets because doing so makes the
219 generated assembly code more compact (and thus faster to assemble)
220 as well as more readable. Note that if we find subparts of the
221 character sequence which end with NUL (and which are shorter than
222 STRING_LIMIT) we output those using ASM_OUTPUT_LIMITED_STRING. */
224 #undef ASM_OUTPUT_ASCII
225 #define ASM_OUTPUT_ASCII(FILE, STR, LENGTH) \
226 do \
228 register const unsigned char *_ascii_bytes = \
229 (const unsigned char *) (STR); \
230 register const unsigned char *limit = _ascii_bytes + (LENGTH); \
231 register unsigned bytes_in_chunk = 0; \
233 for (; _ascii_bytes < limit; _ascii_bytes++) \
235 register const unsigned char *p; \
237 if (bytes_in_chunk >= 60) \
239 fprintf ((FILE), "\"\n"); \
240 bytes_in_chunk = 0; \
243 for (p = _ascii_bytes; p < limit && *p != '\0'; p++) \
244 continue; \
246 if (p < limit && (p - _ascii_bytes) <= (long)STRING_LIMIT) \
248 if (bytes_in_chunk > 0) \
250 fprintf ((FILE), "\"\n"); \
251 bytes_in_chunk = 0; \
254 ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes); \
255 _ascii_bytes = p; \
257 else \
259 register int escape; \
260 register unsigned ch; \
262 if (bytes_in_chunk == 0) \
263 fprintf ((FILE), "%s\"", ASCII_DATA_ASM_OP); \
265 switch (escape = ESCAPES[ch = *_ascii_bytes]) \
267 case 0: \
268 putc (ch, (FILE)); \
269 bytes_in_chunk++; \
270 break; \
271 case 1: \
272 fprintf ((FILE), "\\%03o", ch); \
273 bytes_in_chunk += 4; \
274 break; \
275 default: \
276 putc ('\\', (FILE)); \
277 putc (escape, (FILE)); \
278 bytes_in_chunk += 2; \
279 break; \
284 if (bytes_in_chunk > 0) \
285 fprintf ((FILE), "\"\n"); \
287 while (0)
290 /* Node: Label Output */
292 #define SET_ASM_OP "\t.set\t"
294 #define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
295 (*targetm.asm_out.globalize_label) (FILE, XSTR (FUN, 0))
297 #define ASM_WEAKEN_LABEL(FILE, NAME) \
298 do \
300 fputs ("\t.weak\t", (FILE)); \
301 assemble_name ((FILE), (NAME)); \
302 fputc ('\n', (FILE)); \
304 while (0)
306 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
307 do \
309 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function"); \
310 ASM_OUTPUT_LABEL(FILE, NAME); \
312 while (0)
314 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
315 do \
317 HOST_WIDE_INT size; \
319 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \
321 size_directive_output = 0; \
322 if (!flag_inhibit_size_directive \
323 && (DECL) && DECL_SIZE (DECL)) \
325 size_directive_output = 1; \
326 size = int_size_in_bytes (TREE_TYPE (DECL)); \
327 ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, size); \
330 ASM_OUTPUT_LABEL (FILE, NAME); \
332 while (0)
334 #undef ASM_FINISH_DECLARE_OBJECT
335 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END)\
336 do \
338 const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
339 HOST_WIDE_INT size; \
341 if (!flag_inhibit_size_directive \
342 && DECL_SIZE (DECL) \
343 && ! AT_END && TOP_LEVEL \
344 && DECL_INITIAL (DECL) == error_mark_node \
345 && !size_directive_output) \
347 size_directive_output = 1; \
348 size = int_size_in_bytes (TREE_TYPE (DECL)); \
349 ASM_OUTPUT_SIZE_DIRECTIVE (FILE, name, size); \
352 while (0)
354 #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
355 do \
357 if (!flag_inhibit_size_directive) \
358 ASM_OUTPUT_MEASURED_SIZE (FILE, FNAME); \
360 while (0)
362 /* The configure machinery invokes the assembler without options, which is
363 not how gcc invokes it. Without options, the multi-target assembler
364 will probably be found, which is ELF by default. To counter that, we
365 need to override ELF auto-host.h config stuff which we know collides
366 with a.out. */
367 #undef HAVE_GAS_HIDDEN
370 /* Node: Alignment Output */
372 #define SKIP_ASM_OP "\t.zero\t"
374 #undef ASM_OUTPUT_SKIP
375 #define ASM_OUTPUT_SKIP(FILE, SIZE) \
376 fprintf (FILE, "%s%u\n", SKIP_ASM_OP, (int)(SIZE))
378 /* Node: All Debuggers */
380 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
383 /* Node: Misc */
385 #define HANDLE_SYSV_PRAGMA 1
387 /* In theory, this one isn't necessary, but over time, external tools have
388 been primed on names with "." rather than "$". */
389 #define NO_DOLLAR_IN_LABEL
391 /* These are undocumented, but to keep a single
392 CRIS_ASM_OUTPUT_ALIGNED_DECL_COMMON, we set this to an asm that will
393 emit an error if ever output. It will not be emitted for a.out modulo
394 careless hacking. */
395 #define COMMON_ASM_OP "\t.err\t"
396 #define LOCAL_ASM_OP "\t.err\t"
398 #if defined(__CRIS__) && defined (__AOUT__) && defined (IN_GCC)
400 #define CRIS_ABI_VERSION_SYMBOL_STRING ".$CRIS_ABI_V2"
402 /* Make all a.out library functions have undefined references to the
403 .$CRIS_ABI_V2 symbol, so it will be picked up. Used by GDB. GDB has
404 a bug with reading a.out symbols; it does not see the GNU weak
405 extensions, so we can't have .$CRIS_ABI_V2 weak. Weak. */
406 __asm__ (".set .$abi_referer," CRIS_ABI_VERSION_SYMBOL_STRING);
407 #endif
410 * Local variables:
411 * eval: (c-set-style "gnu")
412 * indent-tabs-mode: t
413 * End: