Merge from branches/gcc-4_8-branch up to rev 207411.
[official-gcc.git] / gcc-4_8-branch / gcc / config / i386 / mingw-w64.h
blob633009baee4c59b3c687b6f01f03080f97577abd
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-2013 Free Software Foundation, Inc.
6 This file is part of GCC.
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.
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.
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/>. */
22 /* Enable -municode feature and support optional pthread support. */
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} "
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"
37 /* Enable multilib. */
39 #undef ASM_SPEC
40 #define ASM_SPEC "%{m32:--32} %{m64:--64}"
42 #undef LIB_SPEC
43 #define LIB_SPEC "%{pg:-lgmon} %{" SPEC_PTHREAD1 ":-lpthread} " \
44 "%{" SPEC_PTHREAD2 ": } " \
45 "%{mwindows:-lgdi32 -lcomdlg32} " \
46 "-ladvapi32 -lshell32 -luser32 -lkernel32"
48 #undef SPEC_32
49 #undef SPEC_64
50 #if TARGET_64BIT_DEFAULT
51 #define SPEC_32 "m32"
52 #define SPEC_64 "!m32"
53 #else
54 #define SPEC_32 "!m64"
55 #define SPEC_64 "m64"
56 #endif
58 #undef SUB_LINK_ENTRY32
59 #undef SUB_LINK_ENTRY64
60 #define SUB_LINK_ENTRY32 "-e _DllMainCRTStartup@12"
61 #if defined(USE_MINGW64_LEADING_UNDERSCORES)
62 #define SUB_LINK_ENTRY64 "-e _DllMainCRTStartup"
63 #else
64 #define SUB_LINK_ENTRY64 "-e DllMainCRTStartup"
65 #endif
67 #undef SUB_LINK_SPEC
68 #undef SUB_LINK_ENTRY
69 #define SUB_LINK_SPEC "%{" SPEC_64 ":-m i386pep} %{" SPEC_32 ":-m i386pe}"
70 #define SUB_LINK_ENTRY "%{" SPEC_64 ":" SUB_LINK_ENTRY64 "} %{" SPEC_32 ":" SUB_LINK_ENTRY32 "}"
72 #undef MULTILIB_DEFAULTS
73 #if TARGET_64BIT_DEFAULT
74 #define MULTILIB_DEFAULTS { "m64" }
75 #else
76 #define MULTILIB_DEFAULTS { "m32" }
77 #endif
79 #undef LINK_SPEC
80 #define LINK_SPEC SUB_LINK_SPEC " %{mwindows:--subsystem windows} \
81 %{mconsole:--subsystem console} \
82 %{shared: %{mdll: %eshared and mdll are not compatible}} \
83 %{shared: --shared} %{mdll:--dll} \
84 %{static:-Bstatic} %{!static:-Bdynamic} \
85 %{shared|mdll: " SUB_LINK_ENTRY " --enable-auto-image-base} \
86 %(shared_libgcc_undefs)"