]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/gcc/config/freebsd-spec.h
This commit was generated by cvs2svn to compensate for changes in r147464,
[FreeBSD/FreeBSD.git] / contrib / gcc / config / freebsd-spec.h
1 /* Base configuration file for all FreeBSD targets.
2    Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
3
4 This file is part of GCC.
5
6 GCC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10
11 GCC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING.  If not, write to
18 the Free Software Foundation, 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA.  */
20
21 /* $FreeBSD$ */
22
23 /* Common FreeBSD configuration. 
24    All FreeBSD architectures should include this file, which will specify
25    their commonalities.
26    Adapted from gcc/config/freebsd.h by 
27    David O'Brien <obrien@FreeBSD.org>
28    Loren J. Rittle <ljrittle@acm.org>.  */
29
30
31 /* In case we need to know.  */
32 #define USING_CONFIG_FREEBSD_SPEC 1
33
34 /* This defines which switch letters take arguments.  On FreeBSD, most of
35    the normal cases (defined in gcc.c) apply, and we also have -h* and
36    -z* options (for the linker) (coming from SVR4).
37    We also have -R (alias --rpath), no -z, --soname (-h), --assert etc.  */
38
39 #define FBSD_SWITCH_TAKES_ARG(CHAR)                                     \
40   (DEFAULT_SWITCH_TAKES_ARG (CHAR)                                      \
41     || (CHAR) == 'h'                                                    \
42     || (CHAR) == 'z' /* ignored by ld */                                \
43     || (CHAR) == 'R')
44
45 /* This defines which multi-letter switches take arguments.  */
46
47 #define FBSD_WORD_SWITCH_TAKES_ARG(STR)                                 \
48   (DEFAULT_WORD_SWITCH_TAKES_ARG (STR)                                  \
49    || !strcmp ((STR), "rpath") || !strcmp ((STR), "rpath-link")         \
50    || !strcmp ((STR), "soname") || !strcmp ((STR), "defsym")            \
51    || !strcmp ((STR), "assert") || !strcmp ((STR), "dynamic-linker"))
52
53 #define FBSD_TARGET_OS_CPP_BUILTINS()                                   \
54   do                                                                    \
55     {                                                                   \
56         if (FBSD_MAJOR == 6)                                            \
57           builtin_define ("__FreeBSD__=6");                             \
58         else if (FBSD_MAJOR == 5)                                       \
59           builtin_define ("__FreeBSD__=5");                             \
60         else if (FBSD_MAJOR == 4)                                       \
61           builtin_define ("__FreeBSD__=4");                             \
62         else if (FBSD_MAJOR == 3)                                       \
63           builtin_define ("__FreeBSD__=3");                             \
64         else                                                            \
65           builtin_define ("__FreeBSD__");                               \
66         builtin_define_std ("unix");                                    \
67         builtin_define ("__KPRINTF_ATTRIBUTE__");                       \
68         builtin_assert ("system=unix");                                 \
69         builtin_assert ("system=bsd");                                  \
70         builtin_assert ("system=FreeBSD");                              \
71         FBSD_NATIVE_TARGET_OS_CPP_BUILTINS();                           \
72         FBSD_TARGET_CPU_CPP_BUILTINS();                                 \
73     }                                                                   \
74   while (0)
75
76 /* Define the default FreeBSD-specific per-CPU hook code. */
77 #define FBSD_TARGET_CPU_CPP_BUILTINS() do {} while (0)
78
79 #ifdef FREEBSD_NATIVE
80 #define FBSD_NATIVE_TARGET_OS_CPP_BUILTINS()                            \
81   do {                                                                  \
82         builtin_define_std ("__FreeBSD_cc_version=600001");             \
83   } while (0)
84 #else
85 #define FBSD_NATIVE_TARGET_OS_CPP_BUILTINS()                            \
86   do {} while (0)
87 #endif
88
89 /* Provide a CPP_SPEC appropriate for FreeBSD.  We just deal with the GCC 
90    option `-posix', and PIC issues.  Try to detect support for the
91    `long long' type.  Unfortunately the GCC spec parser will not allow us
92    to properly detect the "iso9899:1990" and "iso9899:199409" forms of
93    -std=c89.  Because of the ':' in the -std argument. :-(  I have left
94    them in the spec as a place holder in hopes someone knows a way to make
95    the detection of them work.  */
96
97 #define FBSD_CPP_SPEC "                                                 \
98   %(cpp_cpu)                                                            \
99   %{fPIC|fpic|fPIE|fpie:-D__PIC__ -D__pic__}                            \
100   %{!ansi:%{!std=c89:%{!std=iso9899.1990:%{!std=iso9899.199409:-D_LONGLONG}}}} \
101   %{posix:-D_POSIX_SOURCE}"
102
103 /* Provide a STARTFILE_SPEC appropriate for FreeBSD.  Here we add the magical
104    crtbegin.o file (see crtstuff.c) which provides part of the support for
105    getting C++ file-scope static object constructed before entering `main'.  */
106    
107 #define FBSD_STARTFILE_SPEC "\
108   %{!shared: \
109     %{pg:gcrt1.o%s} \
110     %{!pg: \
111       %{p:gcrt1.o%s} \
112       %{!p: \
113         %{profile:gcrt1.o%s} \
114         %{!profile:crt1.o%s}}}} \
115   crti.o%s \
116   %{!shared:crtbegin.o%s} \
117   %{shared:crtbeginS.o%s}"
118
119 /* Provide an ENDFILE_SPEC appropriate for FreeBSD/i386.  Here we tack on
120    our own magical crtend.o file (see crtstuff.c) which provides part of
121    the support for getting C++ file-scope static object constructed before
122    entering `main', followed by the normal "finalizer" file, `crtn.o'.  */
123
124 #define FBSD_ENDFILE_SPEC "\
125   %{!shared:crtend.o%s} \
126   %{shared:crtendS.o%s} \
127   crtn.o%s "
128
129 /* Provide a LIB_SPEC appropriate for FreeBSD as configured and as
130    required by the user-land thread model.  Before __FreeBSD_version
131    500016, select the appropriate libc, depending on whether we're
132    doing profiling or need threads support.  At __FreeBSD_version
133    500016 and later, when threads support is requested include both
134    -lc and the threading lib instead of only -lc_r.  To make matters
135    interesting, we can't actually use __FreeBSD_version provided by
136    <osreldate.h> directly since it breaks cross-compiling.  As a final
137    twist, make it a hard error if -pthread is provided on the command
138    line and gcc was configured with --disable-threads (this will help
139    avoid bug reports from users complaining about threading when they
140    misconfigured the gcc bootstrap but are later consulting FreeBSD
141    manual pages that refer to the mythical -pthread option).  */
142
143 /* Provide a LIB_SPEC appropriate for FreeBSD.  Just select the appropriate
144    libc, depending on whether we're doing profiling or need threads support.
145    (simular to the default, except no -lg, and no -p).  */
146
147 #ifdef FBSD_NO_THREADS
148 #define FBSD_LIB_SPEC "                                                 \
149   %{pthread: %eThe -pthread option is only supported on FreeBSD when gcc \
150 is built with the --enable-threads configure-time option.}              \
151   %{!shared:                                                            \
152     %{!pg: -lc}                                                         \
153     %{pg:  -lc_p}                                                       \
154   }"
155 #else
156 #include <sys/param.h>
157 #if __FreeBSD_version < 500016
158 #define FBSD_LIB_SPEC "                                                 \
159   %{!shared:                                                            \
160     %{!pg:                                                              \
161       %{!pthread:-lc}                                                   \
162       %{pthread:-lc_r}}                                                 \
163     %{pg:                                                               \
164       %{!pthread:-lc_p}                                                 \
165       %{pthread:-lc_r_p}}                                               \
166   }"
167 #else
168 #define FBSD_LIB_SPEC "                                                 \
169   %{!shared:                                                            \
170     %{!pg: %{pthread:-lpthread} -lc}                                    \
171     %{pg:  %{pthread:-lpthread_p} -lc_p}                                \
172   }"
173 #endif
174 #endif
175
176 #if FBSD_MAJOR < 5
177 #define FBSD_DYNAMIC_LINKER "/usr/libexec/ld-elf.so.1"
178 #else
179 #define FBSD_DYNAMIC_LINKER "/libexec/ld-elf.so.1"
180 #endif