1 |
282 |
jeremybenn |
/* Operating system specific defines to be used when targeting GCC for
|
2 |
|
|
hosting on Windows32, using GNU tools and the Windows32 API Library.
|
3 |
|
|
Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2007, 2008,
|
4 |
|
|
2009, 2010 Free Software Foundation, Inc.
|
5 |
|
|
|
6 |
|
|
This file is part of GCC.
|
7 |
|
|
|
8 |
|
|
GCC 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 3, or (at your option)
|
11 |
|
|
any later version.
|
12 |
|
|
|
13 |
|
|
GCC 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 GCC; see the file COPYING3. If not see
|
20 |
|
|
<http://www.gnu.org/licenses/>. */
|
21 |
|
|
|
22 |
|
|
#undef TARGET_VERSION
|
23 |
|
|
#if TARGET_64BIT_DEFAULT
|
24 |
|
|
#define TARGET_VERSION fprintf (stderr,"(x86_64 MinGW");
|
25 |
|
|
#else
|
26 |
|
|
#define TARGET_VERSION fprintf (stderr," (x86 MinGW)");
|
27 |
|
|
#endif
|
28 |
|
|
|
29 |
|
|
/* See i386/crtdll.h for an alternative definition. _INTEGRAL_MAX_BITS
|
30 |
|
|
is for compatibility with native compiler. */
|
31 |
|
|
#define EXTRA_OS_CPP_BUILTINS() \
|
32 |
|
|
do \
|
33 |
|
|
{ \
|
34 |
|
|
builtin_define ("__MSVCRT__"); \
|
35 |
|
|
builtin_define ("__MINGW32__"); \
|
36 |
|
|
builtin_define ("_WIN32"); \
|
37 |
|
|
builtin_define_std ("WIN32"); \
|
38 |
|
|
builtin_define_std ("WINNT"); \
|
39 |
|
|
builtin_define_with_int_value ("_INTEGRAL_MAX_BITS", \
|
40 |
|
|
TYPE_PRECISION (intmax_type_node));\
|
41 |
|
|
if (TARGET_64BIT && ix86_abi == MS_ABI) \
|
42 |
|
|
{ \
|
43 |
|
|
builtin_define ("__MINGW64__"); \
|
44 |
|
|
builtin_define_std ("WIN64"); \
|
45 |
|
|
builtin_define_std ("_WIN64"); \
|
46 |
|
|
} \
|
47 |
|
|
} \
|
48 |
|
|
while (0)
|
49 |
|
|
|
50 |
|
|
#undef SUB_LINK_ENTRY32
|
51 |
|
|
#undef SUB_LINK_ENTRY64
|
52 |
|
|
#define SUB_LINK_ENTRY32 "-e _DllMainCRTStartup@12"
|
53 |
|
|
#if defined(USE_MINGW64_LEADING_UNDERSCORES)
|
54 |
|
|
#define SUB_LINK_ENTRY64 "-e _DllMainCRTStartup"
|
55 |
|
|
#else
|
56 |
|
|
#define SUB_LINK_ENTRY64 "-e DllMainCRTStartup"
|
57 |
|
|
#endif
|
58 |
|
|
|
59 |
|
|
#undef SUB_LINK_ENTRY
|
60 |
|
|
#if TARGET_64BIT_DEFAULT
|
61 |
|
|
#define SUB_LINK_ENTRY SUB_LINK_ENTRY64
|
62 |
|
|
#else
|
63 |
|
|
#define SUB_LINK_ENTRY SUB_LINK_ENTRY32
|
64 |
|
|
#endif
|
65 |
|
|
|
66 |
|
|
/* Override the standard choice of /usr/include as the default prefix
|
67 |
|
|
to try when searching for header files. */
|
68 |
|
|
#undef STANDARD_INCLUDE_DIR
|
69 |
|
|
#define STANDARD_INCLUDE_DIR "/mingw/include"
|
70 |
|
|
#undef STANDARD_INCLUDE_COMPONENT
|
71 |
|
|
#define STANDARD_INCLUDE_COMPONENT "MINGW"
|
72 |
|
|
|
73 |
|
|
#undef CPP_SPEC
|
74 |
|
|
#define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{mthreads:-D_MT}"
|
75 |
|
|
|
76 |
|
|
/* For Windows applications, include more libraries, but always include
|
77 |
|
|
kernel32. */
|
78 |
|
|
#undef LIB_SPEC
|
79 |
|
|
#define LIB_SPEC "%{pg:-lgmon} %{mwindows:-lgdi32 -lcomdlg32} \
|
80 |
|
|
-luser32 -lkernel32 -ladvapi32 -lshell32"
|
81 |
|
|
|
82 |
|
|
/* Weak symbols do not get resolved if using a Windows dll import lib.
|
83 |
|
|
Make the unwind registration references strong undefs. */
|
84 |
|
|
#if DWARF2_UNWIND_INFO
|
85 |
|
|
/* DW2-unwind is just available for 32-bit mode. */
|
86 |
|
|
#if TARGET_64BIT_DEFAULT
|
87 |
|
|
#error DW2 unwind is not available for 64-bit.
|
88 |
|
|
#endif
|
89 |
|
|
#define SHARED_LIBGCC_UNDEFS_SPEC \
|
90 |
|
|
"%{shared-libgcc: -u ___register_frame_info -u ___deregister_frame_info}"
|
91 |
|
|
#else
|
92 |
|
|
#define SHARED_LIBGCC_UNDEFS_SPEC ""
|
93 |
|
|
#endif
|
94 |
|
|
|
95 |
|
|
#undef SUBTARGET_EXTRA_SPECS
|
96 |
|
|
#define SUBTARGET_EXTRA_SPECS \
|
97 |
|
|
{ "shared_libgcc_undefs", SHARED_LIBGCC_UNDEFS_SPEC }
|
98 |
|
|
|
99 |
|
|
#define LINK_SPEC "%{mwindows:--subsystem windows} \
|
100 |
|
|
%{mconsole:--subsystem console} \
|
101 |
|
|
%{shared: %{mdll: %eshared and mdll are not compatible}} \
|
102 |
|
|
%{shared: --shared} %{mdll:--dll} \
|
103 |
|
|
%{static:-Bstatic} %{!static:-Bdynamic} \
|
104 |
|
|
%{shared|mdll: " SUB_LINK_ENTRY " --enable-auto-image-base} \
|
105 |
|
|
%(shared_libgcc_undefs)"
|
106 |
|
|
|
107 |
|
|
/* Include in the mingw32 libraries with libgcc */
|
108 |
|
|
#ifdef ENABLE_SHARED_LIBGCC
|
109 |
|
|
#define SHARED_LIBGCC_SPEC "%{shared-libgcc:-lgcc_s} %{!shared-libgcc:-lgcc_eh}"
|
110 |
|
|
#else
|
111 |
|
|
#define SHARED_LIBGCC_SPEC /*empty*/
|
112 |
|
|
#endif
|
113 |
|
|
#undef REAL_LIBGCC_SPEC
|
114 |
|
|
#define REAL_LIBGCC_SPEC \
|
115 |
|
|
"%{mthreads:-lmingwthrd} -lmingw32 \
|
116 |
|
|
"SHARED_LIBGCC_SPEC" \
|
117 |
|
|
-lgcc \
|
118 |
|
|
-lmoldname -lmingwex -lmsvcrt"
|
119 |
|
|
|
120 |
|
|
#undef STARTFILE_SPEC
|
121 |
|
|
#define STARTFILE_SPEC "%{shared|mdll:dllcrt2%O%s} \
|
122 |
|
|
%{!shared:%{!mdll:crt2%O%s}} %{pg:gcrt2%O%s} \
|
123 |
|
|
crtbegin.o%s"
|
124 |
|
|
|
125 |
|
|
#undef ENDFILE_SPEC
|
126 |
|
|
#define ENDFILE_SPEC \
|
127 |
|
|
"%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
|
128 |
|
|
crtend.o%s"
|
129 |
|
|
|
130 |
|
|
/* Override startfile prefix defaults. */
|
131 |
|
|
#ifndef STANDARD_STARTFILE_PREFIX_1
|
132 |
|
|
#define STANDARD_STARTFILE_PREFIX_1 "/mingw/lib/"
|
133 |
|
|
#endif
|
134 |
|
|
#ifndef STANDARD_STARTFILE_PREFIX_2
|
135 |
|
|
#define STANDARD_STARTFILE_PREFIX_2 ""
|
136 |
|
|
#endif
|
137 |
|
|
|
138 |
|
|
/* Put all *tf routines in libgcc. */
|
139 |
|
|
#undef LIBGCC2_HAS_TF_MODE
|
140 |
|
|
#define LIBGCC2_HAS_TF_MODE 1
|
141 |
|
|
#undef LIBGCC2_TF_CEXT
|
142 |
|
|
#define LIBGCC2_TF_CEXT q
|
143 |
|
|
#undef TF_SIZE
|
144 |
|
|
#define TF_SIZE 113
|
145 |
|
|
|
146 |
|
|
/* Output STRING, a string representing a filename, to FILE.
|
147 |
|
|
We canonicalize it to be in Unix format (backslashes are replaced
|
148 |
|
|
forward slashes. */
|
149 |
|
|
#undef OUTPUT_QUOTED_STRING
|
150 |
|
|
#define OUTPUT_QUOTED_STRING(FILE, STRING) \
|
151 |
|
|
do { \
|
152 |
|
|
char c; \
|
153 |
|
|
\
|
154 |
|
|
putc ('\"', asm_file); \
|
155 |
|
|
\
|
156 |
|
|
while ((c = *string++) != 0) \
|
157 |
|
|
{ \
|
158 |
|
|
if (c == '\\') \
|
159 |
|
|
c = '/'; \
|
160 |
|
|
\
|
161 |
|
|
if (ISPRINT (c)) \
|
162 |
|
|
{ \
|
163 |
|
|
if (c == '\"') \
|
164 |
|
|
putc ('\\', asm_file); \
|
165 |
|
|
putc (c, asm_file); \
|
166 |
|
|
} \
|
167 |
|
|
else \
|
168 |
|
|
fprintf (asm_file, "\\%03o", (unsigned char) c); \
|
169 |
|
|
} \
|
170 |
|
|
\
|
171 |
|
|
putc ('\"', asm_file); \
|
172 |
|
|
} while (0)
|
173 |
|
|
|
174 |
|
|
/* Define as short unsigned for compatibility with MS runtime. */
|
175 |
|
|
#undef WINT_TYPE
|
176 |
|
|
#define WINT_TYPE "short unsigned int"
|
177 |
|
|
|
178 |
|
|
/* mingw32 uses the -mthreads option to enable thread support. */
|
179 |
|
|
#undef GOMP_SELF_SPECS
|
180 |
|
|
#define GOMP_SELF_SPECS "%{fopenmp: -mthreads}"
|
181 |
|
|
|
182 |
|
|
/* mingw32 atexit function is safe to use in shared libraries. Use it
|
183 |
|
|
to register C++ static destructors. */
|
184 |
|
|
#define TARGET_CXX_USE_ATEXIT_FOR_CXA_ATEXIT hook_bool_void_true
|
185 |
|
|
|
186 |
|
|
/* Contains a pointer to type target_ovr_attr defining the target specific
|
187 |
|
|
overrides of format attributes. See c-format.h for structure
|
188 |
|
|
definition. */
|
189 |
|
|
#undef TARGET_OVERRIDES_FORMAT_ATTRIBUTES
|
190 |
|
|
#define TARGET_OVERRIDES_FORMAT_ATTRIBUTES mingw_format_attribute_overrides
|
191 |
|
|
|
192 |
|
|
/* Specify the count of elements in TARGET_OVERRIDES_ATTRIBUTE. */
|
193 |
|
|
#undef TARGET_OVERRIDES_FORMAT_ATTRIBUTES_COUNT
|
194 |
|
|
#define TARGET_OVERRIDES_FORMAT_ATTRIBUTES_COUNT 3
|
195 |
|
|
|
196 |
|
|
/* Custom initialization for warning -Wpedantic-ms-format for c-format. */
|
197 |
|
|
#undef TARGET_OVERRIDES_FORMAT_INIT
|
198 |
|
|
#define TARGET_OVERRIDES_FORMAT_INIT msformat_init
|
199 |
|
|
|
200 |
|
|
/* MS specific format attributes for ms_printf, ms_scanf, ms_strftime. */
|
201 |
|
|
#undef TARGET_FORMAT_TYPES
|
202 |
|
|
#define TARGET_FORMAT_TYPES mingw_format_attributes
|
203 |
|
|
|
204 |
|
|
#undef TARGET_N_FORMAT_TYPES
|
205 |
|
|
#define TARGET_N_FORMAT_TYPES 3
|
206 |
|
|
|
207 |
|
|
/* Let defaults.h definition of TARGET_USE_JCR_SECTION apply. */
|
208 |
|
|
#undef TARGET_USE_JCR_SECTION
|
209 |
|
|
|
210 |
|
|
#undef MINGW_ENABLE_EXECUTE_STACK
|
211 |
|
|
#define MINGW_ENABLE_EXECUTE_STACK \
|
212 |
|
|
extern void __enable_execute_stack (void *); \
|
213 |
|
|
void \
|
214 |
|
|
__enable_execute_stack (void *addr) \
|
215 |
|
|
{ \
|
216 |
|
|
MEMORY_BASIC_INFORMATION b; \
|
217 |
|
|
if (!VirtualQuery (addr, &b, sizeof(b))) \
|
218 |
|
|
abort (); \
|
219 |
|
|
VirtualProtect (b.BaseAddress, b.RegionSize, PAGE_EXECUTE_READWRITE, \
|
220 |
|
|
&b.Protect); \
|
221 |
|
|
}
|
222 |
|
|
|
223 |
|
|
#undef ENABLE_EXECUTE_STACK
|
224 |
|
|
#define ENABLE_EXECUTE_STACK MINGW_ENABLE_EXECUTE_STACK
|
225 |
|
|
#undef CHECK_EXECUTE_STACK_ENABLED
|
226 |
|
|
#define CHECK_EXECUTE_STACK_ENABLED flag_setstackexecutable
|
227 |
|
|
|
228 |
|
|
#ifdef IN_LIBGCC2
|
229 |
|
|
#include <windows.h>
|
230 |
|
|
#endif
|
231 |
|
|
|
232 |
|
|
/* For 64-bit Windows we can't use DW2 unwind info. Also for multilib
|
233 |
|
|
builds we can't use it, too. */
|
234 |
|
|
#if !TARGET_64BIT && !defined (TARGET_BI_ARCH)
|
235 |
|
|
#define MD_UNWIND_SUPPORT "config/i386/w32-unwind.h"
|
236 |
|
|
#endif
|
237 |
|
|
|
238 |
|
|
/* This matches SHLIB_SONAME and SHLIB_SOVERSION in t-cygming. */
|
239 |
|
|
/* This matches SHLIB_SONAME and SHLIB_SOVERSION in t-cygwin. */
|
240 |
|
|
#if DWARF2_UNWIND_INFO
|
241 |
|
|
#define LIBGCC_EH_EXTN "_dw2"
|
242 |
|
|
#else
|
243 |
|
|
#define LIBGCC_EH_EXTN "_sjlj"
|
244 |
|
|
#endif
|
245 |
|
|
#define LIBGCC_SONAME "libgcc_s" LIBGCC_EH_EXTN "-1.dll"
|
246 |
|
|
|
247 |
|
|
/* We should find a way to not have to update this manually. */
|
248 |
|
|
#define LIBGCJ_SONAME "libgcj" /*LIBGCC_EH_EXTN*/ "-11.dll"
|
249 |
|
|
|