OSDN Git Service

Change callers in config/[h-l]*/ to match:
[pf3gnuchains/gcc-fork.git] / gcc / config / i386 / i386elf.h
1 /* Target definitions for GNU compiler for Intel 80386 using ELF
2    Copyright (C) 1988, 1991, 1995, 2000 Free Software Foundation, Inc.
3
4    Derived from sysv4.h written by Ron Guilmette (rfg@netcom.com).
5
6 This file is part of GNU CC.
7
8 GNU CC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
12
13 GNU CC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with GNU CC; see the file COPYING.  If not, write to
20 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
21
22 /* Use stabs instead of DWARF debug format.  */
23 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
24
25 #include "i386/i386.h"
26 #include "i386/att.h"
27 #include "elfos.h"
28
29 #undef TARGET_VERSION
30 #define TARGET_VERSION fprintf (stderr, " (i386 bare ELF target)");
31
32 /* By default, target has a 80387, uses IEEE compatible arithmetic,
33    and returns float values in the 387.  */
34
35 #define TARGET_DEFAULT (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS)
36
37 /* The ELF ABI for the i386 says that records and unions are returned
38    in memory.  */
39
40 #undef RETURN_IN_MEMORY
41 #define RETURN_IN_MEMORY(TYPE) \
42   (TYPE_MODE (TYPE) == BLKmode \
43    || (VECTOR_MODE_P (TYPE_MODE (TYPE)) && int_size_in_bytes (TYPE) == 8))
44
45 /* This used to define X86, but james@bigtex.cactus.org says that
46    is supposed to be defined optionally by user programs--not by default.  */
47 #define CPP_PREDEFINES ""
48
49 #undef CPP_SPEC
50 #define CPP_SPEC "%(cpp_cpu)"
51
52 /* This is how to output assembly code to define a `float' constant.
53    We always have to use a .long pseudo-op to do this because the native
54    SVR4 ELF assembler is buggy and it generates incorrect values when we
55    try to use the .float pseudo-op instead.  */
56
57 #undef ASM_OUTPUT_FLOAT
58 #define ASM_OUTPUT_FLOAT(FILE,VALUE)                                    \
59 do { long value;                                                        \
60      REAL_VALUE_TO_TARGET_SINGLE ((VALUE), value);                      \
61      if (sizeof (int) == sizeof (long))                                 \
62          fprintf((FILE), "%s\t0x%x\n", ASM_LONG, value);                \
63      else                                                               \
64          fprintf((FILE), "%s\t0x%lx\n", ASM_LONG, value);               \
65    } while (0)
66
67 /* This is how to output assembly code to define a `double' constant.
68    We always have to use a pair of .long pseudo-ops to do this because
69    the native SVR4 ELF assembler is buggy and it generates incorrect
70    values when we try to use the the .double pseudo-op instead.  */
71
72 #undef ASM_OUTPUT_DOUBLE
73 #define ASM_OUTPUT_DOUBLE(FILE,VALUE)                                   \
74 do { long value[2];                                                     \
75      REAL_VALUE_TO_TARGET_DOUBLE ((VALUE), value);                      \
76      if (sizeof (int) == sizeof (long))                                 \
77        {                                                                \
78          fprintf((FILE), "%s\t0x%x\n", ASM_LONG, value[0]);             \
79          fprintf((FILE), "%s\t0x%x\n", ASM_LONG, value[1]);             \
80        }                                                                \
81      else                                                               \
82        {                                                                \
83          fprintf((FILE), "%s\t0x%lx\n", ASM_LONG, value[0]);            \
84          fprintf((FILE), "%s\t0x%lx\n", ASM_LONG, value[1]);            \
85        }                                                                \
86    } while (0)
87
88
89 #undef ASM_OUTPUT_LONG_DOUBLE
90 #define ASM_OUTPUT_LONG_DOUBLE(FILE,VALUE)                              \
91 do { long value[3];                                                     \
92      REAL_VALUE_TO_TARGET_LONG_DOUBLE ((VALUE), value);                 \
93      if (sizeof (int) == sizeof (long))                                 \
94        {                                                                \
95          fprintf((FILE), "%s\t0x%x\n", ASM_LONG, value[0]);             \
96          fprintf((FILE), "%s\t0x%x\n", ASM_LONG, value[1]);             \
97          fprintf((FILE), "%s\t0x%x\n", ASM_LONG, value[2]);             \
98        }                                                                \
99      else                                                               \
100        {                                                                \
101          fprintf((FILE), "%s\t0x%lx\n", ASM_LONG, value[0]);            \
102          fprintf((FILE), "%s\t0x%lx\n", ASM_LONG, value[1]);            \
103          fprintf((FILE), "%s\t0x%lx\n", ASM_LONG, value[2]);            \
104        }                                                                \
105    } while (0)
106
107 /* Output at beginning of assembler file.  */
108 /* The .file command should always begin the output.  */
109
110 #undef ASM_FILE_START
111 #define ASM_FILE_START(FILE)                                            \
112   do {                                                                  \
113         output_file_directive (FILE, main_input_filename);              \
114         fprintf (FILE, "\t.version\t\"01.01\"\n");                      \
115   } while (0)
116
117 #undef DBX_REGISTER_NUMBER
118 #define DBX_REGISTER_NUMBER(n)  svr4_dbx_register_map[n]
119
120 /* The routine used to output sequences of byte values.  We use a special
121    version of this for most svr4 targets because doing so makes the
122    generated assembly code more compact (and thus faster to assemble)
123    as well as more readable.  Note that if we find subparts of the
124    character sequence which end with NUL (and which are shorter than
125    STRING_LIMIT) we output those using ASM_OUTPUT_LIMITED_STRING.  */
126
127 #undef ASM_OUTPUT_ASCII
128 #define ASM_OUTPUT_ASCII(FILE, STR, LENGTH)                             \
129   do                                                                    \
130     {                                                                   \
131       register const unsigned char *_ascii_bytes =                      \
132         (const unsigned char *) (STR);                                  \
133       register const unsigned char *limit = _ascii_bytes + (LENGTH);    \
134       register unsigned bytes_in_chunk = 0;                             \
135       for (; _ascii_bytes < limit; _ascii_bytes++)                      \
136         {                                                               \
137           register const unsigned char *p;                              \
138           if (bytes_in_chunk >= 64)                                     \
139             {                                                           \
140               fputc ('\n', (FILE));                                     \
141               bytes_in_chunk = 0;                                       \
142             }                                                           \
143           for (p = _ascii_bytes; p < limit && *p != '\0'; p++)          \
144             continue;                                                   \
145           if (p < limit && (p - _ascii_bytes) <= STRING_LIMIT)          \
146             {                                                           \
147               if (bytes_in_chunk > 0)                                   \
148                 {                                                       \
149                   fputc ('\n', (FILE));                                 \
150                   bytes_in_chunk = 0;                                   \
151                 }                                                       \
152               ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes);         \
153               _ascii_bytes = p;                                         \
154             }                                                           \
155           else                                                          \
156             {                                                           \
157               if (bytes_in_chunk == 0)                                  \
158                 fprintf ((FILE), "\t.byte\t");                          \
159               else                                                      \
160                 fputc (',', (FILE));                                    \
161               fprintf ((FILE), "0x%02x", *_ascii_bytes);                \
162               bytes_in_chunk += 5;                                      \
163             }                                                           \
164         }                                                               \
165       if (bytes_in_chunk > 0)                                           \
166         fprintf ((FILE), "\n");                                         \
167     }                                                                   \
168   while (0)
169
170 /* This is how to output an element of a case-vector that is relative.
171    This is only used for PIC code.  See comments by the `casesi' insn in
172    i386.md for an explanation of the expression this outputs. */
173
174 #undef ASM_OUTPUT_ADDR_DIFF_ELT
175 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
176   fprintf (FILE, "\t.long _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", LPREFIX, VALUE)
177
178 /* Indicate that jump tables go in the text section.  This is
179    necessary when compiling PIC code.  */
180
181 #define JUMP_TABLES_IN_TEXT_SECTION 1
182
183 #define LOCAL_LABEL_PREFIX      "."
184
185 /* A C statement to output something to the assembler file to switch to section
186    NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or
187    NULL_TREE.  Some target formats do not support arbitrary sections.  Do not
188    define this macro in such cases.  */
189
190 #undef  ASM_OUTPUT_SECTION_NAME
191 #define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC) \
192 do {                                                                    \
193   if ((DECL) && TREE_CODE (DECL) == FUNCTION_DECL)                      \
194     fprintf (FILE, ".section\t%s,\"ax\"\n", (NAME));                    \
195   else if ((DECL) && DECL_READONLY_SECTION (DECL, RELOC))               \
196     fprintf (FILE, ".section\t%s,\"a\"\n", (NAME));                     \
197   else                                                                  \
198     fprintf (FILE, ".section\t%s,\"aw\"\n", (NAME));                    \
199 } while (0)
200
201 /* If defined, a C expression whose value is a string containing the
202    assembler operation to identify the following data as
203    uninitialized global data.  If not defined, and neither
204    `ASM_OUTPUT_BSS' nor `ASM_OUTPUT_ALIGNED_BSS' are defined,
205    uninitialized global data will be output in the data section if
206    `-fno-common' is passed, otherwise `ASM_OUTPUT_COMMON' will be
207    used.  */
208 #undef BSS_SECTION_ASM_OP
209 #define BSS_SECTION_ASM_OP "\t.section\t.bss"
210
211 /* Like `ASM_OUTPUT_BSS' except takes the required alignment as a
212    separate, explicit argument.  If you define this macro, it is used
213    in place of `ASM_OUTPUT_BSS', and gives you more flexibility in
214    handling the required alignment of the variable.  The alignment is
215    specified as the number of bits.
216
217    Try to use function `asm_output_aligned_bss' defined in file
218    `varasm.c' when defining this macro. */
219 #undef ASM_OUTPUT_ALIGNED_BSS
220 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
221   asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)