]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/config/i386/djgpp.h
djgpp.h (INT_ASM_OP): Define.
[thirdparty/gcc.git] / gcc / config / i386 / djgpp.h
1 /* Configuration for an i386 running MS-DOS with DJGPP.
2 Copyright (C) 1997, 1998, 1999, 2000 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
22 #include "dbxcoff.h"
23
24 /* Don't assume anything about the header files. */
25 #define NO_IMPLICIT_EXTERN_C
26
27 #define HANDLE_SYSV_PRAGMA
28
29 /* Enable parsing of #pragma pack(push,<n>) and #pragma pack(pop). */
30 #define HANDLE_PRAGMA_PACK_PUSH_POP 1
31
32 #define YES_UNDERSCORES
33
34 #include "i386/gas.h"
35
36 /* If defined, a C expression whose value is a string containing the
37 assembler operation to identify the following data as
38 uninitialized global data. If not defined, and neither
39 `ASM_OUTPUT_BSS' nor `ASM_OUTPUT_ALIGNED_BSS' are defined,
40 uninitialized global data will be output in the data section if
41 `-fno-common' is passed, otherwise `ASM_OUTPUT_COMMON' will be
42 used. */
43 #undef BSS_SECTION_ASM_OP
44 #define BSS_SECTION_ASM_OP "\t.section\t.bss"
45
46 /* Define the name of the .ctor section. */
47 #undef CTORS_SECTION_ASM_OP
48 #define CTORS_SECTION_ASM_OP "\t.section .ctor"
49
50 /* Define the name of the .data section. */
51 #undef DATA_SECTION_ASM_OP
52 #define DATA_SECTION_ASM_OP "\t.section .data"
53
54 /* Define the name of the .dtor section. */
55 #undef DTORS_SECTION_ASM_OP
56 #define DTORS_SECTION_ASM_OP "\t.section .dtor"
57
58 /* Define the name of the .eh_frame section. */
59 #undef EH_FRAME_SECTION_ASM_OP
60 #define EH_FRAME_SECTION_ASM_OP "\t.section .eh_frame"
61
62 /* Define the name of the .ident op. */
63 #undef IDENT_ASM_OP
64 #define IDENT_ASM_OP "\t.ident"
65
66 /* Define the name of the .int op. */
67 #undef INT_ASM_OP
68 #define INT_ASM_OP "\t.long"
69
70 /* Enable alias attribute support. */
71 #ifndef SET_ASM_OP
72 #define SET_ASM_OP "\t.set"
73 #endif
74
75 /* Define the name of the .text section. */
76 #undef TEXT_SECTION_ASM_OP
77 #define TEXT_SECTION_ASM_OP "\t.section .text"
78
79 /* Search for as.exe and ld.exe in DJGPP's binary directory. */
80 #define MD_EXEC_PREFIX "$DJDIR/bin/"
81
82 /* Correctly handle absolute filename detection in cp/xref.c */
83 #define FILE_NAME_ABSOLUTE_P(NAME) \
84 (((NAME)[0] == '/') || ((NAME)[0] == '\\') || \
85 (((NAME)[0] >= 'A') && ((NAME)[0] <= 'z') && ((NAME)[1] == ':')))
86
87 #undef CPP_PREDEFINES
88 #define CPP_PREDEFINES "-DGO32 -DDJGPP=2 -D__MSDOS__ -Asystem(msdos)"
89
90 /* Include <sys/version.h> so __DJGPP__ and __DJGPP_MINOR__ are defined. */
91 #undef CPP_SPEC
92 #define CPP_SPEC "-remap %(cpp_cpu) %{posix:-D_POSIX_SOURCE} \
93 -imacros %s../include/sys/version.h"
94
95 /* We need to override link_command_spec in gcc.c so support -Tdjgpp.djl.
96 This cannot be done in LINK_SPECS as that LINK_SPECS is processed
97 before library search directories are known by the linker.
98 This avoids problems when specs file is not available. An alternate way,
99 suggested by Robert Hoehne, is to use SUBTARGET_EXTRA_SPECS instead.
100 */
101
102 #undef LINK_COMMAND_SPEC
103 #define LINK_COMMAND_SPEC \
104 "%{!fsyntax-only: \
105 %{!c:%{!M:%{!MM:%{!E:%{!S:%(linker) %l %X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} \
106 \t%{r} %{s} %{t} %{u*} %{x} %{z} %{Z}\
107 \t%{!A:%{!nostdlib:%{!nostartfiles:%S}}}\
108 \t%{static:} %{L*} %D %o\
109 \t%{!nostdlib:%{!nodefaultlibs:%G %L %G}}\
110 \t%{!A:%{!nostdlib:%{!nostartfiles:%E}}}\
111 \t-Tdjgpp.djl %{T*}}}}}}}\n\
112 %{!c:%{!M:%{!MM:%{!E:%{!S:stubify %{v} %{o*:%*} %{!o*:a.out} }}}}}"
113
114 /* Always just link in 'libc.a'. */
115 #undef LIB_SPEC
116 #define LIB_SPEC "-lc"
117
118 /* Pick the right startup code depending on the -pg flag. */
119 #undef STARTFILE_SPEC
120 #define STARTFILE_SPEC "%{pg:gcrt0.o%s}%{!pg:crt0.o%s}"
121
122 /* Make sure that gcc will not look for .h files in /usr/local/include
123 unless user explicitly requests it. */
124 #undef LOCAL_INCLUDE_DIR
125
126 #undef EXTRA_SECTIONS
127 #define EXTRA_SECTIONS in_ctor, in_dtor
128
129 #undef EXTRA_SECTION_FUNCTIONS
130 #define EXTRA_SECTION_FUNCTIONS \
131 CTOR_SECTION_FUNCTION \
132 DTOR_SECTION_FUNCTION
133
134 #define CTOR_SECTION_FUNCTION \
135 void \
136 ctor_section () \
137 { \
138 if (in_section != in_ctor) \
139 { \
140 fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \
141 in_section = in_ctor; \
142 } \
143 }
144
145 #define DTOR_SECTION_FUNCTION \
146 void \
147 dtor_section () \
148 { \
149 if (in_section != in_dtor) \
150 { \
151 fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \
152 in_section = in_dtor; \
153 } \
154 }
155
156 #define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
157 do { \
158 ctor_section (); \
159 fprintf (FILE, "%s\t", ASM_LONG); \
160 assemble_name (FILE, NAME); \
161 fprintf (FILE, "\n"); \
162 } while (0)
163
164 /* Allow (eg) __attribute__((section "locked")) to work */
165 #define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC)\
166 do { \
167 fprintf (FILE, "\t.section %s\n", NAME); \
168 } while (0)
169
170 #define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
171 do { \
172 dtor_section (); \
173 fprintf (FILE, "%s\t", ASM_LONG); \
174 assemble_name (FILE, NAME); \
175 fprintf (FILE, "\n"); \
176 } while (0)
177
178 /* Output at beginning of assembler file. */
179 /* The .file command should always begin the output. */
180
181 #undef ASM_FILE_START
182 #define ASM_FILE_START(FILE) \
183 do { \
184 output_file_directive (FILE, main_input_filename); \
185 } while (0)
186
187 /* This is how to output an assembler line
188 that says to advance the location counter
189 to a multiple of 2**LOG bytes. */
190
191 #undef ASM_OUTPUT_ALIGN
192 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
193 if ((LOG) != 0) fprintf ((FILE), "\t.p2align %d\n", LOG)
194
195 /* This is how to output a global symbol in the BSS section. */
196 #undef ASM_OUTPUT_ALIGNED_BSS
197 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
198 asm_output_aligned_bss ((FILE), (DECL), (NAME), (SIZE), (ALIGN))
199
200 /* This is how to tell assembler that a symbol is weak */
201 #undef ASM_WEAKEN_LABEL
202 #define ASM_WEAKEN_LABEL(FILE,NAME) \
203 do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \
204 fputc ('\n', FILE); } while (0)
205
206 /* djgpp automatically calls its own version of __main, so don't define one
207 in libgcc, nor call one in main(). */
208 #define HAS_INIT_SECTION
209
210 /* Definitions to set wchar_t type to 'unsigned short int' to help out
211 add-on Windows compilers for DJGPP. */
212 #define WCHAR_UNSIGNED 1
213 #define WCHAR_TYPE_SIZE 16
214 #define WCHAR_TYPE "short unsigned int"
215
216 /* Used to be defined in xm-djgpp.h, but moved here for cross-compilers. */
217 #define LIBSTDCXX "-lstdcxx"
218
219 /* Add command line option -mbnu210 to indicate we can use binutil 2.10's features. */
220 #undef MASK_BNU210
221 #define MASK_BNU210 (0x40000000)
222
223 #undef SUBTARGET_SWITCHES
224 #define SUBTARGET_SWITCHES \
225 { "bnu210", MASK_BNU210, "Enable weak symbol and enhanced C++ template support. Binutils 2.9.5.1 or higher required." }, \
226 { "no-bnu210", -MASK_BNU210, "Disable weak symbol and enhanced C++ template support." },
227
228 /* Weak symbols and .gnu.linkonce are only in the binutils snapshots
229 and binutils-2.10. So do it only when -mbnu210 is specified. */
230 #undef SUPPORTS_WEAK
231 #define SUPPORTS_WEAK (target_flags & MASK_BNU210)
232
233 #undef SUPPORTS_ONE_ONLY
234 #define SUPPORTS_ONE_ONLY (target_flags & MASK_BNU210)
235
236 /* Support for C++ templates. */
237 #undef MAKE_DECL_ONE_ONLY
238 #define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)
239
240 /* Additional support for C++ templates and support for
241 garbage collection. */
242 #undef UNIQUE_SECTION_P
243 #define UNIQUE_SECTION_P(DECL) (DECL_ONE_ONLY (DECL))
244
245 #undef UNIQUE_SECTION
246 #define UNIQUE_SECTION(DECL,RELOC) \
247 do { \
248 int len; \
249 char *name, *string, *prefix; \
250 \
251 name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (DECL)); \
252 \
253 if (! DECL_ONE_ONLY (DECL)) \
254 { \
255 if (TREE_CODE (DECL) == FUNCTION_DECL) \
256 prefix = ".text."; \
257 else if (DECL_READONLY_SECTION (DECL, RELOC)) \
258 prefix = ".rodata."; \
259 else \
260 prefix = ".data."; \
261 } \
262 else if (TREE_CODE (DECL) == FUNCTION_DECL) \
263 prefix = ".gnu.linkonce.t."; \
264 else if (DECL_READONLY_SECTION (DECL, RELOC)) \
265 prefix = ".gnu.linkonce.r."; \
266 else \
267 prefix = ".gnu.linkonce.d."; \
268 \
269 len = strlen (name) + strlen (prefix); \
270 string = alloca (len + 1); \
271 sprintf (string, "%s%s", prefix, name); \
272 \
273 DECL_SECTION_NAME (DECL) = build_string (len, string); \
274 } while (0)