comparison gcc/config/i386/mingw32.h @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents f6334be47118
children 84e7813d76e9
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
1 /* Operating system specific defines to be used when targeting GCC for 1 /* Operating system specific defines to be used when targeting GCC for
2 hosting on Windows32, using GNU tools and the Windows32 API Library. 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, 3 Copyright (C) 1997-2017 Free Software Foundation, Inc.
4 2009, 2010 Free Software Foundation, Inc.
5 4
6 This file is part of GCC. 5 This file is part of GCC.
7 6
8 GCC is free software; you can redistribute it and/or modify 7 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 8 it under the terms of the GNU General Public License as published by
17 16
18 You should have received a copy of the GNU General Public License 17 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3. If not see 18 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */ 19 <http://www.gnu.org/licenses/>. */
21 20
22 #undef TARGET_VERSION 21 #undef DEFAULT_ABI
23 #if TARGET_64BIT_DEFAULT 22 #define DEFAULT_ABI MS_ABI
24 #define TARGET_VERSION fprintf (stderr,"(x86_64 MinGW"); 23
25 #else 24 /* By default, target has a 80387, uses IEEE compatible arithmetic,
26 #define TARGET_VERSION fprintf (stderr," (x86 MinGW)"); 25 returns float values in the 387 and needs stack probes.
27 #endif 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)
28 34
29 /* See i386/crtdll.h for an alternative definition. _INTEGRAL_MAX_BITS 35 /* See i386/crtdll.h for an alternative definition. _INTEGRAL_MAX_BITS
30 is for compatibility with native compiler. */ 36 is for compatibility with native compiler. */
31 #define EXTRA_OS_CPP_BUILTINS() \ 37 #define EXTRA_OS_CPP_BUILTINS() \
32 do \ 38 do \
45 builtin_define ("_WIN64"); \ 51 builtin_define ("_WIN64"); \
46 } \ 52 } \
47 } \ 53 } \
48 while (0) 54 while (0)
49 55
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
50 #undef SUB_LINK_ENTRY32 64 #undef SUB_LINK_ENTRY32
51 #undef SUB_LINK_ENTRY64 65 #undef SUB_LINK_ENTRY64
52 #define SUB_LINK_ENTRY32 "-e _DllMainCRTStartup@12" 66 #define SUB_LINK_ENTRY32 "-e _DllMainCRTStartup@12"
53 #if defined(USE_MINGW64_LEADING_UNDERSCORES) 67 #if defined(USE_MINGW64_LEADING_UNDERSCORES)
54 #define SUB_LINK_ENTRY64 "-e _DllMainCRTStartup" 68 #define SUB_LINK_ENTRY64 "-e _DllMainCRTStartup"
61 #define SUB_LINK_ENTRY SUB_LINK_ENTRY64 75 #define SUB_LINK_ENTRY SUB_LINK_ENTRY64
62 #else 76 #else
63 #define SUB_LINK_ENTRY SUB_LINK_ENTRY32 77 #define SUB_LINK_ENTRY SUB_LINK_ENTRY32
64 #endif 78 #endif
65 79
66 /* Override the standard choice of /usr/include as the default prefix 80 #undef NATIVE_SYSTEM_HEADER_COMPONENT
67 to try when searching for header files. */ 81 #define NATIVE_SYSTEM_HEADER_COMPONENT "MINGW"
68 #undef STANDARD_INCLUDE_DIR
69 #define STANDARD_INCLUDE_DIR "/mingw/include"
70 #undef STANDARD_INCLUDE_COMPONENT
71 #define STANDARD_INCLUDE_COMPONENT "MINGW"
72 82
73 #undef CPP_SPEC 83 #undef CPP_SPEC
74 #define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{mthreads:-D_MT}" 84 #define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{mthreads:-D_MT} " \
85 "%{" SPEC_PTHREAD1 ":-D_REENTRANT} " \
86 "%{" SPEC_PTHREAD2 ": } "
75 87
76 /* For Windows applications, include more libraries, but always include 88 /* For Windows applications, include more libraries, but always include
77 kernel32. */ 89 kernel32. */
78 #undef LIB_SPEC 90 #undef LIB_SPEC
79 #define LIB_SPEC "%{pg:-lgmon} %{mwindows:-lgdi32 -lcomdlg32} \ 91 #define LIB_SPEC "%{pg:-lgmon} %{" SPEC_PTHREAD1 ":-lpthread} " \
80 -ladvapi32 -lshell32 -luser32 -lkernel32" 92 "%{" SPEC_PTHREAD2 ": } " \
93 "%{mwindows:-lgdi32 -lcomdlg32} " \
94 "%{fvtable-verify=preinit:-lvtv -lpsapi; \
95 fvtable-verify=std:-lvtv -lpsapi} " \
96 "-ladvapi32 -lshell32 -luser32 -lkernel32"
81 97
82 /* Weak symbols do not get resolved if using a Windows dll import lib. 98 /* Weak symbols do not get resolved if using a Windows dll import lib.
83 Make the unwind registration references strong undefs. */ 99 Make the unwind registration references strong undefs. */
84 #if DWARF2_UNWIND_INFO 100 #if DWARF2_UNWIND_INFO
85 /* DW2-unwind is just available for 32-bit mode. */ 101 /* DW2-unwind is just available for 32-bit mode. */
86 #if TARGET_64BIT_DEFAULT 102 #if TARGET_64BIT_DEFAULT
87 #error DW2 unwind is not available for 64-bit. 103 #define SHARED_LIBGCC_UNDEFS_SPEC \
88 #endif 104 "%{m32: %{shared-libgcc: -u ___register_frame_info -u ___deregister_frame_info}}"
105 #else
89 #define SHARED_LIBGCC_UNDEFS_SPEC \ 106 #define SHARED_LIBGCC_UNDEFS_SPEC \
90 "%{shared-libgcc: -u ___register_frame_info -u ___deregister_frame_info}" 107 "%{shared-libgcc: -u ___register_frame_info -u ___deregister_frame_info}"
108 #endif
91 #else 109 #else
92 #define SHARED_LIBGCC_UNDEFS_SPEC "" 110 #define SHARED_LIBGCC_UNDEFS_SPEC ""
93 #endif 111 #endif
94 112
95 #undef SUBTARGET_EXTRA_SPECS 113 #undef SUBTARGET_EXTRA_SPECS
104 %{shared|mdll: " SUB_LINK_ENTRY " --enable-auto-image-base} \ 122 %{shared|mdll: " SUB_LINK_ENTRY " --enable-auto-image-base} \
105 %(shared_libgcc_undefs)" 123 %(shared_libgcc_undefs)"
106 124
107 /* Include in the mingw32 libraries with libgcc */ 125 /* Include in the mingw32 libraries with libgcc */
108 #ifdef ENABLE_SHARED_LIBGCC 126 #ifdef ENABLE_SHARED_LIBGCC
109 #define SHARED_LIBGCC_SPEC "%{shared-libgcc:-lgcc_s} %{!shared-libgcc:-lgcc_eh}" 127 #define SHARED_LIBGCC_SPEC " \
110 #else 128 %{static|static-libgcc:-lgcc -lgcc_eh} \
111 #define SHARED_LIBGCC_SPEC /*empty*/ 129 %{!static: \
130 %{!static-libgcc: \
131 %{!shared: \
132 %{!shared-libgcc:-lgcc -lgcc_eh} \
133 %{shared-libgcc:-lgcc_s -lgcc} \
134 } \
135 %{shared:-lgcc_s -lgcc} \
136 } \
137 } "
138 #else
139 #define SHARED_LIBGCC_SPEC " -lgcc "
112 #endif 140 #endif
113 #undef REAL_LIBGCC_SPEC 141 #undef REAL_LIBGCC_SPEC
114 #define REAL_LIBGCC_SPEC \ 142 #define REAL_LIBGCC_SPEC \
115 "%{mthreads:-lmingwthrd} -lmingw32 \ 143 "%{mthreads:-lmingwthrd} -lmingw32 \
116 "SHARED_LIBGCC_SPEC" \ 144 " SHARED_LIBGCC_SPEC " \
117 -lgcc \
118 -lmoldname -lmingwex -lmsvcrt" 145 -lmoldname -lmingwex -lmsvcrt"
119 146
120 #undef STARTFILE_SPEC 147 #undef STARTFILE_SPEC
121 #define STARTFILE_SPEC "%{shared|mdll:dllcrt2%O%s} \ 148 #define STARTFILE_SPEC "%{shared|mdll:dllcrt2%O%s} \
122 %{!shared:%{!mdll:crt2%O%s}} %{pg:gcrt2%O%s} \ 149 %{!shared:%{!mdll:crt2%O%s}} %{pg:gcrt2%O%s} \
123 crtbegin.o%s" 150 crtbegin.o%s \
151 %{fvtable-verify=none:%s; \
152 fvtable-verify=preinit:vtv_start.o%s; \
153 fvtable-verify=std:vtv_start.o%s}"
124 154
125 #undef ENDFILE_SPEC 155 #undef ENDFILE_SPEC
126 #define ENDFILE_SPEC \ 156 #define ENDFILE_SPEC \
127 "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \ 157 "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
158 %{!shared:%:if-exists(default-manifest.o%s)}\
159 %{fvtable-verify=none:%s; \
160 fvtable-verify=preinit:vtv_end.o%s; \
161 fvtable-verify=std:vtv_end.o%s} \
128 crtend.o%s" 162 crtend.o%s"
129 163
130 /* Override startfile prefix defaults. */ 164 /* Override startfile prefix defaults. */
131 #ifndef STANDARD_STARTFILE_PREFIX_1 165 #ifndef STANDARD_STARTFILE_PREFIX_1
132 #define STANDARD_STARTFILE_PREFIX_1 "/mingw/lib/" 166 #define STANDARD_STARTFILE_PREFIX_1 "/mingw/lib/"
133 #endif 167 #endif
134 #ifndef STANDARD_STARTFILE_PREFIX_2 168 #ifndef STANDARD_STARTFILE_PREFIX_2
135 #define STANDARD_STARTFILE_PREFIX_2 "" 169 #define STANDARD_STARTFILE_PREFIX_2 ""
136 #endif 170 #endif
171
172 /* For native mingw-version we need to take care that NATIVE_SYSTEM_HEADER_DIR
173 macro contains POSIX-style path. See bug 52947. */
174 #undef NATIVE_SYSTEM_HEADER_DIR
175 #define NATIVE_SYSTEM_HEADER_DIR "/mingw/include"
137 176
138 /* Output STRING, a string representing a filename, to FILE. 177 /* Output STRING, a string representing a filename, to FILE.
139 We canonicalize it to be in Unix format (backslashes are replaced 178 We canonicalize it to be in Unix format (backslashes are replaced
140 forward slashes. */ 179 forward slashes. */
141 #undef OUTPUT_QUOTED_STRING 180 #undef OUTPUT_QUOTED_STRING
142 #define OUTPUT_QUOTED_STRING(FILE, STRING) \ 181 #define OUTPUT_QUOTED_STRING(FILE, STRING) \
143 do { \ 182 do { \
183 const char *_string = (const char *) (STRING); \
144 char c; \ 184 char c; \
145 \ 185 \
146 putc ('\"', asm_file); \ 186 putc ('\"', (FILE)); \
147 \ 187 \
148 while ((c = *string++) != 0) \ 188 while ((c = *_string++) != 0) \
149 { \ 189 { \
150 if (c == '\\') \ 190 if (c == '\\') \
151 c = '/'; \ 191 c = '/'; \
152 \ 192 \
153 if (ISPRINT (c)) \ 193 if (ISPRINT (c)) \
154 { \ 194 { \
155 if (c == '\"') \ 195 if (c == '\"') \
156 putc ('\\', asm_file); \ 196 putc ('\\', (FILE)); \
157 putc (c, asm_file); \ 197 putc (c, (FILE)); \
158 } \ 198 } \
159 else \ 199 else \
160 fprintf (asm_file, "\\%03o", (unsigned char) c); \ 200 fprintf ((FILE), "\\%03o", (unsigned char) c); \
161 } \ 201 } \
162 \ 202 \
163 putc ('\"', asm_file); \ 203 putc ('\"', (FILE)); \
164 } while (0) 204 } while (0)
165 205
166 /* Define as short unsigned for compatibility with MS runtime. */ 206 /* Define as short unsigned for compatibility with MS runtime. */
167 #undef WINT_TYPE 207 #undef WINT_TYPE
168 #define WINT_TYPE "short unsigned int" 208 #define WINT_TYPE "short unsigned int"
169 209
170 /* mingw32 uses the -mthreads option to enable thread support. */ 210 /* mingw32 uses the -mthreads option to enable thread support. */
171 #undef GOMP_SELF_SPECS 211 #undef GOMP_SELF_SPECS
172 #define GOMP_SELF_SPECS "%{fopenmp: -mthreads}" 212 #define GOMP_SELF_SPECS "%{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1): " \
213 "-mthreads -pthread}"
214 #undef GTM_SELF_SPECS
215 #define GTM_SELF_SPECS "%{fgnu-tm:-mthreads -pthread}"
173 216
174 /* mingw32 atexit function is safe to use in shared libraries. Use it 217 /* mingw32 atexit function is safe to use in shared libraries. Use it
175 to register C++ static destructors. */ 218 to register C++ static destructors. */
176 #define TARGET_CXX_USE_ATEXIT_FOR_CXA_ATEXIT hook_bool_void_true 219 #define TARGET_CXX_USE_ATEXIT_FOR_CXA_ATEXIT hook_bool_void_true
177 220
194 #define TARGET_FORMAT_TYPES mingw_format_attributes 237 #define TARGET_FORMAT_TYPES mingw_format_attributes
195 238
196 #undef TARGET_N_FORMAT_TYPES 239 #undef TARGET_N_FORMAT_TYPES
197 #define TARGET_N_FORMAT_TYPES 3 240 #define TARGET_N_FORMAT_TYPES 3
198 241
199 /* Let defaults.h definition of TARGET_USE_JCR_SECTION apply. */ 242 #define HAVE_ENABLE_EXECUTE_STACK
200 #undef TARGET_USE_JCR_SECTION
201
202 #undef MINGW_ENABLE_EXECUTE_STACK
203 #define MINGW_ENABLE_EXECUTE_STACK \
204 extern void __enable_execute_stack (void *); \
205 void \
206 __enable_execute_stack (void *addr) \
207 { \
208 MEMORY_BASIC_INFORMATION b; \
209 if (!VirtualQuery (addr, &b, sizeof(b))) \
210 abort (); \
211 VirtualProtect (b.BaseAddress, b.RegionSize, PAGE_EXECUTE_READWRITE, \
212 &b.Protect); \
213 }
214
215 #undef ENABLE_EXECUTE_STACK
216 #define ENABLE_EXECUTE_STACK MINGW_ENABLE_EXECUTE_STACK
217 #undef CHECK_EXECUTE_STACK_ENABLED 243 #undef CHECK_EXECUTE_STACK_ENABLED
218 #define CHECK_EXECUTE_STACK_ENABLED flag_setstackexecutable 244 #define CHECK_EXECUTE_STACK_ENABLED flag_setstackexecutable
219
220 #ifdef IN_LIBGCC2
221 #include <windows.h>
222 #endif
223
224 /* For 64-bit Windows we can't use DW2 unwind info. Also for multilib
225 builds we can't use it, too. */
226 #if !TARGET_64BIT_DEFAULT && !defined (TARGET_BI_ARCH)
227 #define MD_UNWIND_SUPPORT "config/i386/w32-unwind.h"
228 #endif
229 245
230 /* This matches SHLIB_SONAME and SHLIB_SOVERSION in t-cygming. */ 246 /* This matches SHLIB_SONAME and SHLIB_SOVERSION in t-cygming. */
231 /* This matches SHLIB_SONAME and SHLIB_SOVERSION in t-cygwin. */ 247 /* This matches SHLIB_SONAME and SHLIB_SOVERSION in t-cygwin. */
232 #if DWARF2_UNWIND_INFO 248 #if DWARF2_UNWIND_INFO
233 #define LIBGCC_EH_EXTN "_dw2" 249 #define LIBGCC_EH_EXTN "_dw2"
234 #else 250 #else
235 #define LIBGCC_EH_EXTN "_sjlj" 251 #define LIBGCC_EH_EXTN "_sjlj"
236 #endif 252 #endif
237 #define LIBGCC_SONAME "libgcc_s" LIBGCC_EH_EXTN "-1.dll" 253 #define LIBGCC_SONAME "libgcc_s" LIBGCC_EH_EXTN "-1.dll"
238 254
239 /* We should find a way to not have to update this manually. */
240 #define LIBGCJ_SONAME "libgcj" /*LIBGCC_EH_EXTN*/ "-12.dll"
241