]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/config/i386/mingw-w64.h
Update copyright years.
[thirdparty/gcc.git] / gcc / config / i386 / mingw-w64.h
1 /* Operating system specific defines to be used when targeting GCC for
2 hosting on Windows 32/64 via mingw-w64 runtime, using GNU tools and
3 the Windows API Library.
4 Copyright (C) 2009-2024 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 /* Enable -municode feature and support optional pthread support. */
23
24 #undef CPP_SPEC
25 #define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{mthreads:-D_MT} " \
26 "%{municode:-DUNICODE} " \
27 "%{" SPEC_PTHREAD1 ":-D_REENTRANT} " \
28 "%{" SPEC_PTHREAD2 ":-U_REENTRANT} " \
29 "%{mcrtdll=crtdll*:-U__MSVCRT__ -D__CRTDLL__} " \
30 "%{mcrtdll=msvcrt10*:-D__MSVCRT_VERSION__=0x100} " \
31 "%{mcrtdll=msvcrt20*:-D__MSVCRT_VERSION__=0x200} " \
32 "%{mcrtdll=msvcrt40*:-D__MSVCRT_VERSION__=0x400} " \
33 "%{mcrtdll=msvcrt-os*:-D__MSVCRT_VERSION__=0x700} " \
34 "%{mcrtdll=msvcr70*:-D__MSVCRT_VERSION__=0x700} " \
35 "%{mcrtdll=msvcr71*:-D__MSVCRT_VERSION__=0x701} " \
36 "%{mcrtdll=msvcr80*:-D__MSVCRT_VERSION__=0x800} " \
37 "%{mcrtdll=msvcr90*:-D__MSVCRT_VERSION__=0x900} " \
38 "%{mcrtdll=msvcr100*:-D__MSVCRT_VERSION__=0xA00} " \
39 "%{mcrtdll=msvcr110*:-D__MSVCRT_VERSION__=0xB00} " \
40 "%{mcrtdll=msvcr120*:-D__MSVCRT_VERSION__=0xC00} " \
41 "%{mcrtdll=ucrt*:-D_UCRT} "
42
43 #undef REAL_LIBGCC_SPEC
44 #define REAL_LIBGCC_SPEC \
45 "%{mthreads:-lmingwthrd} -lmingw32 \
46 " SHARED_LIBGCC_SPEC " \
47 -lmingwex %{!mcrtdll=*:-lmsvcrt} %{mcrtdll=*:-l%*} \
48 -lkernel32 " MCFGTHREAD_SPEC
49
50 #undef STARTFILE_SPEC
51 #define STARTFILE_SPEC "%{shared|mdll:dllcrt2%O%s} \
52 %{!shared:%{!mdll:%{!municode:crt2%O%s}}} \
53 %{!shared:%{!mdll:%{municode:crt2u%O%s}}} \
54 %{pg:gcrt2%O%s} \
55 crtbegin.o%s \
56 %{fvtable-verify=none:%s; \
57 fvtable-verify=preinit:vtv_start.o%s; \
58 fvtable-verify=std:vtv_start.o%s}"
59
60 /* Enable multilib. */
61
62 #undef ASM_SPEC
63 #define ASM_SPEC "%{m32:--32} %{m64:--64}"
64
65 #undef LIB_SPEC
66 #define LIB_SPEC "%{pg:-lgmon} %{" SPEC_PTHREAD1 ":-lpthread} " \
67 "%{" SPEC_PTHREAD2 ": } " \
68 "%{mwindows:-lgdi32 -lcomdlg32} " \
69 "%{fvtable-verify=preinit:-lvtv -lpsapi; \
70 fvtable-verify=std:-lvtv -lpsapi} " \
71 "-ladvapi32 -lshell32 -luser32 -lkernel32"
72
73 #undef SPEC_32
74 #undef SPEC_64
75 #if TARGET_64BIT_DEFAULT
76 #define SPEC_32 "m32"
77 #define SPEC_64 "!m32"
78 #else
79 #define SPEC_32 "!m64"
80 #define SPEC_64 "m64"
81 #endif
82
83 #undef SUB_LINK_ENTRY32
84 #undef SUB_LINK_ENTRY64
85 #define SUB_LINK_ENTRY32 "-e _DllMainCRTStartup@12"
86 #if defined(USE_MINGW64_LEADING_UNDERSCORES)
87 #define SUB_LINK_ENTRY64 "-e _DllMainCRTStartup"
88 #else
89 #define SUB_LINK_ENTRY64 "-e DllMainCRTStartup"
90 #endif
91
92 #undef SUB_LINK_SPEC
93 #undef SUB_LINK_ENTRY
94 #define SUB_LINK_SPEC "%{" SPEC_64 ":-m i386pep} %{" SPEC_32 ":-m i386pe}"
95 #define SUB_LINK_ENTRY "%{" SPEC_64 ":" SUB_LINK_ENTRY64 "} %{" SPEC_32 ":" SUB_LINK_ENTRY32 "}"
96
97 #undef MULTILIB_DEFAULTS
98 #if TARGET_64BIT_DEFAULT
99 #define MULTILIB_DEFAULTS { "m64" }
100 #else
101 #define MULTILIB_DEFAULTS { "m32" }
102 #endif
103
104 #undef LINK_SPEC_LARGE_ADDR_AWARE
105 #if MINGW_DEFAULT_LARGE_ADDR_AWARE
106 # define LINK_SPEC_LARGE_ADDR_AWARE \
107 "%{!shared:%{!mdll:%{" SPEC_32 ":--large-address-aware}}}"
108 #else
109 # define LINK_SPEC_LARGE_ADDR_AWARE ""
110 #endif
111
112 #undef LINK_SPEC_DISABLE_DYNAMICBASE
113 #if HAVE_LD_PE_DISABLE_DYNAMICBASE
114 # define LINK_SPEC_DISABLE_DYNAMICBASE \
115 "%{!shared:%{!mdll:%{no-pie:--disable-dynamicbase}}}"
116 #else
117 # define LINK_SPEC_DISABLE_DYNAMICBASE ""
118 #endif
119
120 #undef LINK_SPEC
121 #define LINK_SPEC SUB_LINK_SPEC " %{mwindows:--subsystem windows} \
122 %{mconsole:--subsystem console} \
123 %{shared: %{mdll: %eshared and mdll are not compatible}} \
124 %{shared: --shared} %{mdll:--dll} \
125 %{static:-Bstatic} %{!static:-Bdynamic} \
126 %{shared|mdll: " SUB_LINK_ENTRY " --enable-auto-image-base} \
127 " LINK_SPEC_LARGE_ADDR_AWARE "\
128 " LINK_SPEC_DISABLE_DYNAMICBASE "\
129 %(shared_libgcc_undefs)"
130
131 /* Enable sincos optimization, overriding cygming.h. sincos, sincosf
132 and sincosl functions are available on mingw-w64, but not on the
133 original mingw32. */
134 #undef TARGET_LIBC_HAS_FUNCTION
135 #define TARGET_LIBC_HAS_FUNCTION gnu_libc_has_function