OSDN Git Service

Pizza-lize :-)
[pf3gnuchains/gcc-fork.git] / gcc / config / i386 / cygwin.h
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.
5
6 This file is part of GCC.
7
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.
12
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.
17
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/>.  */
21
22 #define EXTRA_OS_CPP_BUILTINS()  /* Nothing.  */
23
24 #undef CPP_SPEC
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}}\
29 "
30
31 #undef STARTFILE_SPEC
32 #define STARTFILE_SPEC "\
33   %{!shared: %{!mdll: crt0%O%s \
34   %{pg:gcrt0%O%s}}}\
35   crtbegin.o%s"
36
37 #undef ENDFILE_SPEC
38 #define ENDFILE_SPEC \
39   "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s}\
40    crtend.o%s"
41
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.  */
46
47 #ifdef ENABLE_SHARED_LIBGCC
48 #define SHARED_LIBGCC_SPEC " \
49  %{static|static-libgcc:-lgcc -lgcc_eh} \
50  %{!static: \
51    %{!static-libgcc: \
52      %{!shared: \
53        %{!shared-libgcc:-lgcc -lgcc_eh} \
54        %{shared-libgcc:-lgcc_s -lgcc} \
55       } \
56      %{shared:-lgcc_s -lgcc} \
57     } \
58   } "
59 #else
60 #define SHARED_LIBGCC_SPEC " -lgcc "
61 #endif
62
63 #undef REAL_LIBGCC_SPEC
64 #define REAL_LIBGCC_SPEC SHARED_LIBGCC_SPEC
65
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.  */
71
72 #undef LIB_SPEC
73 #define LIB_SPEC "\
74   %{pg:-lgmon} \
75   -lcygwin \
76   %{mwindows:-lgdi32 -lcomdlg32} \
77   -ladvapi32 -lshell32 -luser32 -lkernel32"
78
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 " \
82   --wrap _Znwj \
83   --wrap _Znaj \
84   --wrap _ZdlPv \
85   --wrap _ZdaPv \
86   --wrap _ZnwjRKSt9nothrow_t \
87   --wrap _ZnajRKSt9nothrow_t \
88   --wrap _ZdlPvRKSt9nothrow_t \
89   --wrap _ZdaPvRKSt9nothrow_t \
90 "
91
92 #if defined (USE_CYGWIN_LIBSTDCXX_WRAPPERS)
93
94 #if USE_CYGWIN_LIBSTDCXX_WRAPPERS
95 /* Default on, only explict -mno disables.  */
96 #define CXX_WRAP_SPEC_OPT "!mno-use-libstdc-wrappers"
97 #else
98 /* Default off, only explict -m enables.  */
99 #define CXX_WRAP_SPEC_OPT "muse-libstdc-wrappers"
100 #endif
101
102 #define CXX_WRAP_SPEC "%{" CXX_WRAP_SPEC_OPT ":" CXX_WRAP_SPEC_LIST "}"
103
104 #else /* !defined (USE_CYGWIN_LIBSTDCXX_WRAPPERS)  */
105
106 #define CXX_WRAP_SPEC ""
107
108 #endif /* ?defined (USE_CYGWIN_LIBSTDCXX_WRAPPERS) */
109
110 #define LINK_SPEC "\
111   %{mwindows:--subsystem windows} \
112   %{mconsole:--subsystem console} \
113   " CXX_WRAP_SPEC " \
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"
119
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
123
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 ""
129 #undef GTM_SELF_SPECS
130 #define GTM_SELF_SPECS ""
131
132 /* This matches SHLIB_SONAME and SHLIB_SOVERSION in t-cygwin. */
133 #if DWARF2_UNWIND_INFO
134 #define LIBGCC_EH_EXTN ""
135 #else
136 #define LIBGCC_EH_EXTN "-sjlj"
137 #endif
138 #define LIBGCC_SONAME "cyggcc_s" LIBGCC_EH_EXTN "-1.dll"
139
140 /* We should find a way to not have to update this manually.  */
141 #define LIBGCJ_SONAME "cyggcj" /*LIBGCC_EH_EXTN*/ "-13.dll"
142