OSDN Git Service

cc4aa5c765bd2c439cd350f8c647a50f4e6b18d0
[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 .data section.  */
49 #undef DATA_SECTION_ASM_OP
50 #define DATA_SECTION_ASM_OP "\t.section .data"
51
52 /* Define the name of the .ident op.  */
53 #undef IDENT_ASM_OP
54 #define IDENT_ASM_OP "\t.ident\t"
55
56 /* Enable alias attribute support.  */
57 #ifndef SET_ASM_OP
58 #define SET_ASM_OP "\t.set\t"
59 #endif
60
61 /* Define the name of the .text section.  */
62 #undef TEXT_SECTION_ASM_OP
63 #define TEXT_SECTION_ASM_OP "\t.section .text"
64
65 /* How to output an unaligned integer.  */
66 #undef UNALIGNED_INT_ASM_OP
67 #define UNALIGNED_INT_ASM_OP "\t.long\t"
68
69 /* How to output an unaligned double length integer.  */
70 #undef UNALIGNED_DOUBLE_INT_ASM_OP
71 #define UNALIGNED_DOUBLE_INT_ASM_OP "\t.quad\t"
72
73 /* How to output an unaligned half length intenger.  */
74 #undef UNALIGNED_SHORT_ASM_OP
75 #define UNALIGNED_SHORT_ASM_OP "\t.short\t"
76
77 /* Define standard DJGPP installation paths.                             */
78 /* We override default /usr or /usr/local part with /dev/env/DJDIR which */
79 /* points to actual DJGPP instalation directory.                         */
80
81 /* Standard include directory */
82 #undef STANDARD_INCLUDE_DIR
83 #define STANDARD_INCLUDE_DIR "/dev/env/DJDIR/include/"
84
85 /* Search for as.exe and ld.exe in DJGPP's binary directory.  */ 
86 #undef MD_EXEC_PREFIX
87 #define MD_EXEC_PREFIX "/dev/env/DJDIR/bin/"
88
89 /* Standard DJGPP library and startup files */
90 #undef MD_STARTFILE_PREFIX
91 #define MD_STARTFILE_PREFIX "/dev/env/DJDIR/lib/"
92
93 /* Correctly handle absolute filename detection in cp/xref.c */
94 #define FILE_NAME_ABSOLUTE_P(NAME) \
95         (((NAME)[0] == '/') || ((NAME)[0] == '\\') || \
96         (((NAME)[0] >= 'A') && ((NAME)[0] <= 'z') && ((NAME)[1] == ':')))
97
98 #undef CPP_PREDEFINES
99 #define CPP_PREDEFINES "-D__MSDOS__ -D__GO32__ -Asystem=msdos"
100
101 /* Include <sys/version.h> so __DJGPP__ and __DJGPP_MINOR__ are defined.  */
102 #undef CPP_SPEC
103 #define CPP_SPEC "-remap %(cpp_cpu) %{posix:-D_POSIX_SOURCE} \
104   %{!ansi:%{!std=c*:%{!std=i*:-DMSDOS}}} %{!ansi:%{!std=c*:%{!std=i*:-DGO32}}} \
105   -imacros %s../include/sys/version.h"
106
107 /* We need to override link_command_spec in gcc.c so support -Tdjgpp.djl.
108    This cannot be done in LINK_SPECS as that LINK_SPECS is processed
109    before library search directories are known by the linker.
110    This avoids problems when specs file is not available. An alternate way,
111    suggested by Robert Hoehne, is to use SUBTARGET_EXTRA_SPECS instead.
112 */ 
113
114 #undef LINK_COMMAND_SPEC
115 #define LINK_COMMAND_SPEC \
116 "%{!fsyntax-only: \
117 %{!c:%{!M:%{!MM:%{!E:%{!S:%(linker) %l %X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} \
118 \t%{r} %{s} %{t} %{u*} %{x} %{z} %{Z}\
119 \t%{!A:%{!nostdlib:%{!nostartfiles:%S}}}\
120 \t%{static:} %{L*} %D %o\
121 \t%{!nostdlib:%{!nodefaultlibs:%G %L %G}}\
122 \t%{!A:%{!nostdlib:%{!nostartfiles:%E}}}\
123 \t-Tdjgpp.djl %{T*}}}}}}}\n\
124 %{!c:%{!M:%{!MM:%{!E:%{!S:stubify %{v} %{o*:%*} %{!o*:a.out} }}}}}"
125
126 /* Always just link in 'libc.a'.  */
127 #undef LIB_SPEC
128 #define LIB_SPEC "-lc"
129
130 /* Pick the right startup code depending on the -pg flag.  */
131 #undef STARTFILE_SPEC
132 #define STARTFILE_SPEC "%{pg:gcrt0.o%s}%{!pg:crt0.o%s}"
133
134 /* Make sure that gcc will not look for .h files in /usr/local/include 
135    unless user explicitly requests it.  */
136 #undef LOCAL_INCLUDE_DIR
137
138 /* Switch into a generic section.  */
139 #define TARGET_ASM_NAMED_SECTION  default_coff_asm_named_section
140
141 /* Output at beginning of assembler file.  */
142 /* The .file command should always begin the output.  */
143
144 #undef ASM_FILE_START
145 #define ASM_FILE_START(FILE)                                            \
146   do {                                                                  \
147         output_file_directive (FILE, main_input_filename);              \
148   } while (0)
149
150 /* This is how to output an assembler line
151    that says to advance the location counter
152    to a multiple of 2**LOG bytes.  */
153
154 #undef ASM_OUTPUT_ALIGN
155 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
156   if ((LOG) != 0) fprintf ((FILE), "\t.p2align %d\n", LOG)
157
158 /* This is how to output a global symbol in the BSS section.  */
159 #undef ASM_OUTPUT_ALIGNED_BSS
160 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
161   asm_output_aligned_bss ((FILE), (DECL), (NAME), (SIZE), (ALIGN))
162
163 /* This is how to tell assembler that a symbol is weak  */ 
164 #undef ASM_WEAKEN_LABEL
165 #define ASM_WEAKEN_LABEL(FILE,NAME) \
166   do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \
167        fputc ('\n', FILE); } while (0)
168
169 /* djgpp automatically calls its own version of __main, so don't define one
170    in libgcc, nor call one in main().  */
171 #define HAS_INIT_SECTION
172
173 /* Definitions for types and sizes. Wide characters are 16-bits long so
174    Win32 compiler add-ons will be wide character compatible.  */
175 #undef WCHAR_UNSIGNED
176 #define WCHAR_UNSIGNED 1
177
178 #undef WCHAR_TYPE_SIZE
179 #define WCHAR_TYPE_SIZE 16
180
181 #undef WCHAR_TYPE
182 #define WCHAR_TYPE "short unsigned int"
183
184 #undef WINT_TYPE
185 #define WINT_TYPE "int"
186
187 #undef SIZE_TYPE
188 #define SIZE_TYPE "long unsigned int"
189
190 #undef PTRDIFF_TYPE
191 #define PTRDIFF_TYPE "int"
192
193 /* Used to be defined in xm-djgpp.h, but moved here for cross-compilers.  */
194 #define LIBSTDCXX "-lstdcxx"
195
196 /* -mbnu210 is now ignored and obsolete. It was used to enable support for
197    weak symbols, and .gnu.linkonce support.  */
198 #undef MASK_BNU210
199 #define MASK_BNU210 (0x40000000)
200
201 #undef SUBTARGET_SWITCHES
202 #define SUBTARGET_SWITCHES \
203   { "no-bnu210", -MASK_BNU210, "Ignored (obsolete)" }, \
204   { "bnu210", MASK_BNU210, "Ignored (obsolete)" },
205
206 /* Warn that -mbnu210 is now obsolete.  */
207 #undef  SUBTARGET_OVERRIDE_OPTIONS
208 #define SUBTARGET_OVERRIDE_OPTIONS \
209 do \
210   { \
211     if (target_flags & MASK_BNU210) \
212       { \
213         warning ("-mbnu210 is ignored (option is obsolete)"); \
214       } \
215   } \
216 while (0)
217
218 /* Support for C++ templates.  */
219 #undef MAKE_DECL_ONE_ONLY
220 #define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)
221
222 #undef UNIQUE_SECTION
223 #define UNIQUE_SECTION(DECL,RELOC)                              \
224 do {                                                            \
225   int len;                                                      \
226   const char *name, *prefix;                                    \
227   char *string;                                                 \
228                                                                 \
229   name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (DECL));       \
230                                                                 \
231   if (! DECL_ONE_ONLY (DECL))                                   \
232     {                                                           \
233       if (TREE_CODE (DECL) == FUNCTION_DECL)                    \
234         prefix = ".text.";                                      \
235       else if (DECL_READONLY_SECTION (DECL, RELOC))             \
236         prefix = ".rodata.";                                    \
237       else                                                      \
238         prefix = ".data.";                                      \
239     }                                                           \
240   else if (TREE_CODE (DECL) == FUNCTION_DECL)                   \
241     prefix = ".gnu.linkonce.t.";                                \
242   else if (DECL_READONLY_SECTION (DECL, RELOC))                 \
243     prefix = ".gnu.linkonce.r.";                                \
244   else                                                          \
245     prefix = ".gnu.linkonce.d.";                                \
246                                                                 \
247   len = strlen (name) + strlen (prefix);                        \
248   string = alloca (len + 1);                                    \
249   sprintf (string, "%s%s", prefix, name);                       \
250                                                                 \
251   DECL_SECTION_NAME (DECL) = build_string (len, string);        \
252 } while (0)