OSDN Git Service

* i386/netbsd.h (INT_ASM_OP): Define.
[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 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
44 /* This used to define X86, but james@bigtex.cactus.org says that
45    is supposed to be defined optionally by user programs--not by default.  */
46 #define CPP_PREDEFINES ""
47
48 #undef CPP_SPEC
49 #define CPP_SPEC "%(cpp_cpu)"
50
51 /* This is how to output assembly code to define a `float' constant.
52    We always have to use a .long pseudo-op to do this because the native
53    SVR4 ELF assembler is buggy and it generates incorrect values when we
54    try to use the .float pseudo-op instead.  */
55
56 #undef ASM_OUTPUT_FLOAT
57 #define ASM_OUTPUT_FLOAT(FILE,VALUE)                                    \
58 do { long value;                                                        \
59      REAL_VALUE_TO_TARGET_SINGLE ((VALUE), value);                      \
60      if (sizeof (int) == sizeof (long))                                 \
61          fprintf((FILE), "%s\t0x%x\n", ASM_LONG, value);                \
62      else                                                               \
63          fprintf((FILE), "%s\t0x%lx\n", ASM_LONG, value);               \
64    } while (0)
65
66 /* This is how to output assembly code to define a `double' constant.
67    We always have to use a pair of .long pseudo-ops to do this because
68    the native SVR4 ELF assembler is buggy and it generates incorrect
69    values when we try to use the the .double pseudo-op instead.  */
70
71 #undef ASM_OUTPUT_DOUBLE
72 #define ASM_OUTPUT_DOUBLE(FILE,VALUE)                                   \
73 do { long value[2];                                                     \
74      REAL_VALUE_TO_TARGET_DOUBLE ((VALUE), value);                      \
75      if (sizeof (int) == sizeof (long))                                 \
76        {                                                                \
77          fprintf((FILE), "%s\t0x%x\n", ASM_LONG, value[0]);             \
78          fprintf((FILE), "%s\t0x%x\n", ASM_LONG, value[1]);             \
79        }                                                                \
80      else                                                               \
81        {                                                                \
82          fprintf((FILE), "%s\t0x%lx\n", ASM_LONG, value[0]);            \
83          fprintf((FILE), "%s\t0x%lx\n", ASM_LONG, value[1]);            \
84        }                                                                \
85    } while (0)
86
87
88 #undef ASM_OUTPUT_LONG_DOUBLE
89 #define ASM_OUTPUT_LONG_DOUBLE(FILE,VALUE)                              \
90 do { long value[3];                                                     \
91      REAL_VALUE_TO_TARGET_LONG_DOUBLE ((VALUE), value);                 \
92      if (sizeof (int) == sizeof (long))                                 \
93        {                                                                \
94          fprintf((FILE), "%s\t0x%x\n", ASM_LONG, value[0]);             \
95          fprintf((FILE), "%s\t0x%x\n", ASM_LONG, value[1]);             \
96          fprintf((FILE), "%s\t0x%x\n", ASM_LONG, value[2]);             \
97        }                                                                \
98      else                                                               \
99        {                                                                \
100          fprintf((FILE), "%s\t0x%lx\n", ASM_LONG, value[0]);            \
101          fprintf((FILE), "%s\t0x%lx\n", ASM_LONG, value[1]);            \
102          fprintf((FILE), "%s\t0x%lx\n", ASM_LONG, value[2]);            \
103        }                                                                \
104    } while (0)
105
106 /* Output at beginning of assembler file.  */
107 /* The .file command should always begin the output.  */
108
109 #undef ASM_FILE_START
110 #define ASM_FILE_START(FILE)                                            \
111   do {                                                                  \
112         output_file_directive (FILE, main_input_filename);              \
113         fprintf (FILE, "\t.version\t\"01.01\"\n");                      \
114   } while (0)
115
116 #undef DBX_REGISTER_NUMBER
117 #define DBX_REGISTER_NUMBER(n)  svr4_dbx_register_map[n]
118
119 /* The routine used to output sequences of byte values.  We use a special
120    version of this for most svr4 targets because doing so makes the
121    generated assembly code more compact (and thus faster to assemble)
122    as well as more readable.  Note that if we find subparts of the
123    character sequence which end with NUL (and which are shorter than
124    STRING_LIMIT) we output those using ASM_OUTPUT_LIMITED_STRING.  */
125
126 #undef ASM_OUTPUT_ASCII
127 #define ASM_OUTPUT_ASCII(FILE, STR, LENGTH)                             \
128   do                                                                    \
129     {                                                                   \
130       register unsigned char *_ascii_bytes = (unsigned char *) (STR);   \
131       register unsigned char *limit = _ascii_bytes + (LENGTH);          \
132       register unsigned bytes_in_chunk = 0;                             \
133       for (; _ascii_bytes < limit; _ascii_bytes++)                      \
134         {                                                               \
135           register unsigned char *p;                                    \
136           if (bytes_in_chunk >= 64)                                     \
137             {                                                           \
138               fputc ('\n', (FILE));                                     \
139               bytes_in_chunk = 0;                                       \
140             }                                                           \
141           for (p = _ascii_bytes; p < limit && *p != '\0'; p++)          \
142             continue;                                                   \
143           if (p < limit && (p - _ascii_bytes) <= STRING_LIMIT)          \
144             {                                                           \
145               if (bytes_in_chunk > 0)                                   \
146                 {                                                       \
147                   fputc ('\n', (FILE));                                 \
148                   bytes_in_chunk = 0;                                   \
149                 }                                                       \
150               ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes);         \
151               _ascii_bytes = p;                                         \
152             }                                                           \
153           else                                                          \
154             {                                                           \
155               if (bytes_in_chunk == 0)                                  \
156                 fprintf ((FILE), "\t.byte\t");                          \
157               else                                                      \
158                 fputc (',', (FILE));                                    \
159               fprintf ((FILE), "0x%02x", *_ascii_bytes);                \
160               bytes_in_chunk += 5;                                      \
161             }                                                           \
162         }                                                               \
163       if (bytes_in_chunk > 0)                                           \
164         fprintf ((FILE), "\n");                                         \
165     }                                                                   \
166   while (0)
167
168 /* This is how to output an element of a case-vector that is relative.
169    This is only used for PIC code.  See comments by the `casesi' insn in
170    i386.md for an explanation of the expression this outputs. */
171
172 #undef ASM_OUTPUT_ADDR_DIFF_ELT
173 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
174   fprintf (FILE, "\t.long _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", LPREFIX, VALUE)
175
176 /* Indicate that jump tables go in the text section.  This is
177    necessary when compiling PIC code.  */
178
179 #define JUMP_TABLES_IN_TEXT_SECTION 1
180
181 #define LOCAL_LABEL_PREFIX      "."
182
183 /* A C statement to output something to the assembler file to switch to section
184    NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or
185    NULL_TREE.  Some target formats do not support arbitrary sections.  Do not
186    define this macro in such cases.  */
187
188 #undef  ASM_OUTPUT_SECTION_NAME
189 #define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC) \
190 do {                                                                    \
191   if ((DECL) && TREE_CODE (DECL) == FUNCTION_DECL)                      \
192     fprintf (FILE, ".section\t%s,\"ax\"\n", (NAME));                    \
193   else if ((DECL) && DECL_READONLY_SECTION (DECL, RELOC))               \
194     fprintf (FILE, ".section\t%s,\"a\"\n", (NAME));                     \
195   else                                                                  \
196     fprintf (FILE, ".section\t%s,\"aw\"\n", (NAME));                    \
197 } while (0)
198
199 /* If defined, a C expression whose value is a string containing the
200    assembler operation to identify the following data as
201    uninitialized global data.  If not defined, and neither
202    `ASM_OUTPUT_BSS' nor `ASM_OUTPUT_ALIGNED_BSS' are defined,
203    uninitialized global data will be output in the data section if
204    `-fno-common' is passed, otherwise `ASM_OUTPUT_COMMON' will be
205    used.  */
206 #undef BSS_SECTION_ASM_OP
207 #define BSS_SECTION_ASM_OP ".section\t.bss"
208
209 /* Like `ASM_OUTPUT_BSS' except takes the required alignment as a
210    separate, explicit argument.  If you define this macro, it is used
211    in place of `ASM_OUTPUT_BSS', and gives you more flexibility in
212    handling the required alignment of the variable.  The alignment is
213    specified as the number of bits.
214
215    Try to use function `asm_output_aligned_bss' defined in file
216    `varasm.c' when defining this macro. */
217 #undef ASM_OUTPUT_ALIGNED_BSS
218 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
219   asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)