OSDN Git Service

* config/freebsd.h (LIB_SPEC): Key the exact setting to
[pf3gnuchains/gcc-fork.git] / gcc / config / freebsd.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 GNU CC.
5
6 GNU CC 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 GNU CC 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 GNU CC; 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 /* Common FreeBSD configuration. 
22    All FreeBSD architectures should include this file, which will specify
23    their commonalities.
24    Adapted from gcc/config/i386/freebsd-elf.h by 
25    David O'Brien <obrien@FreeBSD.org>.  
26    Further work by David O'Brien <obrien@FreeBSD.org> and
27    Loren J. Rittle <ljrittle@acm.org>.  */
28
29
30 /* This defines which switch letters take arguments.  On FreeBSD, most of
31    the normal cases (defined in gcc.c) apply, and we also have -h* and
32    -z* options (for the linker) (coming from SVR4).
33    We also have -R (alias --rpath), no -z, --soname (-h), --assert etc.  */
34
35 #define FBSD_SWITCH_TAKES_ARG(CHAR)                                     \
36   (DEFAULT_SWITCH_TAKES_ARG (CHAR)                                      \
37     || (CHAR) == 'h'                                                    \
38     || (CHAR) == 'z' /* ignored by ld */                                \
39     || (CHAR) == 'R')
40
41 #undef SWITCH_TAKES_ARG
42 #define SWITCH_TAKES_ARG(CHAR) (FBSD_SWITCH_TAKES_ARG(CHAR))
43
44 #define FBSD_WORD_SWITCH_TAKES_ARG(STR)                                 \
45   (DEFAULT_WORD_SWITCH_TAKES_ARG (STR)                                  \
46    || !strcmp ((STR), "rpath") || !strcmp ((STR), "rpath-link")         \
47    || !strcmp ((STR), "soname") || !strcmp ((STR), "defsym")            \
48    || !strcmp ((STR), "assert") || !strcmp ((STR), "dynamic-linker"))
49
50 #undef WORD_SWITCH_TAKES_ARG
51 #define WORD_SWITCH_TAKES_ARG(STR) (FBSD_WORD_SWITCH_TAKES_ARG(STR))
52
53 #if FBSD_MAJOR == 6
54 #define FBSD_CPP_PREDEFINES \
55   "-D__FreeBSD__=6 -Dunix -D__ELF__ -Asystem=unix -Asystem=bsd -Asystem=FreeBSD"
56 #elif FBSD_MAJOR == 5
57 #define FBSD_CPP_PREDEFINES \
58   "-D__FreeBSD__=5 -Dunix -D__ELF__ -Asystem=unix -Asystem=bsd -Asystem=FreeBSD"
59 #elif FBSD_MAJOR == 4
60 #define FBSD_CPP_PREDEFINES \
61   "-D__FreeBSD__=4 -Dunix -D__ELF__ -Asystem=unix -Asystem=bsd -Asystem=FreeBSD"
62 #elif FBSD_MAJOR == 3
63 #define FBSD_CPP_PREDEFINES \
64   "-D__FreeBSD__=3 -Dunix -D__ELF__ -Asystem=unix -Asystem=bsd -Asystem=FreeBSD"
65 #else
66 #define FBSD_CPP_PREDEFINES \
67   "-D__FreeBSD__   -Dunix -D__ELF__ -Asystem=unix -Asystem=bsd -Asystem=FreeBSD"
68 #endif
69
70 #undef  CPP_PREDEFINES
71 #define CPP_PREDEFINES FBSD_CPP_PREDEFINES
72
73 /* Provide a CPP_SPEC appropriate for FreeBSD.  We just deal with the GCC 
74    option `-posix', and PIC issues.  */
75
76 #undef CPP_SPEC
77 #define CPP_SPEC "%(cpp_cpu)                                            \
78   %{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__}               \
79   %{posix:-D_POSIX_SOURCE}"
80
81 /* Provide a LIB_SPEC appropriate for FreeBSD as configured and as
82    required by the user-land thread model.  Before __FreeBSD_version
83    500016, select the appropriate libc, depending on whether we're
84    doing profiling or need threads support.  At __FreeBSD_version
85    500016 and later, when threads support is requested include both
86    -lc and -lc_r instead of only -lc_r.  To make matters interesting,
87    we can't actually use __FreeBSD_version provided by <osreldate.h>
88    directly since it breaks cross-compiling.  As a final twist, make
89    it a hard error if -pthread is provided on the command line and gcc
90    was configured with --disable-threads (this will help avoid bug
91    reports from users complaining about threading when they
92    misconfigured the gcc bootstrap but are later consulting FreeBSD
93    manual pages that refer to the mythical -pthread option).  */
94
95 #undef  LIB_SPEC
96 #ifdef FBSD_NO_THREADS
97 #define LIB_SPEC "                                                      \
98   %{pthread: %eThe -pthread option is only supported on FreeBSD when gcc \
99 is built with the --enable-threads configure-time option.}              \
100   %{!shared:                                                            \
101     %{!pg: -lc}                                                         \
102     %{pg:  -lc_p}                                                       \
103   }"
104 #else
105 #if FBSD_MAJOR >= 5
106 #define LIB_SPEC "                                                      \
107   %{!shared:                                                            \
108     %{!pg: %{pthread:-lc_r} -lc}                                        \
109     %{pg:  %{pthread:-lc_r_p} -lc_p}                                    \
110   }"
111 #else
112 #define LIB_SPEC "                                                      \
113   %{!shared:                                                            \
114     %{!pg:                                                              \
115       %{!pthread:-lc}                                                   \
116       %{pthread:-lc_r}}                                                 \
117     %{pg:                                                               \
118       %{!pthread:-lc_p}                                                 \
119       %{pthread:-lc_r_p}}                                               \
120   }"
121 #endif
122 #endif
123
124 /* Code generation parameters.  */
125
126 /* Make gcc agree with <machine/ansi.h>.  */
127
128 #undef WCHAR_TYPE
129 #define WCHAR_TYPE "int"
130
131 #undef WCHAR_UNSIGNED
132 #define WCHAR_UNSIGNED 0
133
134 /* Don't default to pcc-struct-return, because gcc is the only compiler, and
135    we want to retain compatibility with older gcc versions
136    (even though the SVR4 ABI for the i386 says that records and unions are
137    returned in memory).  */
138 #undef DEFAULT_PCC_STRUCT_RETURN
139 #define DEFAULT_PCC_STRUCT_RETURN 0
140
141 /* Ensure we the configuration knows our system correctly so we can link with
142    libraries compiled with the native cc.  */
143 #undef NO_DOLLAR_IN_LABEL
144
145 /* Use more efficient ``thunks'' to implement C++ vtables.  */
146 #undef DEFAULT_VTABLE_THUNKS
147 #define DEFAULT_VTABLE_THUNKS 1
148
149 /* The GNU tools operate better with dwarf2 than stabs.  Since we
150    don't have any native tools to be compatible with, default to
151    dwarf2.  */
152 #undef PREFERRED_DEBUGGING_TYPE
153 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
154
155 #undef IDENT_ASM_OP
156 #define IDENT_ASM_OP "\t.ident\t"
157
158 /* Output #ident as a .ident.  */
159 #undef ASM_OUTPUT_IDENT
160 #define ASM_OUTPUT_IDENT(FILE, NAME)                                    \
161   fprintf ((FILE), "%s\"%s\"\n", IDENT_ASM_OP, (NAME));
162
163 /* Miscellaneous parameters.  */
164
165 /* Don't assume anything about the header files.  */
166 #undef NO_IMPLICIT_EXTERN_C
167 #define NO_IMPLICIT_EXTERN_C
168
169 /* Allow #sccs in preprocessor.  */
170 #define SCCS_DIRECTIVE
171
172 /* Handle #pragma weak and #pragma pack.  */
173 #define HANDLE_SYSV_PRAGMA