OSDN Git Service

PR target/49687
[pf3gnuchains/gcc-fork.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, 2010,
5    2011 Free Software Foundation, Inc.
6
7 This file is part of GCC.
8
9 GCC is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3, or (at your option)
12 any later version.
13
14 GCC is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with GCC; see the file COPYING3.  If not see
21 <http://www.gnu.org/licenses/>.  */
22
23 /* Enable -municode feature and support optional pthread support.  */
24
25 #undef CPP_SPEC
26 #define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{mthreads:-D_MT} " \
27                  "%{municode:-DUNICODE} " \
28                  "%{" SPEC_PTHREAD1 ":-D_REENTRANCE} " \
29                  "%{" SPEC_PTHREAD2 ":-U_REENTRANCE} "
30
31 #undef STARTFILE_SPEC
32 #define STARTFILE_SPEC "%{shared|mdll:dllcrt2%O%s} \
33   %{!shared:%{!mdll:%{!municode:crt2%O%s}}} \
34   %{!shared:%{!mdll:%{municode:crt2u%O%s}}} \
35   %{pg:gcrt2%O%s} \
36   crtbegin.o%s"
37
38 /* Enable multilib.  */
39
40 #undef ASM_SPEC
41 #define ASM_SPEC "%{m32:--32} %{m64:--64}"
42
43 #undef LIB_SPEC
44 #define LIB_SPEC "%{pg:-lgmon} %{" SPEC_PTHREAD1 ":-lpthread} " \
45                  "%{" SPEC_PTHREAD2 ": } " \
46                  "%{mwindows:-lgdi32 -lcomdlg32} " \
47                  "-ladvapi32 -lshell32 -luser32 -lkernel32"
48
49 #undef SPEC_32
50 #undef SPEC_64
51 #if TARGET_64BIT_DEFAULT
52 #define SPEC_32 "m32"
53 #define SPEC_64 "!m32"
54 #else
55 #define SPEC_32 "!m64"
56 #define SPEC_64 "m64"
57 #endif
58
59 #undef SUB_LINK_ENTRY32
60 #undef SUB_LINK_ENTRY64
61 #define SUB_LINK_ENTRY32 "-e _DllMainCRTStartup@12"
62 #if defined(USE_MINGW64_LEADING_UNDERSCORES)
63 #define SUB_LINK_ENTRY64 "-e _DllMainCRTStartup"
64 #else
65 #define SUB_LINK_ENTRY64 "-e DllMainCRTStartup"
66 #endif
67
68 #undef SUB_LINK_SPEC
69 #undef SUB_LINK_ENTRY
70 #define SUB_LINK_SPEC "%{" SPEC_64 ":-m i386pep} %{" SPEC_32 ":-m i386pe}"
71 #define SUB_LINK_ENTRY "%{" SPEC_64 ":" SUB_LINK_ENTRY64 "} %{" SPEC_32 ":" SUB_LINK_ENTRY32 "}"
72
73 #undef MULTILIB_DEFAULTS
74 #if TARGET_64BIT_DEFAULT
75 #define MULTILIB_DEFAULTS { "m64" }
76 #else
77 #define MULTILIB_DEFAULTS { "m32" }
78 #endif
79
80 #undef LINK_SPEC
81 #define LINK_SPEC SUB_LINK_SPEC " %{mwindows:--subsystem windows} \
82   %{mconsole:--subsystem console} \
83   %{shared: %{mdll: %eshared and mdll are not compatible}} \
84   %{shared: --shared} %{mdll:--dll} \
85   %{static:-Bstatic} %{!static:-Bdynamic} \
86   %{shared|mdll: " SUB_LINK_ENTRY " --enable-auto-image-base} \
87   %(shared_libgcc_undefs)"