OSDN Git Service

* config/i386/i386.c (ix86_expand_setcc): Don't use method 0
[pf3gnuchains/gcc-fork.git] / gcc / config / i386 / djgpp.h
1 /* Configuration for an i386 running MS-DOS with DJGPP.
2    Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
3
4 This file is part of GNU CC.
5
6 GNU CC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10
11 GNU CC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with GNU CC; see the file COPYING.  If not, write to
18 the Free Software Foundation, 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA.  */
20
21 #include "dbxcoff.h"
22
23 /* Support generation of DWARF2 debugging info.  */
24 #define DWARF2_DEBUGGING_INFO
25
26 /* Don't assume anything about the header files. */
27 #define NO_IMPLICIT_EXTERN_C
28
29 #define HANDLE_SYSV_PRAGMA
30
31 /* Enable parsing of #pragma pack(push,<n>) and #pragma pack(pop).  */
32 #define HANDLE_PRAGMA_PACK_PUSH_POP 1
33
34 #define YES_UNDERSCORES
35
36 #include "i386/gas.h"
37
38 /* If defined, a C expression whose value is a string containing the
39    assembler operation to identify the following data as
40    uninitialized global data.  If not defined, and neither
41    `ASM_OUTPUT_BSS' nor `ASM_OUTPUT_ALIGNED_BSS' are defined,
42    uninitialized global data will be output in the data section if
43    `-fno-common' is passed, otherwise `ASM_OUTPUT_COMMON' will be
44    used.  */
45 #undef BSS_SECTION_ASM_OP
46 #define BSS_SECTION_ASM_OP "\t.section\t.bss"
47
48 /* Define the name of the .ctor section.  */
49 #undef CTORS_SECTION_ASM_OP
50 #define CTORS_SECTION_ASM_OP "\t.section .ctor"
51
52 /* Define the name of the .data section.  */
53 #undef DATA_SECTION_ASM_OP
54 #define DATA_SECTION_ASM_OP "\t.section .data"
55
56 /* Define the name of the .dtor section.  */
57 #undef DTORS_SECTION_ASM_OP
58 #define DTORS_SECTION_ASM_OP "\t.section .dtor"
59
60 /* Define the name of the .eh_frame section.  */
61 #undef EH_FRAME_SECTION_ASM_OP
62 #define EH_FRAME_SECTION_ASM_OP "\t.section .eh_frame"
63
64 /* Define the name of the .ident op.  */
65 #undef IDENT_ASM_OP
66 #define IDENT_ASM_OP "\t.ident\t"
67
68 /* Define the name of the .int op.  */
69 #undef INT_ASM_OP
70 #define INT_ASM_OP "\t.long\t"
71
72 /* Enable alias attribute support.  */
73 #ifndef SET_ASM_OP
74 #define SET_ASM_OP "\t.set\t"
75 #endif
76
77 /* Define the name of the .text section.  */
78 #undef TEXT_SECTION_ASM_OP
79 #define TEXT_SECTION_ASM_OP "\t.section .text"
80
81 /* How to output an unaligned integer.  */
82 #undef UNALIGNED_INT_ASM_OP
83 #define UNALIGNED_INT_ASM_OP "\t.long\t"
84
85 /* How to output an unaligned double length integer.  */
86 #undef UNALIGNED_DOUBLE_INT_ASM_OP
87 #define UNALIGNED_DOUBLE_INT_ASM_OP "\t.quad\t"
88
89 /* How to output an unaligned half length intenger.  */
90 #undef UNALIGNED_SHORT_ASM_OP
91 #define UNALIGNED_SHORT_ASM_OP "\t.short\t"
92
93 /* Define standard DJGPP installation paths.                             */
94 /* We override default /usr or /usr/local part with /dev/env/DJDIR which */
95 /* points to actual DJGPP instalation directory.                         */
96
97 /* Standard include directory */
98 #undef STANDARD_INCLUDE_DIR
99 #define STANDARD_INCLUDE_DIR "/dev/env/DJDIR/include/"
100
101 /* Search for as.exe and ld.exe in DJGPP's binary directory. */ 
102 #undef MD_EXEC_PREFIX
103 #define MD_EXEC_PREFIX "/dev/env/DJDIR/bin/"
104
105 /* Standard DJGPP library and startup files */
106 #undef MD_STARTFILE_PREFIX
107 #define MD_STARTFILE_PREFIX "/dev/env/DJDIR/lib/"
108
109 /* Correctly handle absolute filename detection in cp/xref.c */
110 #define FILE_NAME_ABSOLUTE_P(NAME) \
111         (((NAME)[0] == '/') || ((NAME)[0] == '\\') || \
112         (((NAME)[0] >= 'A') && ((NAME)[0] <= 'z') && ((NAME)[1] == ':')))
113
114 #undef CPP_PREDEFINES
115 #define CPP_PREDEFINES "-D__MSDOS__ -D__GO32__ -Asystem=msdos"
116
117 /* Include <sys/version.h> so __DJGPP__ and __DJGPP_MINOR__ are defined.  */
118 #undef CPP_SPEC
119 #define CPP_SPEC "-remap %(cpp_cpu) %{posix:-D_POSIX_SOURCE} \
120   %{!ansi:%{!std=c*:%{!std=i*:-DMSDOS}}} %{!ansi:%{!std=c*:%{!std=i*:-DGO32}}} \
121   -imacros %s../include/sys/version.h"
122
123 /* We need to override link_command_spec in gcc.c so support -Tdjgpp.djl.
124    This cannot be done in LINK_SPECS as that LINK_SPECS is processed
125    before library search directories are known by the linker.
126    This avoids problems when specs file is not available. An alternate way,
127    suggested by Robert Hoehne, is to use SUBTARGET_EXTRA_SPECS instead.
128 */ 
129
130 #undef LINK_COMMAND_SPEC
131 #define LINK_COMMAND_SPEC \
132 "%{!fsyntax-only: \
133 %{!c:%{!M:%{!MM:%{!E:%{!S:%(linker) %l %X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} \
134 \t%{r} %{s} %{t} %{u*} %{x} %{z} %{Z}\
135 \t%{!A:%{!nostdlib:%{!nostartfiles:%S}}}\
136 \t%{static:} %{L*} %D %o\
137 \t%{!nostdlib:%{!nodefaultlibs:%G %L %G}}\
138 \t%{!A:%{!nostdlib:%{!nostartfiles:%E}}}\
139 \t-Tdjgpp.djl %{T*}}}}}}}\n\
140 %{!c:%{!M:%{!MM:%{!E:%{!S:stubify %{v} %{o*:%*} %{!o*:a.out} }}}}}"
141
142 /* Always just link in 'libc.a'.  */
143 #undef LIB_SPEC
144 #define LIB_SPEC "-lc"
145
146 /* Pick the right startup code depending on the -pg flag.  */
147 #undef STARTFILE_SPEC
148 #define STARTFILE_SPEC "%{pg:gcrt0.o%s}%{!pg:crt0.o%s}"
149
150 /* Make sure that gcc will not look for .h files in /usr/local/include 
151    unless user explicitly requests it.  */
152 #undef LOCAL_INCLUDE_DIR
153
154 #undef EXTRA_SECTIONS
155 #define EXTRA_SECTIONS in_ctor, in_dtor
156
157 #undef EXTRA_SECTION_FUNCTIONS
158 #define EXTRA_SECTION_FUNCTIONS                                 \
159   CTOR_SECTION_FUNCTION                                         \
160   DTOR_SECTION_FUNCTION
161
162 #define CTOR_SECTION_FUNCTION                                   \
163 void                                                            \
164 ctor_section ()                                                 \
165 {                                                               \
166   if (in_section != in_ctor)                                    \
167     {                                                           \
168       fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP);     \
169       in_section = in_ctor;                                     \
170     }                                                           \
171 }
172
173 #define DTOR_SECTION_FUNCTION                                   \
174 void                                                            \
175 dtor_section ()                                                 \
176 {                                                               \
177   if (in_section != in_dtor)                                    \
178     {                                                           \
179       fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP);     \
180       in_section = in_dtor;                                     \
181     }                                                           \
182 }
183
184 #define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME)       \
185   do {                                          \
186     ctor_section ();                            \
187     fputs (ASM_LONG, FILE);                     \
188     assemble_name (FILE, NAME);                 \
189     fprintf (FILE, "\n");                       \
190   } while (0)
191
192 /* Tell GCC how to output a section name. Add "x" for code sections.  */
193 #define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC)\
194   do {                                                                  \
195     if ((DECL) && TREE_CODE (DECL) == FUNCTION_DECL)                    \
196       fprintf ((FILE), "\t.section %s,\"x\"\n", (NAME));                \
197     else                                                                \
198       fprintf ((FILE), "\t.section %s\n", (NAME));                      \
199   } while (0)
200
201 #define ASM_OUTPUT_DESTRUCTOR(FILE,NAME)        \
202   do {                                          \
203     dtor_section ();                            \
204     fputs (ASM_LONG, FILE);                     \
205     assemble_name (FILE, NAME);                 \
206     fprintf (FILE, "\n");                       \
207   } while (0)
208
209 /* Output at beginning of assembler file.  */
210 /* The .file command should always begin the output.  */
211
212 #undef ASM_FILE_START
213 #define ASM_FILE_START(FILE)                                            \
214   do {                                                                  \
215         output_file_directive (FILE, main_input_filename);              \
216   } while (0)
217
218 /* This is how to output an assembler line
219    that says to advance the location counter
220    to a multiple of 2**LOG bytes.  */
221
222 #undef ASM_OUTPUT_ALIGN
223 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
224   if ((LOG) != 0) fprintf ((FILE), "\t.p2align %d\n", LOG)
225
226 /* This is how to output a global symbol in the BSS section.  */
227 #undef ASM_OUTPUT_ALIGNED_BSS
228 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
229   asm_output_aligned_bss ((FILE), (DECL), (NAME), (SIZE), (ALIGN))
230
231 /* This is how to tell assembler that a symbol is weak  */ 
232 #undef ASM_WEAKEN_LABEL
233 #define ASM_WEAKEN_LABEL(FILE,NAME) \
234   do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \
235        fputc ('\n', FILE); } while (0)
236
237 /* djgpp automatically calls its own version of __main, so don't define one
238    in libgcc, nor call one in main().  */
239 #define HAS_INIT_SECTION
240
241 /* Definitions for types and sizes. Wide characters are 16-bits long so
242    Win32 compiler add-ons will be wide character compatible.  */
243 #undef WCHAR_UNSIGNED
244 #define WCHAR_UNSIGNED 1
245
246 #undef WCHAR_TYPE_SIZE
247 #define WCHAR_TYPE_SIZE 16
248
249 #undef WCHAR_TYPE
250 #define WCHAR_TYPE "short unsigned int"
251
252 #undef WINT_TYPE
253 #define WINT_TYPE "int"
254
255 #undef SIZE_TYPE
256 #define SIZE_TYPE "long unsigned int"
257
258 #undef PTRDIFF_TYPE
259 #define PTRDIFF_TYPE "int"
260
261 /* Used to be defined in xm-djgpp.h, but moved here for cross-compilers.  */
262 #define LIBSTDCXX "-lstdcxx"
263
264 /* -mbnu210 is now ignored and obsolete. It was used to enable support for
265    weak symbols, and .gnu.linkonce support.  */
266 #undef MASK_BNU210
267 #define MASK_BNU210 (0x40000000)
268
269 #undef SUBTARGET_SWITCHES
270 #define SUBTARGET_SWITCHES \
271   { "no-bnu210", -MASK_BNU210, "Ignored (obsolete)." }, \
272   { "bnu210", MASK_BNU210, "Ignored (obsolete)." },
273
274 /* Warn that -mbnu210 is now obsolete.  */
275 #undef  SUBTARGET_OVERRIDE_OPTIONS
276 #define SUBTARGET_OVERRIDE_OPTIONS \
277 do \
278   { \
279     if (target_flags & MASK_BNU210) \
280       { \
281         warning ("-mbnu210 is ignored (option is obsolete)."); \
282       } \
283   } \
284 while (0)
285
286 /* Support for C++ templates.  */
287 #undef MAKE_DECL_ONE_ONLY
288 #define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)
289
290 /* Additional support for C++ templates and support for
291    garbage collection.  */
292 #undef UNIQUE_SECTION_P
293 #define UNIQUE_SECTION_P(DECL) (DECL_ONE_ONLY (DECL))
294
295 #undef UNIQUE_SECTION
296 #define UNIQUE_SECTION(DECL,RELOC)                              \
297 do {                                                            \
298   int len;                                                      \
299   const char *name, *prefix;                                    \
300   char *string;                                                 \
301                                                                 \
302   name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (DECL));       \
303                                                                 \
304   if (! DECL_ONE_ONLY (DECL))                                   \
305     {                                                           \
306       if (TREE_CODE (DECL) == FUNCTION_DECL)                    \
307         prefix = ".text.";                                      \
308       else if (DECL_READONLY_SECTION (DECL, RELOC))             \
309         prefix = ".rodata.";                                    \
310       else                                                      \
311         prefix = ".data.";                                      \
312     }                                                           \
313   else if (TREE_CODE (DECL) == FUNCTION_DECL)                   \
314     prefix = ".gnu.linkonce.t.";                                \
315   else if (DECL_READONLY_SECTION (DECL, RELOC))                 \
316     prefix = ".gnu.linkonce.r.";                                \
317   else                                                          \
318     prefix = ".gnu.linkonce.d.";                                \
319                                                                 \
320   len = strlen (name) + strlen (prefix);                        \
321   string = alloca (len + 1);                                    \
322   sprintf (string, "%s%s", prefix, name);                       \
323                                                                 \
324   DECL_SECTION_NAME (DECL) = build_string (len, string);        \
325 } while (0)