ChangeLog/libgcc
[official-gcc.git] / gcc / config / i386 / mingw32.h
blob2b129ecf9e1bbcb37b75c597b47413d592f60226
1 /* Operating system specific defines to be used when targeting GCC for
2 hosting on Windows32, using GNU tools and the Windows32 API Library.
3 Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
4 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 2, 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 COPYING. If not, write to
20 the Free Software Foundation, 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA. */
23 #undef TARGET_VERSION
24 #if TARGET_64BIT_DEFAULT
25 #define TARGET_VERSION fprintf (stderr,"(x86_64 MinGW");
26 #else
27 #define TARGET_VERSION fprintf (stderr," (x86 MinGW)");
28 #endif
30 /* See i386/crtdll.h for an alternative definition. _INTEGRAL_MAX_BITS
31 is for compatibility with native compiler. */
32 #define EXTRA_OS_CPP_BUILTINS() \
33 do \
34 { \
35 builtin_define ("__MSVCRT__"); \
36 builtin_define ("__MINGW32__"); \
37 builtin_define ("_WIN32"); \
38 builtin_define_std ("WIN32"); \
39 builtin_define_std ("WINNT"); \
40 builtin_define_with_int_value ("_INTEGRAL_MAX_BITS", \
41 TYPE_PRECISION (intmax_type_node));\
42 if (TARGET_64BIT_MS_ABI) \
43 { \
44 builtin_define ("__MINGW64__"); \
45 builtin_define_std ("WIN64"); \
46 builtin_define_std ("_WIN64"); \
47 } \
48 } \
49 while (0)
51 /* Override the standard choice of /usr/include as the default prefix
52 to try when searching for header files. */
53 #undef STANDARD_INCLUDE_DIR
54 #if TARGET_64BIT_DEFAULT
55 #define STANDARD_INCLUDE_DIR "/mingw/include64"
56 #else
57 #define STANDARD_INCLUDE_DIR "/mingw/include"
58 #endif
59 #undef STANDARD_INCLUDE_COMPONENT
60 #define STANDARD_INCLUDE_COMPONENT "MINGW"
62 #undef CPP_SPEC
63 #define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{mthreads:-D_MT}"
65 /* For Windows applications, include more libraries, but always include
66 kernel32. */
67 #undef LIB_SPEC
68 #define LIB_SPEC "%{pg:-lgmon} %{mwindows:-lgdi32 -lcomdlg32} \
69 -luser32 -lkernel32 -ladvapi32 -lshell32"
71 /* Include in the mingw32 libraries with libgcc */
72 #undef LINK_SPEC
73 #define LINK_SPEC "%{mwindows:--subsystem windows} \
74 %{mconsole:--subsystem console} \
75 %{shared: %{mdll: %eshared and mdll are not compatible}} \
76 %{shared: --shared} %{mdll:--dll} \
77 %{static:-Bstatic} %{!static:-Bdynamic} \
78 %{shared|mdll: -e _DllMainCRTStartup@12}"
80 /* Include in the mingw32 libraries with libgcc */
81 #undef LIBGCC_SPEC
82 #define LIBGCC_SPEC \
83 "%{mthreads:-lmingwthrd} -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt"
85 #undef STARTFILE_SPEC
86 #define STARTFILE_SPEC "%{shared|mdll:dllcrt2%O%s} \
87 %{!shared:%{!mdll:crt2%O%s}} %{pg:gcrt2%O%s} \
88 crtbegin.o%s"
90 #undef ENDFILE_SPEC
91 #define ENDFILE_SPEC \
92 "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
93 crtend.o%s"
95 /* Override startfile prefix defaults. */
96 #ifndef STANDARD_STARTFILE_PREFIX_1
97 #if TARGET_64BIT_DEFAULT
98 #define STANDARD_STARTFILE_PREFIX_1 "/mingw/lib64/"
99 #else
100 #define STANDARD_STARTFILE_PREFIX_1 "/mingw/lib/"
101 #endif
102 #endif
103 #ifndef STANDARD_STARTFILE_PREFIX_2
104 #define STANDARD_STARTFILE_PREFIX_2 ""
105 #endif
107 /* Output STRING, a string representing a filename, to FILE.
108 We canonicalize it to be in Unix format (backslashes are replaced
109 forward slashes. */
110 #undef OUTPUT_QUOTED_STRING
111 #define OUTPUT_QUOTED_STRING(FILE, STRING) \
112 do { \
113 char c; \
115 putc ('\"', asm_file); \
117 while ((c = *string++) != 0) \
119 if (c == '\\') \
120 c = '/'; \
122 if (ISPRINT (c)) \
124 if (c == '\"') \
125 putc ('\\', asm_file); \
126 putc (c, asm_file); \
128 else \
129 fprintf (asm_file, "\\%03o", (unsigned char) c); \
132 putc ('\"', asm_file); \
133 } while (0)
135 /* Define as short unsigned for compatibility with MS runtime. */
136 #undef WINT_TYPE
137 #define WINT_TYPE "short unsigned int"
139 /* mingw32 uses the -mthreads option to enable thread support. */
140 #undef GOMP_SELF_SPECS
141 #define GOMP_SELF_SPECS "%{fopenmp: -mthreads}"
143 /* mingw32 atexit function is safe to use in shared libraries. Use it
144 to register C++ static destructors. */
145 #define TARGET_CXX_USE_ATEXIT_FOR_CXA_ATEXIT hook_bool_void_true
147 /* JCR_SECTION works on mingw32. */
148 #undef TARGET_USE_JCR_SECTION
149 #define TARGET_USE_JCR_SECTION 1
151 #if !TARGET_64BIT
152 #define MD_UNWIND_SUPPORT "config/i386/w32-unwind.h"
153 #endif