* ChangeLog: Follow spelling conventions.
[official-gcc.git] / gcc / config / cris / aout.h
blobfe99c769a0d6312eaf94dc582b6e3468ff9f28c0
1 /* Definitions for GCC. Part of the machine description for CRIS.
2 Copyright (C) 2001, 2002 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 /* 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. */
56 #undef LIB_SPEC
57 #define LIB_SPEC \
58 "%{melinux:-lc -lsyslinux -lc -lsyslinux -lic}\
59 %{!melinux:\
60 %{sim*:-lc -lsyssim -lc -lsyssim}\
61 %{!sim*:%{g*:-lg}\
62 %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} -lbsp}\
63 -lnosys}"
65 #undef CRIS_CPP_SUBTARGET_SPEC
66 #define CRIS_CPP_SUBTARGET_SPEC \
67 "-D__AOUT__\
68 %{melinux:-D__gnu_linux__ -D__linux__ -D__unix__ -D__elinux__ -D__uclinux__\
69 %{!nostdinc:\
70 %{!mbest-lib-options:%{isystem*}}\
71 -isystem elinux/include%s\
72 %{mbest-lib-options:%{isystem*}}}\
73 %{!ansi:%{!std=*:%{!undef:-Dlinux -Dunix -Delinux -Duclinux}}}}\
74 %{mbest-lib-options:\
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 \
89 "-mcrisaout\
90 %{sim2:%{!T*:-Tdata 0x4000000 -Tbss 0x8000000}}\
91 %{melinux:-Ur -d\
92 %{!shlib:%{!symbolic:-Bstatic}}\
93 %{shlib:-Bdynamic}\
94 %{symbolic:-Bdynamic}\
95 %{static:-Bstatic}}\
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. */ \
108 {"aout", 0, ""},
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 */
134 #define ESCAPES \
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) \
171 do \
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]) \
185 case 0: \
186 putc (ch, (FILE)); \
187 break; \
188 case 1: \
189 fprintf ((FILE), "\\%03o", ch); \
190 break; \
191 default: \
192 putc ('\\', (FILE)); \
193 putc (escape, (FILE)); \
194 break; \
198 fprintf ((FILE), "\"\n"); \
200 while (0)
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) \
211 do \
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++) \
229 continue; \
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); \
240 _ascii_bytes = p; \
242 else \
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]) \
252 case 0: \
253 putc (ch, (FILE)); \
254 bytes_in_chunk++; \
255 break; \
256 case 1: \
257 fprintf ((FILE), "\\%03o", ch); \
258 bytes_in_chunk += 4; \
259 break; \
260 default: \
261 putc ('\\', (FILE)); \
262 putc (escape, (FILE)); \
263 bytes_in_chunk += 2; \
264 break; \
269 if (bytes_in_chunk > 0) \
270 fprintf ((FILE), "\"\n"); \
272 while (0)
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) \
283 do \
285 fputs ("\t.weak\t", (FILE)); \
286 assemble_name ((FILE), (NAME)); \
287 fputc ('\n', (FILE)); \
289 while (0)
291 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
292 do \
294 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function"); \
295 ASM_OUTPUT_LABEL(FILE, NAME); \
297 while (0)
299 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
300 do \
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); \
317 while (0)
319 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END)\
320 do \
322 const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
323 HOST_WIDE_INT size; \
325 if (!flag_inhibit_size_directive \
326 && DECL_SIZE (DECL) \
327 && ! AT_END && TOP_LEVEL \
328 && DECL_INITIAL (DECL) == error_mark_node \
329 && !size_directive_output) \
331 size_directive_output = 1; \
332 size = int_size_in_bytes (TREE_TYPE (DECL)); \
333 ASM_OUTPUT_SIZE_DIRECTIVE (FILE, name, size); \
336 while (0)
338 #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
339 do \
341 if (!flag_inhibit_size_directive) \
342 ASM_OUTPUT_MEASURED_SIZE (FILE, FNAME); \
344 while (0)
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, (SIZE))
355 /* Node: All Debuggers */
357 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
360 /* Node: Misc */
362 #define HANDLE_SYSV_PRAGMA
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: