OSDN Git Service

2f47573735ebac510207b037ff9dbecaf80a7ee1
[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, 2001 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, 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA.  */
22
23 /* Use stabs instead of DWARF debug format.  */
24 #undef  PREFERRED_DEBUGGING_TYPE
25 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
26
27 #undef TARGET_VERSION
28 #define TARGET_VERSION fprintf (stderr, " (i386 bare ELF target)");
29
30 /* By default, target has a 80387, uses IEEE compatible arithmetic,
31    and returns float values in the 387.  */
32
33 #define TARGET_SUBTARGET_DEFAULT (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS)
34
35 /* The ELF ABI for the i386 says that records and unions are returned
36    in memory.  */
37
38 #undef RETURN_IN_MEMORY
39 #define RETURN_IN_MEMORY(TYPE) \
40   (TYPE_MODE (TYPE) == BLKmode \
41    || (VECTOR_MODE_P (TYPE_MODE (TYPE)) && int_size_in_bytes (TYPE) == 8))
42
43 /* This used to define X86, but james@bigtex.cactus.org says that
44    is supposed to be defined optionally by user programs--not by default.  */
45 #define CPP_PREDEFINES ""
46
47 #undef CPP_SPEC
48 #define CPP_SPEC "%(cpp_cpu)"
49
50 /* This is how to output assembly code to define a `float' constant.
51    We always have to use a .long pseudo-op to do this because the native
52    SVR4 ELF assembler is buggy and it generates incorrect values when we
53    try to use the .float pseudo-op instead.  */
54
55 #undef ASM_OUTPUT_FLOAT
56 #define ASM_OUTPUT_FLOAT(FILE,VALUE)                                    \
57 do { long value;                                                        \
58      REAL_VALUE_TO_TARGET_SINGLE ((VALUE), value);                      \
59      if (sizeof (int) == sizeof (long))                                 \
60          fprintf((FILE), "%s0x%x\n", ASM_LONG, value);                  \
61      else                                                               \
62          fprintf((FILE), "%s0x%lx\n", ASM_LONG, value);                 \
63    } while (0)
64
65 /* This is how to output assembly code to define a `double' constant.
66    We always have to use a pair of .long pseudo-ops to do this because
67    the native SVR4 ELF assembler is buggy and it generates incorrect
68    values when we try to use the the .double pseudo-op instead.  */
69
70 #undef ASM_OUTPUT_DOUBLE
71 #define ASM_OUTPUT_DOUBLE(FILE,VALUE)                                   \
72 do { long value[2];                                                     \
73      REAL_VALUE_TO_TARGET_DOUBLE ((VALUE), value);                      \
74      if (sizeof (int) == sizeof (long))                                 \
75        {                                                                \
76          fprintf((FILE), "%s0x%x\n", ASM_LONG, value[0]);               \
77          fprintf((FILE), "%s0x%x\n", ASM_LONG, value[1]);               \
78        }                                                                \
79      else                                                               \
80        {                                                                \
81          fprintf((FILE), "%s0x%lx\n", ASM_LONG, value[0]);              \
82          fprintf((FILE), "%s0x%lx\n", ASM_LONG, value[1]);              \
83        }                                                                \
84    } while (0)
85
86
87 #undef ASM_OUTPUT_LONG_DOUBLE
88 #define ASM_OUTPUT_LONG_DOUBLE(FILE,VALUE)                              \
89 do { long value[3];                                                     \
90      REAL_VALUE_TO_TARGET_LONG_DOUBLE ((VALUE), value);                 \
91      if (sizeof (int) == sizeof (long))                                 \
92        {                                                                \
93          fprintf((FILE), "%s0x%x\n", ASM_LONG, value[0]);               \
94          fprintf((FILE), "%s0x%x\n", ASM_LONG, value[1]);               \
95          fprintf((FILE), "%s0x%x\n", ASM_LONG, value[2]);               \
96        }                                                                \
97      else                                                               \
98        {                                                                \
99          fprintf((FILE), "%s0x%lx\n", ASM_LONG, value[0]);              \
100          fprintf((FILE), "%s0x%lx\n", ASM_LONG, value[1]);              \
101          fprintf((FILE), "%s0x%lx\n", ASM_LONG, value[2]);              \
102        }                                                                \
103    } while (0)
104
105 #undef DBX_REGISTER_NUMBER
106 #define DBX_REGISTER_NUMBER(n) \
107   (TARGET_64BIT ? dbx64_register_map[n] : svr4_dbx_register_map[n])
108
109 /* The routine used to output sequences of byte values.  We use a special
110    version of this for most svr4 targets because doing so makes the
111    generated assembly code more compact (and thus faster to assemble)
112    as well as more readable.  Note that if we find subparts of the
113    character sequence which end with NUL (and which are shorter than
114    STRING_LIMIT) we output those using ASM_OUTPUT_LIMITED_STRING.  */
115
116 #undef ASM_OUTPUT_ASCII
117 #define ASM_OUTPUT_ASCII(FILE, STR, LENGTH)                             \
118   do                                                                    \
119     {                                                                   \
120       register const unsigned char *_ascii_bytes =                      \
121         (const unsigned char *) (STR);                                  \
122       register const unsigned char *limit = _ascii_bytes + (LENGTH);    \
123       register unsigned bytes_in_chunk = 0;                             \
124       for (; _ascii_bytes < limit; _ascii_bytes++)                      \
125         {                                                               \
126           register const unsigned char *p;                              \
127           if (bytes_in_chunk >= 64)                                     \
128             {                                                           \
129               fputc ('\n', (FILE));                                     \
130               bytes_in_chunk = 0;                                       \
131             }                                                           \
132           for (p = _ascii_bytes; p < limit && *p != '\0'; p++)          \
133             continue;                                                   \
134           if (p < limit && (p - _ascii_bytes) <= STRING_LIMIT)          \
135             {                                                           \
136               if (bytes_in_chunk > 0)                                   \
137                 {                                                       \
138                   fputc ('\n', (FILE));                                 \
139                   bytes_in_chunk = 0;                                   \
140                 }                                                       \
141               ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes);         \
142               _ascii_bytes = p;                                         \
143             }                                                           \
144           else                                                          \
145             {                                                           \
146               if (bytes_in_chunk == 0)                                  \
147                 fprintf ((FILE), "\t.byte\t");                          \
148               else                                                      \
149                 fputc (',', (FILE));                                    \
150               fprintf ((FILE), "0x%02x", *_ascii_bytes);                \
151               bytes_in_chunk += 5;                                      \
152             }                                                           \
153         }                                                               \
154       if (bytes_in_chunk > 0)                                           \
155         fprintf ((FILE), "\n");                                         \
156     }                                                                   \
157   while (0)
158
159 #define LOCAL_LABEL_PREFIX      "."
160
161 /* Switch into a generic section.  */
162 #define TARGET_ASM_NAMED_SECTION  default_elf_asm_named_section
163
164 /* If defined, a C expression whose value is a string containing the
165    assembler operation to identify the following data as
166    uninitialized global data.  If not defined, and neither
167    `ASM_OUTPUT_BSS' nor `ASM_OUTPUT_ALIGNED_BSS' are defined,
168    uninitialized global data will be output in the data section if
169    `-fno-common' is passed, otherwise `ASM_OUTPUT_COMMON' will be
170    used.  */
171 #undef BSS_SECTION_ASM_OP
172 #define BSS_SECTION_ASM_OP "\t.section\t.bss"
173
174 /* Like `ASM_OUTPUT_BSS' except takes the required alignment as a
175    separate, explicit argument.  If you define this macro, it is used
176    in place of `ASM_OUTPUT_BSS', and gives you more flexibility in
177    handling the required alignment of the variable.  The alignment is
178    specified as the number of bits.
179
180    Try to use function `asm_output_aligned_bss' defined in file
181    `varasm.c' when defining this macro. */
182 #undef ASM_OUTPUT_ALIGNED_BSS
183 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
184   asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)