OSDN Git Service

Fix clearing ZERO_REG
[pf3gnuchains/gcc-fork.git] / gcc / config / freebsd-spec.h
1 /* Base configuration file for all FreeBSD targets.
2    Copyright (C) 1999, 2000, 2001, 2004, 2005, 2007, 2009, 2010
3    Free Software Foundation, Inc.
4
5 This file is part of GCC.
6
7 GCC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3, or (at your option)
10 any later version.
11
12 GCC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 GNU General Public License for more details.
16
17 Under Section 7 of GPL version 3, you are granted additional
18 permissions described in the GCC Runtime Library Exception, version
19 3.1, as published by the Free Software Foundation.
20
21 You should have received a copy of the GNU General Public License and
22 a copy of the GCC Runtime Library Exception along with this program;
23 see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
24 <http://www.gnu.org/licenses/>.  */
25
26 /* Common FreeBSD configuration. 
27    All FreeBSD architectures should include this file, which will specify
28    their commonalities.
29    Adapted from gcc/config/freebsd.h by 
30    David O'Brien <obrien@FreeBSD.org>
31    Loren J. Rittle <ljrittle@acm.org>.  */
32
33
34 /* In case we need to know.  */
35 #define USING_CONFIG_FREEBSD_SPEC 1
36
37 #define FBSD_TARGET_OS_CPP_BUILTINS()                                   \
38   do                                                                    \
39     {                                                                   \
40         builtin_define_with_int_value ("__FreeBSD__", FBSD_MAJOR);      \
41         builtin_define_std ("unix");                                    \
42         builtin_define ("__KPRINTF_ATTRIBUTE__");                       \
43         builtin_assert ("system=unix");                                 \
44         builtin_assert ("system=bsd");                                  \
45         builtin_assert ("system=FreeBSD");                              \
46         FBSD_TARGET_CPU_CPP_BUILTINS();                                 \
47     }                                                                   \
48   while (0)
49
50 /* Define the default FreeBSD-specific per-CPU hook code.  */
51 #define FBSD_TARGET_CPU_CPP_BUILTINS() do {} while (0)
52
53 /* Provide a CPP_SPEC appropriate for FreeBSD.  We just deal with the GCC 
54    option `-posix', and PIC issues.  */
55
56 #define FBSD_CPP_SPEC "                                                 \
57   %(cpp_cpu)                                                            \
58   %(cpp_arch)                                                           \
59   %{posix:-D_POSIX_SOURCE}"
60
61 /* Provide a STARTFILE_SPEC appropriate for FreeBSD.  Here we add
62    the magical crtbegin.o file (see crtstuff.c) which provides part 
63         of the support for getting C++ file-scope static object constructed 
64         before entering `main'.  */
65    
66 #define FBSD_STARTFILE_SPEC \
67   "%{!shared: \
68      %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} \
69                        %{!p:%{profile:gcrt1.o%s} \
70                          %{!profile:crt1.o%s}}}} \
71    crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
72
73 /* Provide a ENDFILE_SPEC appropriate for FreeBSD.  Here we tack on
74    the magical crtend.o file (see crtstuff.c) which provides part of 
75         the support for getting C++ file-scope static object constructed 
76         before entering `main', followed by a normal "finalizer" file, 
77         `crtn.o'.  */
78
79 #define FBSD_ENDFILE_SPEC \
80   "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
81
82 /* Provide a LIB_SPEC appropriate for FreeBSD as configured and as
83    required by the user-land thread model.  Before __FreeBSD_version
84    500016, select the appropriate libc, depending on whether we're
85    doing profiling or need threads support.  At __FreeBSD_version
86    500016 and later, when threads support is requested include both
87    -lc and the threading lib instead of only -lc_r.  To make matters
88    interesting, we can't actually use __FreeBSD_version provided by
89    <osreldate.h> directly since it breaks cross-compiling.  As a final
90    twist, make it a hard error if -pthread is provided on the command
91    line and gcc was configured with --disable-threads (this will help
92    avoid bug reports from users complaining about threading when they
93    misconfigured the gcc bootstrap but are later consulting FreeBSD
94    manual pages that refer to the mythical -pthread option).  */
95
96 /* Provide a LIB_SPEC appropriate for FreeBSD.  Just select the appropriate
97    libc, depending on whether we're doing profiling or need threads support.
98    (similar to the default, except no -lg, and no -p).  */
99
100 #ifdef FBSD_NO_THREADS
101 #define FBSD_LIB_SPEC "                                                 \
102   %{pthread: %eThe -pthread option is only supported on FreeBSD when gcc \
103 is built with the --enable-threads configure-time option.}              \
104   %{!shared:                                                            \
105     %{!pg: -lc}                                                         \
106     %{pg:  -lc_p}                                                       \
107   }"
108 #else
109 #if FBSD_MAJOR < 5
110 #define FBSD_LIB_SPEC "                                                 \
111   %{!shared:                                                            \
112     %{!pg:                                                              \
113       %{!pthread:-lc}                                                   \
114       %{pthread:-lc_r}}                                                 \
115     %{pg:                                                               \
116       %{!pthread:-lc_p}                                                 \
117       %{pthread:-lc_r_p}}                                               \
118   }"
119 #else
120 #define FBSD_LIB_SPEC "                                                 \
121   %{!shared:                                                            \
122     %{!pg: %{pthread:-lpthread} -lc}                                    \
123     %{pg:  %{pthread:-lpthread_p} -lc_p}                                \
124   }                                                                     \
125   %{shared:                                                             \
126     %{pthread:-lpthread} -lc                                            \
127   }"
128 #endif
129 #endif
130
131 #if FBSD_MAJOR < 6
132 #define FBSD_DYNAMIC_LINKER "/usr/libexec/ld-elf.so.1"
133 #else
134 #define FBSD_DYNAMIC_LINKER "/libexec/ld-elf.so.1"
135 #endif
136
137 #if defined(HAVE_LD_EH_FRAME_HDR)
138 #define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
139 #endif
140
141 /* Use --as-needed -lgcc_s for eh support.  */
142 #ifdef HAVE_LD_AS_NEEDED
143 #define USE_LD_AS_NEEDED 1
144 #endif