* Makefile.in (rtlanal.o): Depend on $(TM_P_H).
[official-gcc.git] / gcc / config / freebsd.h
blob56d16c330a78f41283955bb5bee9991c93d4f260
1 /* Base configuration file for all FreeBSD targets.
2 Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
4 This file is part of GNU CC.
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.
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.
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. */
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>. */
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. */
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')
41 #undef SWITCH_TAKES_ARG
42 #define SWITCH_TAKES_ARG(CHAR) (FBSD_SWITCH_TAKES_ARG(CHAR))
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"))
50 #undef WORD_SWITCH_TAKES_ARG
51 #define WORD_SWITCH_TAKES_ARG(STR) (FBSD_WORD_SWITCH_TAKES_ARG(STR))
53 #if FBSD_MAJOR == 6
54 #define FBSD_CPP_PREDEFINES \
55 "-D__FreeBSD__=6 -Dunix -D__ELF__ -Asystem=unix -Asystem=bsd -Asystem=FreeBSD"
56 #endif
58 #if FBSD_MAJOR == 5
59 #define FBSD_CPP_PREDEFINES \
60 "-D__FreeBSD__=5 -Dunix -D__ELF__ -Asystem=unix -Asystem=bsd -Asystem=FreeBSD"
61 #endif
63 #if FBSD_MAJOR == 4
64 #define FBSD_CPP_PREDEFINES \
65 "-D__FreeBSD__=4 -Dunix -D__ELF__ -Asystem=unix -Asystem=bsd -Asystem=FreeBSD"
66 #endif
68 #if FBSD_MAJOR == 3
69 #define FBSD_CPP_PREDEFINES \
70 "-D__FreeBSD__=3 -Dunix -D__ELF__ -Asystem=unix -Asystem=bsd -Asystem=FreeBSD"
71 #endif
73 #ifndef FBSD_CPP_PREDEFINES
74 #define FBSD_CPP_PREDEFINES \
75 "-D__FreeBSD__ -Dunix -D__ELF__ -Asystem=unix -Asystem=bsd -Asystem=FreeBSD"
76 #endif
78 #undef CPP_PREDEFINES
79 #define CPP_PREDEFINES FBSD_CPP_PREDEFINES
81 /* Provide a CPP_SPEC appropriate for FreeBSD. We just deal with the GCC
82 option `-posix', and PIC issues. */
84 #undef CPP_SPEC
85 #define CPP_SPEC "%(cpp_cpu) \
86 %{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} \
87 %{posix:-D_POSIX_SOURCE}"
89 /* Provide a LIB_SPEC appropriate for FreeBSD as configured and as
90 required by the user-land thread model. Before __FreeBSD_version
91 500016, select the appropriate libc, depending on whether we're
92 doing profiling or need threads support. At __FreeBSD_version
93 500016 and later, when threads support is requested include both
94 -lc and -lc_r instead of only -lc_r. To make matters interesting,
95 we can't actually use __FreeBSD_version provided by <osreldate.h>
96 directly since it breaks cross-compiling. As a final twist, make
97 it a hard error if -pthread is provided on the command line and gcc
98 was configured with --disable-threads (this will help avoid bug
99 reports from users complaining about threading when they
100 misconfigured the gcc bootstrap but are later consulting FreeBSD
101 manual pages that refer to the mythical -pthread option). */
103 #undef LIB_SPEC
104 #ifdef FBSD_NO_THREADS
105 #define LIB_SPEC " \
106 %{pthread: %eThe -pthread option is only supported on FreeBSD when gcc \
107 is built with the --enable-threads configure-time option.} \
108 %{!shared: \
109 %{!pg: -lc} \
110 %{pg: -lc_p} \
112 #else
113 #if FBSD_MAJOR >= 5
114 #define LIB_SPEC " \
115 %{!shared: \
116 %{!pg: %{pthread:-lc_r} -lc} \
117 %{pg: %{pthread:-lc_r_p} -lc_p} \
119 #else
120 #define LIB_SPEC " \
121 %{!shared: \
122 %{!pg: \
123 %{!pthread:-lc} \
124 %{pthread:-lc_r}} \
125 %{pg: \
126 %{!pthread:-lc_p} \
127 %{pthread:-lc_r_p}} \
129 #endif
130 #endif
132 /* Code generation parameters. */
134 /* Make gcc agree with <machine/ansi.h>. */
136 #undef WCHAR_TYPE
137 #define WCHAR_TYPE "int"
139 #undef WCHAR_UNSIGNED
140 #define WCHAR_UNSIGNED 0
142 /* Don't default to pcc-struct-return, because gcc is the only compiler, and
143 we want to retain compatibility with older gcc versions
144 (even though the SVR4 ABI for the i386 says that records and unions are
145 returned in memory). */
146 #undef DEFAULT_PCC_STRUCT_RETURN
147 #define DEFAULT_PCC_STRUCT_RETURN 0
149 /* Ensure we the configuration knows our system correctly so we can link with
150 libraries compiled with the native cc. */
151 #undef NO_DOLLAR_IN_LABEL
153 /* The GNU tools operate better with dwarf2 than stabs. Since we
154 don't have any native tools to be compatible with, default to
155 dwarf2. */
156 #undef PREFERRED_DEBUGGING_TYPE
157 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
159 #undef IDENT_ASM_OP
160 #define IDENT_ASM_OP "\t.ident\t"
162 /* Output #ident as a .ident. */
163 #undef ASM_OUTPUT_IDENT
164 #define ASM_OUTPUT_IDENT(FILE, NAME) \
165 fprintf ((FILE), "%s\"%s\"\n", IDENT_ASM_OP, (NAME));
167 /* Miscellaneous parameters. */
169 /* Don't assume anything about the header files. */
170 #undef NO_IMPLICIT_EXTERN_C
171 #define NO_IMPLICIT_EXTERN_C
173 /* Allow #sccs in preprocessor. */
174 #define SCCS_DIRECTIVE
176 /* Handle #pragma weak and #pragma pack. */
177 #define HANDLE_SYSV_PRAGMA