OSDN Git Service

* config/i386/nwld.h (LINK_SPEC): Check -nodefaultlibs not
[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 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 TARGET_VERSION fprintf (stderr, " (x86 Cygwin)");
23
24 #define EXTRA_OS_CPP_BUILTINS()  /* Nothing.  */
25
26 #undef CPP_SPEC
27 #define CPP_SPEC "%(cpp_cpu) %{posix:-D_POSIX_SOURCE} \
28   -D__CYGWIN32__ -D__CYGWIN__ %{!ansi:-Dunix} -D__unix__ -D__unix \
29   %{mwin32:-DWIN32 -D_WIN32 -D__WIN32 -D__WIN32__ %{!ansi:-DWINNT}} \
30   %{!nostdinc:%{!mno-win32:-idirafter ../include/w32api%s -idirafter ../../include/w32api%s}}\
31 "
32
33 #undef STARTFILE_SPEC
34 #define STARTFILE_SPEC "\
35   %{!shared: %{!mdll: crt0%O%s \
36   %{pg:gcrt0%O%s}}}\
37   crtbegin.o%s"
38
39 #undef ENDFILE_SPEC
40 #define ENDFILE_SPEC \
41   "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s}\
42    crtend.o%s"
43
44 /* Normally, -lgcc is not needed since everything in it is in the DLL, but we
45    want to allow things to be added to it when installing new versions of
46    GCC without making a new CYGWIN.DLL, so we leave it.  Profiling is handled
47    by calling the init function from main.  */
48
49 #ifdef ENABLE_SHARED_LIBGCC
50 #define SHARED_LIBGCC_SPEC " \
51  %{static|static-libgcc:-lgcc -lgcc_eh} \
52  %{!static: \
53    %{!static-libgcc: \
54      %{!shared: \
55        %{!shared-libgcc:-lgcc -lgcc_eh} \
56        %{shared-libgcc:-lgcc_s -lgcc} \
57       } \
58      %{shared:-lgcc_s -lgcc} \
59     } \
60   } "
61 #else
62 #define SHARED_LIBGCC_SPEC " -lgcc "
63 #endif
64
65 #undef REAL_LIBGCC_SPEC
66 #define REAL_LIBGCC_SPEC SHARED_LIBGCC_SPEC
67
68 /* We have to dynamic link to get to the system DLLs.  All of libc, libm and
69    the Unix stuff is in cygwin.dll.  The import library is called
70    'libcygwin.a'.  For Windows applications, include more libraries, but
71    always include kernel32.  We'd like to specific subsystem windows to
72    ld, but that doesn't work just yet.  */
73
74 #undef LIB_SPEC
75 #define LIB_SPEC "\
76   %{pg:-lgmon} \
77   -lcygwin \
78   %{mwindows:-lgdi32 -lcomdlg32} \
79   -ladvapi32 -lshell32 -luser32 -lkernel32"
80
81 /* To implement C++ function replacement we always wrap the cxx
82    malloc-like operators.  See N2800 #17.6.4.6 [replacement.functions] */
83 #define CXX_WRAP_SPEC_LIST " \
84   --wrap _Znwj \
85   --wrap _Znaj \
86   --wrap _ZdlPv \
87   --wrap _ZdaPv \
88   --wrap _ZnwjRKSt9nothrow_t \
89   --wrap _ZnajRKSt9nothrow_t \
90   --wrap _ZdlPvRKSt9nothrow_t \
91   --wrap _ZdaPvRKSt9nothrow_t \
92 "
93
94 #if defined (USE_CYGWIN_LIBSTDCXX_WRAPPERS)
95
96 #if USE_CYGWIN_LIBSTDCXX_WRAPPERS
97 /* Default on, only explict -mno disables.  */
98 #define CXX_WRAP_SPEC_OPT "!mno-use-libstdc-wrappers"
99 #else
100 /* Default off, only explict -m enables.  */
101 #define CXX_WRAP_SPEC_OPT "muse-libstdc-wrappers"
102 #endif
103
104 #define CXX_WRAP_SPEC "%{" CXX_WRAP_SPEC_OPT ":" CXX_WRAP_SPEC_LIST "}"
105
106 #else /* !defined (USE_CYGWIN_LIBSTDCXX_WRAPPERS)  */
107
108 #define CXX_WRAP_SPEC ""
109
110 #endif /* ?defined (USE_CYGWIN_LIBSTDCXX_WRAPPERS) */
111
112 #define LINK_SPEC "\
113   %{mwindows:--subsystem windows} \
114   %{mconsole:--subsystem console} \
115   " CXX_WRAP_SPEC " \
116   %{shared: %{mdll: %eshared and mdll are not compatible}} \
117   %{shared: --shared} %{mdll:--dll} \
118   %{static:-Bstatic} %{!static:-Bdynamic} \
119   %{shared|mdll: --enable-auto-image-base -e __cygwin_dll_entry@12} \
120   --dll-search-prefix=cyg -tsaware"
121
122 /* Binutils does not handle weak symbols from dlls correctly.  For now,
123    do not use them unnecessarily in gthr-posix.h.  */
124 #define GTHREAD_USE_WEAK 0
125
126 /* Every program on cygwin links against cygwin1.dll which contains 
127    the pthread routines.  There is no need to explicitly link them
128    and the -pthread flag is not recognized.  */
129 #undef GOMP_SELF_SPECS
130 #define GOMP_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*/ "-12.dll"
142