]>
Commit | Line | Data |
---|---|---|
b421d30d | 1 | /* Operating system specific defines to be used when targeting GCC for |
513f3e74 | 2 | hosting on Windows32, using GNU tools and the Windows32 API Library. |
d353bf18 | 3 | Copyright (C) 1997-2015 Free Software Foundation, Inc. |
b421d30d | 4 | |
7d9ae20a | 5 | This file is part of GCC. |
b421d30d | 6 | |
7d9ae20a | 7 | GCC is free software; you can redistribute it and/or modify |
b421d30d | 8 | it under the terms of the GNU General Public License as published by |
038d1e19 | 9 | the Free Software Foundation; either version 3, or (at your option) |
b421d30d | 10 | any later version. |
11 | ||
7d9ae20a | 12 | GCC is distributed in the hope that it will be useful, |
b421d30d | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | GNU General Public License for more details. | |
16 | ||
17 | You should have received a copy of the GNU General Public License | |
038d1e19 | 18 | along with GCC; see the file COPYING3. If not see |
19 | <http://www.gnu.org/licenses/>. */ | |
b421d30d | 20 | |
59839b36 | 21 | #undef DEFAULT_ABI |
22 | #define DEFAULT_ABI MS_ABI | |
23 | ||
99e7ad2e | 24 | /* By default, target has a 80387, uses IEEE compatible arithmetic, |
25 | returns float values in the 387 and needs stack probes. | |
26 | We also align doubles to 64-bits for MSVC default compatibility. | |
27 | Additionally we enable MS_BITFIELD_LAYOUT by default. */ | |
28 | ||
29 | #undef TARGET_SUBTARGET_DEFAULT | |
30 | #define TARGET_SUBTARGET_DEFAULT \ | |
31 | (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS \ | |
32 | | MASK_STACK_PROBE | MASK_ALIGN_DOUBLE \ | |
33 | | MASK_MS_BITFIELD_LAYOUT) | |
34 | ||
b556e70c | 35 | /* See i386/crtdll.h for an alternative definition. _INTEGRAL_MAX_BITS |
36 | is for compatibility with native compiler. */ | |
e6627095 | 37 | #define EXTRA_OS_CPP_BUILTINS() \ |
38 | do \ | |
39 | { \ | |
40 | builtin_define ("__MSVCRT__"); \ | |
41 | builtin_define ("__MINGW32__"); \ | |
8728e49b | 42 | builtin_define ("_WIN32"); \ |
43 | builtin_define_std ("WIN32"); \ | |
44 | builtin_define_std ("WINNT"); \ | |
b556e70c | 45 | builtin_define_with_int_value ("_INTEGRAL_MAX_BITS", \ |
46 | TYPE_PRECISION (intmax_type_node));\ | |
0e4d11df | 47 | if (TARGET_64BIT && ix86_abi == MS_ABI) \ |
0bbe9142 | 48 | { \ |
49 | builtin_define ("__MINGW64__"); \ | |
0bbe9142 | 50 | builtin_define_std ("WIN64"); \ |
8ea1417d | 51 | builtin_define ("_WIN64"); \ |
0bbe9142 | 52 | } \ |
e6627095 | 53 | } \ |
54 | while (0) | |
55 | ||
b550f036 | 56 | #ifndef TARGET_USE_PTHREAD_BY_DEFAULT |
57 | #define SPEC_PTHREAD1 "pthread" | |
58 | #define SPEC_PTHREAD2 "!no-pthread" | |
59 | #else | |
60 | #define SPEC_PTHREAD1 "!no-pthread" | |
61 | #define SPEC_PTHREAD2 "pthread" | |
62 | #endif | |
63 | ||
a2beb429 | 64 | #undef SUB_LINK_ENTRY32 |
65 | #undef SUB_LINK_ENTRY64 | |
66 | #define SUB_LINK_ENTRY32 "-e _DllMainCRTStartup@12" | |
67 | #if defined(USE_MINGW64_LEADING_UNDERSCORES) | |
68 | #define SUB_LINK_ENTRY64 "-e _DllMainCRTStartup" | |
69 | #else | |
70 | #define SUB_LINK_ENTRY64 "-e DllMainCRTStartup" | |
71 | #endif | |
72 | ||
73 | #undef SUB_LINK_ENTRY | |
74 | #if TARGET_64BIT_DEFAULT | |
75 | #define SUB_LINK_ENTRY SUB_LINK_ENTRY64 | |
76 | #else | |
77 | #define SUB_LINK_ENTRY SUB_LINK_ENTRY32 | |
78 | #endif | |
79 | ||
638454a1 | 80 | #undef NATIVE_SYSTEM_HEADER_COMPONENT |
81 | #define NATIVE_SYSTEM_HEADER_COMPONENT "MINGW" | |
34aaebf3 | 82 | |
2c645f46 | 83 | #undef CPP_SPEC |
b550f036 | 84 | #define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{mthreads:-D_MT} " \ |
8d8f03b6 | 85 | "%{" SPEC_PTHREAD1 ":-D_REENTRANT} " \ |
b550f036 | 86 | "%{" SPEC_PTHREAD2 ": } " |
2c645f46 | 87 | |
b421d30d | 88 | /* For Windows applications, include more libraries, but always include |
89 | kernel32. */ | |
90 | #undef LIB_SPEC | |
b550f036 | 91 | #define LIB_SPEC "%{pg:-lgmon} %{" SPEC_PTHREAD1 ":-lpthread} " \ |
92 | "%{" SPEC_PTHREAD2 ": } " \ | |
93 | "%{mwindows:-lgdi32 -lcomdlg32} " \ | |
94 | "-ladvapi32 -lshell32 -luser32 -lkernel32" | |
b421d30d | 95 | |
7d804f04 | 96 | /* Weak symbols do not get resolved if using a Windows dll import lib. |
97 | Make the unwind registration references strong undefs. */ | |
98 | #if DWARF2_UNWIND_INFO | |
a2beb429 | 99 | /* DW2-unwind is just available for 32-bit mode. */ |
100 | #if TARGET_64BIT_DEFAULT | |
101 | #error DW2 unwind is not available for 64-bit. | |
102 | #endif | |
7d804f04 | 103 | #define SHARED_LIBGCC_UNDEFS_SPEC \ |
104 | "%{shared-libgcc: -u ___register_frame_info -u ___deregister_frame_info}" | |
105 | #else | |
106 | #define SHARED_LIBGCC_UNDEFS_SPEC "" | |
107 | #endif | |
108 | ||
109 | #undef SUBTARGET_EXTRA_SPECS | |
110 | #define SUBTARGET_EXTRA_SPECS \ | |
111 | { "shared_libgcc_undefs", SHARED_LIBGCC_UNDEFS_SPEC } | |
112 | ||
f5b19551 | 113 | #define LINK_SPEC "%{mwindows:--subsystem windows} \ |
114 | %{mconsole:--subsystem console} \ | |
115 | %{shared: %{mdll: %eshared and mdll are not compatible}} \ | |
116 | %{shared: --shared} %{mdll:--dll} \ | |
117 | %{static:-Bstatic} %{!static:-Bdynamic} \ | |
a2beb429 | 118 | %{shared|mdll: " SUB_LINK_ENTRY " --enable-auto-image-base} \ |
7d804f04 | 119 | %(shared_libgcc_undefs)" |
f5b19551 | 120 | |
34aaebf3 | 121 | /* Include in the mingw32 libraries with libgcc */ |
a49be7fc | 122 | #ifdef ENABLE_SHARED_LIBGCC |
0f69ae5f | 123 | #define SHARED_LIBGCC_SPEC " \ |
124 | %{static|static-libgcc:-lgcc -lgcc_eh} \ | |
125 | %{!static: \ | |
126 | %{!static-libgcc: \ | |
127 | %{!shared: \ | |
128 | %{!shared-libgcc:-lgcc -lgcc_eh} \ | |
129 | %{shared-libgcc:-lgcc_s -lgcc} \ | |
130 | } \ | |
131 | %{shared:-lgcc_s -lgcc} \ | |
132 | } \ | |
133 | } " | |
a49be7fc | 134 | #else |
0f69ae5f | 135 | #define SHARED_LIBGCC_SPEC " -lgcc " |
a49be7fc | 136 | #endif |
9c19b6a5 | 137 | #undef REAL_LIBGCC_SPEC |
138 | #define REAL_LIBGCC_SPEC \ | |
6729e712 | 139 | "%{mthreads:-lmingwthrd} -lmingw32 \ |
a49be7fc | 140 | "SHARED_LIBGCC_SPEC" \ |
7d804f04 | 141 | -lmoldname -lmingwex -lmsvcrt" |
b421d30d | 142 | |
34aaebf3 | 143 | #undef STARTFILE_SPEC |
f5b19551 | 144 | #define STARTFILE_SPEC "%{shared|mdll:dllcrt2%O%s} \ |
9e51385b | 145 | %{!shared:%{!mdll:crt2%O%s}} %{pg:gcrt2%O%s} \ |
146 | crtbegin.o%s" | |
34aaebf3 | 147 | |
8f433c51 | 148 | #undef ENDFILE_SPEC |
149 | #define ENDFILE_SPEC \ | |
5820f58d | 150 | "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \ |
291a0806 | 151 | %{!shared:%:if-exists(default-manifest.o%s)}\ |
9e51385b | 152 | crtend.o%s" |
8f433c51 | 153 | |
3c2ba0de | 154 | /* Override startfile prefix defaults. */ |
155 | #ifndef STANDARD_STARTFILE_PREFIX_1 | |
156 | #define STANDARD_STARTFILE_PREFIX_1 "/mingw/lib/" | |
157 | #endif | |
158 | #ifndef STANDARD_STARTFILE_PREFIX_2 | |
159 | #define STANDARD_STARTFILE_PREFIX_2 "" | |
160 | #endif | |
4edbba03 | 161 | |
03870e31 | 162 | /* For native mingw-version we need to take care that NATIVE_SYSTEM_HEADER_DIR |
163 | macro contains POSIX-style path. See bug 52947. */ | |
164 | #undef NATIVE_SYSTEM_HEADER_DIR | |
165 | #define NATIVE_SYSTEM_HEADER_DIR "/mingw/include" | |
166 | ||
82f00d58 | 167 | /* Output STRING, a string representing a filename, to FILE. |
fcbfedc7 | 168 | We canonicalize it to be in Unix format (backslashes are replaced |
6e957326 | 169 | forward slashes. */ |
82f00d58 | 170 | #undef OUTPUT_QUOTED_STRING |
6e957326 | 171 | #define OUTPUT_QUOTED_STRING(FILE, STRING) \ |
172 | do { \ | |
6ae2c051 | 173 | const char *_string = (const char *) (STRING); \ |
6e957326 | 174 | char c; \ |
175 | \ | |
6ae2c051 | 176 | putc ('\"', (FILE)); \ |
6e957326 | 177 | \ |
6ae2c051 | 178 | while ((c = *_string++) != 0) \ |
6e957326 | 179 | { \ |
180 | if (c == '\\') \ | |
181 | c = '/'; \ | |
182 | \ | |
183 | if (ISPRINT (c)) \ | |
184 | { \ | |
185 | if (c == '\"') \ | |
6ae2c051 | 186 | putc ('\\', (FILE)); \ |
187 | putc (c, (FILE)); \ | |
6e957326 | 188 | } \ |
189 | else \ | |
6ae2c051 | 190 | fprintf ((FILE), "\\%03o", (unsigned char) c); \ |
6e957326 | 191 | } \ |
192 | \ | |
6ae2c051 | 193 | putc ('\"', (FILE)); \ |
34aaebf3 | 194 | } while (0) |
195 | ||
fcbfedc7 | 196 | /* Define as short unsigned for compatibility with MS runtime. */ |
2a966961 | 197 | #undef WINT_TYPE |
198 | #define WINT_TYPE "short unsigned int" | |
5fbe6585 | 199 | |
8057d305 | 200 | /* mingw32 uses the -mthreads option to enable thread support. */ |
5fbe6585 | 201 | #undef GOMP_SELF_SPECS |
ca4c3545 | 202 | #define GOMP_SELF_SPECS "%{fopenacc|fopenmp|ftree-parallelize-loops=*: " \ |
1afd7cda | 203 | "-mthreads -pthread}" |
9a8d01ee | 204 | #undef GTM_SELF_SPECS |
205 | #define GTM_SELF_SPECS "%{fgnu-tm:-mthreads -pthread}" | |
d91ef9b0 | 206 | |
207 | /* mingw32 atexit function is safe to use in shared libraries. Use it | |
208 | to register C++ static destructors. */ | |
209 | #define TARGET_CXX_USE_ATEXIT_FOR_CXA_ATEXIT hook_bool_void_true | |
9e51385b | 210 | |
635c5a98 | 211 | /* Contains a pointer to type target_ovr_attr defining the target specific |
212 | overrides of format attributes. See c-format.h for structure | |
213 | definition. */ | |
214 | #undef TARGET_OVERRIDES_FORMAT_ATTRIBUTES | |
215 | #define TARGET_OVERRIDES_FORMAT_ATTRIBUTES mingw_format_attribute_overrides | |
216 | ||
217 | /* Specify the count of elements in TARGET_OVERRIDES_ATTRIBUTE. */ | |
218 | #undef TARGET_OVERRIDES_FORMAT_ATTRIBUTES_COUNT | |
219 | #define TARGET_OVERRIDES_FORMAT_ATTRIBUTES_COUNT 3 | |
220 | ||
78e16ab5 | 221 | /* Custom initialization for warning -Wpedantic-ms-format for c-format. */ |
222 | #undef TARGET_OVERRIDES_FORMAT_INIT | |
223 | #define TARGET_OVERRIDES_FORMAT_INIT msformat_init | |
224 | ||
635c5a98 | 225 | /* MS specific format attributes for ms_printf, ms_scanf, ms_strftime. */ |
226 | #undef TARGET_FORMAT_TYPES | |
227 | #define TARGET_FORMAT_TYPES mingw_format_attributes | |
228 | ||
229 | #undef TARGET_N_FORMAT_TYPES | |
230 | #define TARGET_N_FORMAT_TYPES 3 | |
231 | ||
019ee3ed | 232 | /* Let defaults.h definition of TARGET_USE_JCR_SECTION apply. */ |
9e51385b | 233 | #undef TARGET_USE_JCR_SECTION |
9e51385b | 234 | |
a6f06169 | 235 | #define HAVE_ENABLE_EXECUTE_STACK |
02c5bdd8 | 236 | #undef CHECK_EXECUTE_STACK_ENABLED |
237 | #define CHECK_EXECUTE_STACK_ENABLED flag_setstackexecutable | |
11d6399c | 238 | |
7d804f04 | 239 | /* This matches SHLIB_SONAME and SHLIB_SOVERSION in t-cygming. */ |
8cae609c | 240 | /* This matches SHLIB_SONAME and SHLIB_SOVERSION in t-cygwin. */ |
241 | #if DWARF2_UNWIND_INFO | |
242 | #define LIBGCC_EH_EXTN "_dw2" | |
243 | #else | |
244 | #define LIBGCC_EH_EXTN "_sjlj" | |
245 | #endif | |
246 | #define LIBGCC_SONAME "libgcc_s" LIBGCC_EH_EXTN "-1.dll" | |
fa280a58 | 247 | |
248 | /* We should find a way to not have to update this manually. */ | |
62217e77 | 249 | #define LIBGCJ_SONAME "libgcj" /*LIBGCC_EH_EXTN*/ "-13.dll" |