OSDN Git Service

* config/cris/cris.h (CRIS_SUBTARGET_VERSION, TARGET_VERSION): Don't
[pf3gnuchains/gcc-fork.git] / gcc / config / cris / aout.h
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.
4
5 This file is part of GCC.
6
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.
11
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.
16
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/>.  */
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}\
43   %{!melinux:%{sim*:crt1.o%s}%{!sim*:crt0.o%s}}"
44
45 /* Override cris.h define.  */
46 #undef ENDFILE_SPEC
47
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}}}}}"
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
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                                                         \
96         default:                                        \
97           break;                                        \
98         }                                               \
99     }                                                   \
100   while (0)
101
102 #undef CRIS_SUBTARGET_DEFAULT
103 #define CRIS_SUBTARGET_DEFAULT 0
104
105
106 /* Node: Run-time Target */
107
108 /* For the cris-*-aout subtarget.  */
109 #undef TARGET_OS_CPP_BUILTINS
110 #define TARGET_OS_CPP_BUILTINS()                \
111   do                                            \
112     {                                           \
113       builtin_define ("__AOUT__");              \
114     }                                           \
115   while (0)
116
117
118 /* Node: Storage Layout */
119
120 /* All sections but the .bss is rounded up to a 4-byte multiple size.  */
121 #define MAX_OFILE_ALIGNMENT 32
122
123
124 /* Node: Data Output */
125
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"
135
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.
143
144    If your target assembler doesn't support the .string directive, you
145    should define this to zero.  */
146
147 #define STRING_LIMIT    ((unsigned) 256)
148
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"
154
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).  */
161
162 #define ASM_OUTPUT_LIMITED_STRING(FILE, STR)            \
163   do                                                    \
164     {                                                   \
165       register const unsigned char *_limited_str =      \
166         (const unsigned char *) (STR);                  \
167       register unsigned ch;                             \
168                                                         \
169       fprintf ((FILE), "%s\"", STRING_ASM_OP);          \
170                                                         \
171       for (; (ch = *_limited_str); _limited_str++)      \
172         {                                               \
173           register int escape;                          \
174                                                         \
175           switch (escape = ESCAPES[ch])                 \
176             {                                           \
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;                                    \
187             }                                           \
188         }                                               \
189                                                         \
190       fprintf ((FILE), "\"\n");                         \
191     }                                                   \
192   while (0)
193
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.  */
200
201 #undef  ASM_OUTPUT_ASCII
202 #define ASM_OUTPUT_ASCII(FILE, STR, LENGTH)                             \
203   do                                                                    \
204     {                                                                   \
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;                             \
209                                                                         \
210       for (; _ascii_bytes < limit; _ascii_bytes++)                      \
211         {                                                               \
212           register const unsigned char *p;                              \
213                                                                         \
214           if (bytes_in_chunk >= 60)                                     \
215             {                                                           \
216               fprintf ((FILE), "\"\n");                                 \
217               bytes_in_chunk = 0;                                       \
218             }                                                           \
219                                                                         \
220           for (p = _ascii_bytes; p < limit && *p != '\0'; p++)          \
221             continue;                                                   \
222                                                                         \
223           if (p < limit && (p - _ascii_bytes) <= (long)STRING_LIMIT)    \
224             {                                                           \
225               if (bytes_in_chunk > 0)                                   \
226                 {                                                       \
227                   fprintf ((FILE), "\"\n");                             \
228                   bytes_in_chunk = 0;                                   \
229                 }                                                       \
230                                                                         \
231               ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes);         \
232               _ascii_bytes = p;                                         \
233             }                                                           \
234           else                                                          \
235             {                                                           \
236               register int escape;                                      \
237               register unsigned ch;                                     \
238                                                                         \
239               if (bytes_in_chunk == 0)                                  \
240                 fprintf ((FILE), "%s\"", ASCII_DATA_ASM_OP);            \
241                                                                         \
242               switch (escape = ESCAPES[ch = *_ascii_bytes])             \
243                 {                                                       \
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;                                                \
257                 }                                                       \
258             }                                                           \
259         }                                                               \
260                                                                         \
261       if (bytes_in_chunk > 0)                                           \
262         fprintf ((FILE), "\"\n");                                       \
263     }                                                                   \
264   while (0)
265
266
267 /* Node: Label Output */
268
269 #define SET_ASM_OP      "\t.set\t"
270
271 #define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN)  \
272   (*targetm.asm_out.globalize_label) (FILE, XSTR (FUN, 0))
273
274 #define ASM_WEAKEN_LABEL(FILE, NAME)    \
275   do                                    \
276     {                                   \
277       fputs ("\t.weak\t", (FILE));      \
278       assemble_name ((FILE), (NAME));   \
279       fputc ('\n', (FILE));             \
280     }                                   \
281   while (0)
282
283 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)             \
284   do                                                            \
285     {                                                           \
286       ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function");       \
287       ASM_OUTPUT_LABEL(FILE, NAME);                             \
288     }                                                           \
289   while (0)
290
291 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL)               \
292   do                                                            \
293     {                                                           \
294       HOST_WIDE_INT size;                                       \
295                                                                 \
296       ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object");         \
297                                                                 \
298       size_directive_output = 0;                                \
299       if (!flag_inhibit_size_directive                          \
300           && (DECL) && DECL_SIZE (DECL))                        \
301         {                                                       \
302           size_directive_output = 1;                            \
303           size = int_size_in_bytes (TREE_TYPE (DECL));          \
304           ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, size);         \
305         }                                                       \
306                                                                 \
307       ASM_OUTPUT_LABEL (FILE, NAME);                            \
308     }                                                           \
309   while (0)
310
311 #undef ASM_FINISH_DECLARE_OBJECT
312 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END)\
313   do                                                            \
314     {                                                           \
315       const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0);   \
316       HOST_WIDE_INT size;                                       \
317                                                                 \
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)                            \
323         {                                                       \
324           size_directive_output = 1;                            \
325           size = int_size_in_bytes (TREE_TYPE (DECL));          \
326           ASM_OUTPUT_SIZE_DIRECTIVE (FILE, name, size);         \
327         }                                                       \
328     }                                                           \
329   while (0)
330
331 #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL)            \
332   do                                                            \
333     {                                                           \
334       if (!flag_inhibit_size_directive)                         \
335         ASM_OUTPUT_MEASURED_SIZE (FILE, FNAME);                 \
336     }                                                           \
337   while (0)
338
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
345
346
347 /* Node: Alignment Output */
348
349 #define SKIP_ASM_OP     "\t.zero\t"
350
351 #undef  ASM_OUTPUT_SKIP
352 #define ASM_OUTPUT_SKIP(FILE, SIZE) \
353   fprintf (FILE, "%s%u\n", SKIP_ASM_OP, (int)(SIZE))
354
355 /* Node: All Debuggers */
356
357 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
358
359
360 /* Node: Misc */
361
362 #define HANDLE_SYSV_PRAGMA 1
363
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
367
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"
374
375 #if defined(__CRIS__) && defined (__AOUT__) && defined (IN_GCC)
376
377 #define CRIS_ABI_VERSION_SYMBOL_STRING ".$CRIS_ABI_V2"
378
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
385
386 /*
387  * Local variables:
388  * eval: (c-set-style "gnu")
389  * indent-tabs-mode: t
390  * End:
391  */