]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/config/cris/aout.h
host-hpux.c: Change copyright header to refer to version 3 of the GNU General Public...
[thirdparty/gcc.git] / gcc / config / cris / aout.h
CommitLineData
0b85d816 1/* Definitions for GCC. Part of the machine description for CRIS.
2f83c7d6 2 Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
0b85d816
HPN
3 Contributed by Axis Communications. Written by Hans-Peter Nilsson.
4
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
2f83c7d6 9the Free Software Foundation; either version 3, or (at your option)
0b85d816
HPN
10any later version.
11
12GCC is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
2f83c7d6
NC
18along with GCC; see the file COPYING3. If not see
19<http://www.gnu.org/licenses/>. */
0b85d816
HPN
20
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.
26
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. */
33
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. */
37
38/* Node: Driver */
39
40#undef STARTFILE_SPEC
41#define STARTFILE_SPEC \
42 "%{melinux:crt0.o%s}\
fe04ce06 43 %{!melinux:%{sim*:crt1.o%s}%{!sim*:crt0.o%s}}"
0b85d816 44
02af0d9b
HPN
45/* Override cris.h define. */
46#undef ENDFILE_SPEC
47
0b85d816
HPN
48#undef CRIS_CPP_SUBTARGET_SPEC
49#define CRIS_CPP_SUBTARGET_SPEC \
a6e464ae 50 "%{melinux:-D__gnu_linux__ -D__linux__ -D__unix__ -D__elinux__ -D__uclinux__\
0b85d816
HPN
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}}}}}"
55
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}}}}"
61
62#undef CRIS_ASM_SUBTARGET_SPEC
63#define CRIS_ASM_SUBTARGET_SPEC "--em=crisaout"
64
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=%*}"
75
2a186d97
HPN
76/* Previously controlled by target_flags. */
77#undef TARGET_ELF
78#define TARGET_ELF 0
79
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; \
95 \
2a186d97
HPN
96 default: \
97 break; \
98 } \
99 } \
100 while (0)
0b85d816
HPN
101
102#undef CRIS_SUBTARGET_VERSION
103#define CRIS_SUBTARGET_VERSION " - a.out"
104
105#undef CRIS_SUBTARGET_DEFAULT
106#define CRIS_SUBTARGET_DEFAULT 0
107
a6e464ae
HPN
108
109/* Node: Run-time Target */
110
111/* For the cris-*-aout subtarget. */
112#undef TARGET_OS_CPP_BUILTINS
113#define TARGET_OS_CPP_BUILTINS() \
114 do \
115 { \
116 builtin_define ("__AOUT__"); \
117 } \
118 while (0)
119
120
0b85d816
HPN
121/* Node: Storage Layout */
122
fe04ce06
HPN
123/* All sections but the .bss is rounded up to a 4-byte multiple size. */
124#define MAX_OFILE_ALIGNMENT 32
0b85d816
HPN
125
126
0b85d816
HPN
127/* Node: Data Output */
128
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"
138
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.
146
147 If your target assembler doesn't support the .string directive, you
148 should define this to zero. */
149
150#define STRING_LIMIT ((unsigned) 256)
151
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"
157
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). */
164
165#define ASM_OUTPUT_LIMITED_STRING(FILE, STR) \
166 do \
167 { \
168 register const unsigned char *_limited_str = \
169 (const unsigned char *) (STR); \
170 register unsigned ch; \
35d8c8e2 171 \
0b85d816 172 fprintf ((FILE), "%s\"", STRING_ASM_OP); \
35d8c8e2 173 \
0b85d816
HPN
174 for (; (ch = *_limited_str); _limited_str++) \
175 { \
176 register int escape; \
35d8c8e2 177 \
0b85d816
HPN
178 switch (escape = ESCAPES[ch]) \
179 { \
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; \
190 } \
191 } \
35d8c8e2 192 \
0b85d816
HPN
193 fprintf ((FILE), "\"\n"); \
194 } \
195 while (0)
196
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. */
203
204#undef ASM_OUTPUT_ASCII
205#define ASM_OUTPUT_ASCII(FILE, STR, LENGTH) \
206 do \
207 { \
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; \
212 \
213 for (; _ascii_bytes < limit; _ascii_bytes++) \
214 { \
215 register const unsigned char *p; \
35d8c8e2 216 \
0b85d816
HPN
217 if (bytes_in_chunk >= 60) \
218 { \
219 fprintf ((FILE), "\"\n"); \
220 bytes_in_chunk = 0; \
221 } \
35d8c8e2 222 \
0b85d816
HPN
223 for (p = _ascii_bytes; p < limit && *p != '\0'; p++) \
224 continue; \
35d8c8e2 225 \
0b85d816
HPN
226 if (p < limit && (p - _ascii_bytes) <= (long)STRING_LIMIT) \
227 { \
228 if (bytes_in_chunk > 0) \
229 { \
230 fprintf ((FILE), "\"\n"); \
231 bytes_in_chunk = 0; \
232 } \
35d8c8e2 233 \
0b85d816
HPN
234 ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes); \
235 _ascii_bytes = p; \
236 } \
237 else \
238 { \
239 register int escape; \
240 register unsigned ch; \
35d8c8e2 241 \
0b85d816
HPN
242 if (bytes_in_chunk == 0) \
243 fprintf ((FILE), "%s\"", ASCII_DATA_ASM_OP); \
35d8c8e2 244 \
0b85d816
HPN
245 switch (escape = ESCAPES[ch = *_ascii_bytes]) \
246 { \
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; \
260 } \
261 } \
262 } \
35d8c8e2 263 \
0b85d816
HPN
264 if (bytes_in_chunk > 0) \
265 fprintf ((FILE), "\"\n"); \
266 } \
267 while (0)
268
269
270/* Node: Label Output */
271
272#define SET_ASM_OP "\t.set\t"
273
274#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
5eb99654 275 (*targetm.asm_out.globalize_label) (FILE, XSTR (FUN, 0))
0b85d816 276
35d8c8e2 277#define ASM_WEAKEN_LABEL(FILE, NAME) \
0b85d816
HPN
278 do \
279 { \
280 fputs ("\t.weak\t", (FILE)); \
35d8c8e2 281 assemble_name ((FILE), (NAME)); \
0b85d816
HPN
282 fputc ('\n', (FILE)); \
283 } \
284 while (0)
285
2be2ac70
ZW
286#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
287 do \
288 { \
289 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function"); \
290 ASM_OUTPUT_LABEL(FILE, NAME); \
291 } \
0b85d816
HPN
292 while (0)
293
294#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
295 do \
296 { \
2be2ac70
ZW
297 HOST_WIDE_INT size; \
298 \
299 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \
300 \
0b85d816 301 size_directive_output = 0; \
0b85d816
HPN
302 if (!flag_inhibit_size_directive \
303 && (DECL) && DECL_SIZE (DECL)) \
304 { \
305 size_directive_output = 1; \
2be2ac70
ZW
306 size = int_size_in_bytes (TREE_TYPE (DECL)); \
307 ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, size); \
0b85d816 308 } \
2be2ac70 309 \
0b85d816
HPN
310 ASM_OUTPUT_LABEL (FILE, NAME); \
311 } \
312 while (0)
313
35d8c8e2 314#undef ASM_FINISH_DECLARE_OBJECT
0b85d816
HPN
315#define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END)\
316 do \
317 { \
318 const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
2be2ac70 319 HOST_WIDE_INT size; \
35d8c8e2 320 \
0b85d816
HPN
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) \
326 { \
327 size_directive_output = 1; \
2be2ac70
ZW
328 size = int_size_in_bytes (TREE_TYPE (DECL)); \
329 ASM_OUTPUT_SIZE_DIRECTIVE (FILE, name, size); \
0b85d816
HPN
330 } \
331 } \
332 while (0)
333
334#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
335 do \
336 { \
337 if (!flag_inhibit_size_directive) \
99086d59 338 ASM_OUTPUT_MEASURED_SIZE (FILE, FNAME); \
0b85d816
HPN
339 } \
340 while (0)
341
32b0bbaa
HPN
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
348
0b85d816
HPN
349
350/* Node: Alignment Output */
351
352#define SKIP_ASM_OP "\t.zero\t"
353
354#undef ASM_OUTPUT_SKIP
355#define ASM_OUTPUT_SKIP(FILE, SIZE) \
58e15542 356 fprintf (FILE, "%s%u\n", SKIP_ASM_OP, (int)(SIZE))
0b85d816
HPN
357
358/* Node: All Debuggers */
359
360#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
361
362
363/* Node: Misc */
364
32f0ffb3 365#define HANDLE_SYSV_PRAGMA 1
0b85d816
HPN
366
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
370
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"
377
378#if defined(__CRIS__) && defined (__AOUT__) && defined (IN_GCC)
379
380#define CRIS_ABI_VERSION_SYMBOL_STRING ".$CRIS_ABI_V2"
381
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
388
389/*
390 * Local variables:
391 * eval: (c-set-style "gnu")
392 * indent-tabs-mode: t
393 * End:
394 */