1 /* Operating system specific defines to be used when targeting GCC for
2 hosting on Windows32, using a Unix style C library and tools.
3 Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
4 2007, 2008, 2009 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)
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 #define TARGET_VERSION fprintf (stderr, " (x86 Cygwin)");
24 #define EXTRA_OS_CPP_BUILTINS() /* Nothing. */
27 #define CPP_SPEC "%(cpp_cpu) %{posix:-D_POSIX_SOURCE} \
28 %{mno-win32:%{mno-cygwin: %emno-cygwin and mno-win32 are not compatible}} \
29 %{mno-cygwin:-D__MSVCRT__ -D__MINGW32__ %{!ansi:%{mthreads:-D_MT}}}\
30 %{!mno-cygwin:-D__CYGWIN32__ -D__CYGWIN__ %{!ansi:-Dunix} -D__unix__ -D__unix }\
31 %{mwin32|mno-cygwin:-DWIN32 -D_WIN32 -D__WIN32 -D__WIN32__ %{!ansi:-DWINNT}}\
32 %{!nostdinc:%{!mno-win32|mno-cygwin:-idirafter ../include/w32api%s -idirafter ../../include/w32api%s}}\
36 #define STARTFILE_SPEC "\
37 %{shared|mdll: %{mno-cygwin:dllcrt2%O%s}}\
38 %{!shared: %{!mdll: %{!mno-cygwin:crt0%O%s} %{mno-cygwin:crt2%O%s}\
43 #define ENDFILE_SPEC \
44 "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s}\
47 /* Normally, -lgcc is not needed since everything in it is in the DLL, but we
48 want to allow things to be added to it when installing new versions of
49 GCC without making a new CYGWIN.DLL, so we leave it. Profiling is handled
50 by calling the init function from main. */
52 #ifdef ENABLE_SHARED_LIBGCC
53 #define SHARED_LIBGCC_SPEC " \
54 %{static|static-libgcc:-lgcc -lgcc_eh} \
58 %{!shared-libgcc:-lgcc -lgcc_eh} \
59 %{shared-libgcc:-lgcc_s -lgcc} \
61 %{shared:-lgcc_s -lgcc} \
65 #define SHARED_LIBGCC_SPEC " -lgcc "
68 #undef REAL_LIBGCC_SPEC
69 #define REAL_LIBGCC_SPEC \
70 "%{mno-cygwin: %{mthreads:-lmingwthrd} -lmingw32} \
71 " SHARED_LIBGCC_SPEC " \
72 %{mno-cygwin:-lmoldname -lmingwex -lmsvcrt}"
74 /* We have to dynamic link to get to the system DLLs. All of libc, libm and
75 the Unix stuff is in cygwin.dll. The import library is called
76 'libcygwin.a'. For Windows applications, include more libraries, but
77 always include kernel32. We'd like to specific subsystem windows to
78 ld, but that doesn't work just yet. */
83 %{!mno-cygwin:-lcygwin} \
84 %{mno-cygwin:%{mthreads:-lmingwthrd} -lmingw32} \
85 %{mwindows:-lgdi32 -lcomdlg32} \
86 -luser32 -lkernel32 -ladvapi32 -lshell32"
88 /* To implement C++ function replacement we always wrap the cxx
89 malloc-like operators. See N2800 #17.6.4.6 [replacement.functions] */
90 #define CXX_WRAP_SPEC_LIST " \
95 --wrap _ZnwjRKSt9nothrow_t \
96 --wrap _ZnajRKSt9nothrow_t \
97 --wrap _ZdlPvRKSt9nothrow_t \
98 --wrap _ZdaPvRKSt9nothrow_t \
101 #if defined (USE_CYGWIN_LIBSTDCXX_WRAPPERS)
103 #if USE_CYGWIN_LIBSTDCXX_WRAPPERS
104 /* Default on, only explict -mno disables. */
105 #define CXX_WRAP_SPEC_OPT "!mno-use-libstdc-wrappers"
107 /* Default off, only explict -m enables. */
108 #define CXX_WRAP_SPEC_OPT "muse-libstdc-wrappers"
111 #define CXX_WRAP_SPEC "%{" CXX_WRAP_SPEC_OPT ":" CXX_WRAP_SPEC_LIST "}"
113 #else /* !defined (USE_CYGWIN_LIBSTDCXX_WRAPPERS) */
115 #define CXX_WRAP_SPEC ""
117 #endif /* ?defined (USE_CYGWIN_LIBSTDCXX_WRAPPERS) */
120 %{mwindows:--subsystem windows} \
121 %{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: --enable-auto-image-base -e \
127 %{mno-cygwin:_DllMainCRTStartup@12} \
128 %{!mno-cygwin:__cygwin_dll_entry@12}}\
129 %{!mno-cygwin:--dll-search-prefix=cyg -tsaware}"
131 /* Allocate space for all of the machine-spec-specific stuff.
132 Allocate enough space for cygwin -> mingw32 munging plus
133 possible addition of "/mingw". */
135 #ifndef CYGWIN_MINGW_SUBDIR
136 #define CYGWIN_MINGW_SUBDIR "/mingw"
138 #define CYGWIN_MINGW_SUBDIR_LEN (sizeof (CYGWIN_MINGW_SUBDIR) - 1)
140 #ifdef GPLUSPLUS_INCLUDE_DIR
141 char cygwin_gplusplus_include_dir[sizeof (GPLUSPLUS_INCLUDE_DIR) + 1
142 + (CYGWIN_MINGW_SUBDIR_LEN)]
143 = GPLUSPLUS_INCLUDE_DIR;
144 #undef GPLUSPLUS_INCLUDE_DIR
145 #define GPLUSPLUS_INCLUDE_DIR ((const char *) cygwin_gplusplus_include_dir)
146 #ifndef GEN_CVT_ARRAY
147 #define GEN_CVT_ARRAY
151 #ifdef GPLUSPLUS_TOOL_INCLUDE_DIR
152 char cygwin_gplusplus_tool_include_dir[sizeof (GPLUSPLUS_TOOL_INCLUDE_DIR) + 1
153 + CYGWIN_MINGW_SUBDIR_LEN]
154 = GPLUSPLUS_TOOL_INCLUDE_DIR;
155 #undef GPLUSPLUS_TOOL_INCLUDE_DIR
156 #define GPLUSPLUS_TOOL_INCLUDE_DIR ((const char *) cygwin_gplusplus_tool_include_dir)
157 #ifndef GEN_CVT_ARRAY
158 #define GEN_CVT_ARRAY
162 #ifdef GPLUSPLUS_BACKWARD_INCLUDE_DIR
163 char cygwin_gplusplus_backward_include_dir[sizeof (GPLUSPLUS_BACKWARD_INCLUDE_DIR) + 1
164 + CYGWIN_MINGW_SUBDIR_LEN]
165 = GPLUSPLUS_BACKWARD_INCLUDE_DIR;
166 #undef GPLUSPLUS_BACKWARD_INCLUDE_DIR
167 #define GPLUSPLUS_BACKWARD_INCLUDE_DIR ((const char *) cygwin_gplusplus_backward_include_dir)
168 #ifndef GEN_CVT_ARRAY
169 #define GEN_CVT_ARRAY
173 #ifdef LOCAL_INCLUDE_DIR
174 char cygwin_local_include_dir[sizeof (LOCAL_INCLUDE_DIR) + 1
175 + CYGWIN_MINGW_SUBDIR_LEN]
177 #undef LOCAL_INCLUDE_DIR
178 #define LOCAL_INCLUDE_DIR ((const char *) cygwin_local_include_dir)
179 #ifndef GEN_CVT_ARRAY
180 #define GEN_CVT_ARRAY
184 #ifdef CROSS_INCLUDE_DIR
185 char cygwin_cross_include_dir[sizeof (CROSS_INCLUDE_DIR) + 1
186 + CYGWIN_MINGW_SUBDIR_LEN]
188 #undef CROSS_INCLUDE_DIR
189 #define CROSS_INCLUDE_DIR ((const char *) cygwin_cross_include_dir)
190 #ifndef GEN_CVT_ARRAY
191 #define GEN_CVT_ARRAY
195 #ifdef TOOL_INCLUDE_DIR
196 char cygwin_tool_include_dir[sizeof (TOOL_INCLUDE_DIR) + 1
197 + CYGWIN_MINGW_SUBDIR_LEN]
199 #undef TOOL_INCLUDE_DIR
200 #define TOOL_INCLUDE_DIR ((const char *) cygwin_tool_include_dir)
202 #ifndef CROSS_DIRECTORY_STRUCTURE
203 #undef STANDARD_INCLUDE_DIR
204 #define STANDARD_INCLUDE_DIR "/usr/include"
205 char cygwin_standard_include_dir[sizeof (STANDARD_INCLUDE_DIR) + 1
206 + CYGWIN_MINGW_SUBDIR_LEN]
207 = STANDARD_INCLUDE_DIR;
208 #undef STANDARD_INCLUDE_DIR
209 #define STANDARD_INCLUDE_DIR ((const char *) cygwin_standard_include_dir)
212 #ifndef GEN_CVT_ARRAY
213 #define GEN_CVT_ARRAY
217 #ifndef GEN_CVT_ARRAY
218 extern char *cvt_to_mingw[];
220 char *cvt_to_mingw[] =
222 #ifdef GPLUSPLUS_INCLUDE_DIR
223 cygwin_gplusplus_include_dir,
226 #ifdef GPLUSPLUS_TOOL_INCLUDE_DIR
227 cygwin_gplusplus_tool_include_dir,
230 #ifdef GPLUSPLUS_BACKWARD_INCLUDE_DIR
231 cygwin_gplusplus_backward_include_dir,
234 #ifdef LOCAL_INCLUDE_DIR
235 cygwin_local_include_dir,
238 #ifdef CROSS_INCLUDE_DIR
239 cygwin_cross_include_dir,
242 #ifdef TOOL_INCLUDE_DIR
243 cygwin_tool_include_dir,
246 #ifdef STANDARD_INCLUDE_DIR
247 cygwin_standard_include_dir,
253 #endif /*GEN_CVT_ARRAY*/
255 void mingw_scan (int, const char * const *, const char **);
257 #define GCC_DRIVER_HOST_INITIALIZATION \
260 mingw_scan(argc, (const char * const *) argv, &spec_machine); \
264 #define GCC_DRIVER_HOST_INITIALIZATION \
267 char *cprefix = concat (tooldir_base_prefix, spec_machine, \
268 dir_separator_str, NULL); \
269 if (!IS_ABSOLUTE_PATH (cprefix)) \
270 cprefix = concat (standard_exec_prefix, spec_machine, dir_separator_str, \
271 spec_version, dir_separator_str, tooldir_prefix, NULL); \
272 add_prefix (&exec_prefixes,\
273 concat (cprefix, "../../../../", spec_machine, "/bin/", NULL), \
274 "BINUTILS", PREFIX_PRIORITY_LAST, 0, NULL); \
275 add_prefix (&exec_prefixes, cprefix, \
276 "BINUTILS", PREFIX_PRIORITY_LAST, 0, NULL); \
277 add_prefix (&startfile_prefixes,\
278 concat (standard_startfile_prefix, "w32api", NULL),\
279 "GCC", PREFIX_PRIORITY_LAST, 0, NULL);\
280 mingw_scan(argc, (const char * const *) argv, &spec_machine); \
285 /* Binutils does not handle weak symbols from dlls correctly. For now,
286 do not use them unnecessarily in gthr-posix.h. */
287 #define GTHREAD_USE_WEAK 0
289 /* Every program on cygwin links against cygwin1.dll which contains
290 the pthread routines. There is no need to explicitly link them
291 and the -pthread flag is not recognized. */
292 #undef GOMP_SELF_SPECS
293 #define GOMP_SELF_SPECS ""
295 /* This matches SHLIB_SONAME and SHLIB_SOVERSION in t-cygwin. */
296 #if DWARF2_UNWIND_INFO
297 #define LIBGCC_EH_EXTN ""
299 #define LIBGCC_EH_EXTN "-sjlj"
301 #define LIBGCC_SONAME "cyggcc_s" LIBGCC_EH_EXTN "-1.dll"
303 /* We should find a way to not have to update this manually. */
304 #define LIBGCJ_SONAME "cyggcj" /*LIBGCC_EH_EXTN*/ "-11.dll"