mingw-w64.h revision 1.10
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-2019 Free Software Foundation, Inc. 5 6This file is part of GCC. 7 8GCC is free software; you can redistribute it and/or modify 9it under the terms of the GNU General Public License as published by 10the Free Software Foundation; either version 3, or (at your option) 11any later version. 12 13GCC is distributed in the hope that it will be useful, 14but WITHOUT ANY WARRANTY; without even the implied warranty of 15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16GNU General Public License for more details. 17 18You should have received a copy of the GNU General Public License 19along 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 30#undef STARTFILE_SPEC 31#define STARTFILE_SPEC "%{shared|mdll:dllcrt2%O%s} \ 32 %{!shared:%{!mdll:%{!municode:crt2%O%s}}} \ 33 %{!shared:%{!mdll:%{municode:crt2u%O%s}}} \ 34 %{pg:gcrt2%O%s} \ 35 crtbegin.o%s \ 36 %{fvtable-verify=none:%s; \ 37 fvtable-verify=preinit:vtv_start.o%s; \ 38 fvtable-verify=std:vtv_start.o%s}" 39 40/* Enable multilib. */ 41 42#undef ASM_SPEC 43#define ASM_SPEC "%{m32:--32} %{m64:--64}" 44 45#undef LIB_SPEC 46#define LIB_SPEC "%{pg:-lgmon} %{" SPEC_PTHREAD1 ":-lpthread} " \ 47 "%{" SPEC_PTHREAD2 ": } " \ 48 "%{mwindows:-lgdi32 -lcomdlg32} " \ 49 "%{fvtable-verify=preinit:-lvtv -lpsapi; \ 50 fvtable-verify=std:-lvtv -lpsapi} " \ 51 "-ladvapi32 -lshell32 -luser32 -lkernel32" 52 53#undef SPEC_32 54#undef SPEC_64 55#if TARGET_64BIT_DEFAULT 56#define SPEC_32 "m32" 57#define SPEC_64 "!m32" 58#else 59#define SPEC_32 "!m64" 60#define SPEC_64 "m64" 61#endif 62 63#undef SUB_LINK_ENTRY32 64#undef SUB_LINK_ENTRY64 65#define SUB_LINK_ENTRY32 "-e _DllMainCRTStartup@12" 66#if defined(USE_MINGW64_LEADING_UNDERSCORES) 67#define SUB_LINK_ENTRY64 "-e _DllMainCRTStartup" 68#else 69#define SUB_LINK_ENTRY64 "-e DllMainCRTStartup" 70#endif 71 72#undef SUB_LINK_SPEC 73#undef SUB_LINK_ENTRY 74#define SUB_LINK_SPEC "%{" SPEC_64 ":-m i386pep} %{" SPEC_32 ":-m i386pe}" 75#define SUB_LINK_ENTRY "%{" SPEC_64 ":" SUB_LINK_ENTRY64 "} %{" SPEC_32 ":" SUB_LINK_ENTRY32 "}" 76 77#undef MULTILIB_DEFAULTS 78#if TARGET_64BIT_DEFAULT 79#define MULTILIB_DEFAULTS { "m64" } 80#else 81#define MULTILIB_DEFAULTS { "m32" } 82#endif 83 84#undef LINK_SPEC_LARGE_ADDR_AWARE 85#if MINGW_DEFAULT_LARGE_ADDR_AWARE 86# define LINK_SPEC_LARGE_ADDR_AWARE \ 87 "%{!shared:%{!mdll:%{" SPEC_32 ":--large-address-aware}}}" 88#else 89# define LINK_SPEC_LARGE_ADDR_AWARE "" 90#endif 91 92#undef LINK_SPEC 93#define LINK_SPEC SUB_LINK_SPEC " %{mwindows:--subsystem windows} \ 94 %{mconsole:--subsystem console} \ 95 %{shared: %{mdll: %eshared and mdll are not compatible}} \ 96 %{shared: --shared} %{mdll:--dll} \ 97 %{static:-Bstatic} %{!static:-Bdynamic} \ 98 %{shared|mdll: " SUB_LINK_ENTRY " --enable-auto-image-base} \ 99 " LINK_SPEC_LARGE_ADDR_AWARE "\ 100 %(shared_libgcc_undefs)" 101