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, 2010, 2011 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 EXTRA_OS_CPP_BUILTINS() /* Nothing. */
25 #define CPP_SPEC "%(cpp_cpu) %{posix:-D_POSIX_SOURCE} \
26 -D__CYGWIN32__ -D__CYGWIN__ %{!ansi:-Dunix} -D__unix__ -D__unix \
27 %{mwin32:-DWIN32 -D_WIN32 -D__WIN32 -D__WIN32__ %{!ansi:-DWINNT}} \
28 %{!nostdinc:%{!mno-win32:-idirafter ../include/w32api%s -idirafter ../../include/w32api%s}}\
32 #define STARTFILE_SPEC "\
33 %{!shared: %{!mdll: crt0%O%s \
38 #define ENDFILE_SPEC \
39 "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s}\
42 /* Normally, -lgcc is not needed since everything in it is in the DLL, but we
43 want to allow things to be added to it when installing new versions of
44 GCC without making a new CYGWIN.DLL, so we leave it. Profiling is handled
45 by calling the init function from main. */
47 #ifdef ENABLE_SHARED_LIBGCC
48 #define SHARED_LIBGCC_SPEC " \
49 %{static|static-libgcc:-lgcc -lgcc_eh} \
53 %{!shared-libgcc:-lgcc -lgcc_eh} \
54 %{shared-libgcc:-lgcc_s -lgcc} \
56 %{shared:-lgcc_s -lgcc} \
60 #define SHARED_LIBGCC_SPEC " -lgcc "
63 #undef REAL_LIBGCC_SPEC
64 #define REAL_LIBGCC_SPEC SHARED_LIBGCC_SPEC
66 /* We have to dynamic link to get to the system DLLs. All of libc, libm and
67 the Unix stuff is in cygwin.dll. The import library is called
68 'libcygwin.a'. For Windows applications, include more libraries, but
69 always include kernel32. We'd like to specific subsystem windows to
70 ld, but that doesn't work just yet. */
76 %{mwindows:-lgdi32 -lcomdlg32} \
77 -ladvapi32 -lshell32 -luser32 -lkernel32"
79 /* To implement C++ function replacement we always wrap the cxx
80 malloc-like operators. See N2800 #17.6.4.6 [replacement.functions] */
81 #define CXX_WRAP_SPEC_LIST " \
86 --wrap _ZnwjRKSt9nothrow_t \
87 --wrap _ZnajRKSt9nothrow_t \
88 --wrap _ZdlPvRKSt9nothrow_t \
89 --wrap _ZdaPvRKSt9nothrow_t \
92 #if defined (USE_CYGWIN_LIBSTDCXX_WRAPPERS)
94 #if USE_CYGWIN_LIBSTDCXX_WRAPPERS
95 /* Default on, only explict -mno disables. */
96 #define CXX_WRAP_SPEC_OPT "!mno-use-libstdc-wrappers"
98 /* Default off, only explict -m enables. */
99 #define CXX_WRAP_SPEC_OPT "muse-libstdc-wrappers"
102 #define CXX_WRAP_SPEC "%{" CXX_WRAP_SPEC_OPT ":" CXX_WRAP_SPEC_LIST "}"
104 #else /* !defined (USE_CYGWIN_LIBSTDCXX_WRAPPERS) */
106 #define CXX_WRAP_SPEC ""
108 #endif /* ?defined (USE_CYGWIN_LIBSTDCXX_WRAPPERS) */
111 %{mwindows:--subsystem windows} \
112 %{mconsole:--subsystem console} \
114 %{shared: %{mdll: %eshared and mdll are not compatible}} \
115 %{shared: --shared} %{mdll:--dll} \
116 %{static:-Bstatic} %{!static:-Bdynamic} \
117 %{shared|mdll: --enable-auto-image-base -e __cygwin_dll_entry@12} \
118 --dll-search-prefix=cyg -tsaware"
120 /* Binutils does not handle weak symbols from dlls correctly. For now,
121 do not use them unnecessarily in gthr-posix.h. */
122 #define GTHREAD_USE_WEAK 0
124 /* Every program on cygwin links against cygwin1.dll which contains
125 the pthread routines. There is no need to explicitly link them
126 and the -pthread flag is not recognized. */
127 #undef GOMP_SELF_SPECS
128 #define GOMP_SELF_SPECS ""
130 /* This matches SHLIB_SONAME and SHLIB_SOVERSION in t-cygwin. */
131 #if DWARF2_UNWIND_INFO
132 #define LIBGCC_EH_EXTN ""
134 #define LIBGCC_EH_EXTN "-sjlj"
136 #define LIBGCC_SONAME "cyggcc_s" LIBGCC_EH_EXTN "-1.dll"
138 /* We should find a way to not have to update this manually. */
139 #define LIBGCJ_SONAME "cyggcj" /*LIBGCC_EH_EXTN*/ "-12.dll"