OSDN Git Service

* config/vax/vax.h (target_flags, MASK_UNIX_ASM, MASK_VAXC_ALIGNMENT)
[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 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 /* Common FreeBSD configuration. 
22    All FreeBSD architectures should include this file, which will specify
23    their commonalities.
24    Adapted from gcc/config/freebsd.h by 
25    David O'Brien <obrien@FreeBSD.org>
26    Loren J. Rittle <ljrittle@acm.org>.  */
27
28
29 /* In case we need to know.  */
30 #define USING_CONFIG_FREEBSD_SPEC 1
31
32 /* This defines which switch letters take arguments.  On FreeBSD, most of
33    the normal cases (defined in gcc.c) apply, and we also have -h* and
34    -z* options (for the linker) (coming from SVR4).
35    We also have -R (alias --rpath), no -z, --soname (-h), --assert etc.  */
36
37 #define FBSD_SWITCH_TAKES_ARG(CHAR)                                     \
38   (DEFAULT_SWITCH_TAKES_ARG (CHAR)                                      \
39     || (CHAR) == 'h'                                                    \
40     || (CHAR) == 'z' /* ignored by ld */                                \
41     || (CHAR) == 'R')
42
43 /* This defines which multi-letter switches take arguments.  */
44
45 #define FBSD_WORD_SWITCH_TAKES_ARG(STR)                                 \
46   (DEFAULT_WORD_SWITCH_TAKES_ARG (STR)                                  \
47    || !strcmp ((STR), "rpath") || !strcmp ((STR), "rpath-link")         \
48    || !strcmp ((STR), "soname") || !strcmp ((STR), "defsym")            \
49    || !strcmp ((STR), "assert") || !strcmp ((STR), "dynamic-linker"))
50
51 #define FBSD_TARGET_OS_CPP_BUILTINS()                                   \
52   do                                                                    \
53     {                                                                   \
54         if (FBSD_MAJOR == 6)                                            \
55           builtin_define ("__FreeBSD__=6");                             \
56         else if (FBSD_MAJOR == 5)                                       \
57           builtin_define ("__FreeBSD__=5");                             \
58         else if (FBSD_MAJOR == 4)                                       \
59           builtin_define ("__FreeBSD__=4");                             \
60         else if (FBSD_MAJOR == 3)                                       \
61           builtin_define ("__FreeBSD__=3");                             \
62         else                                                            \
63           builtin_define ("__FreeBSD__");                               \
64         builtin_define_std ("unix");                                    \
65         builtin_define ("__KPRINTF_ATTRIBUTE__");                       \
66         builtin_assert ("system=unix");                                 \
67         builtin_assert ("system=bsd");                                  \
68         builtin_assert ("system=FreeBSD");                              \
69         FBSD_TARGET_CPU_CPP_BUILTINS();                                 \
70     }                                                                   \
71   while (0)
72
73 /* Define the default FreeBSD-specific per-CPU hook code.  */
74 #define FBSD_TARGET_CPU_CPP_BUILTINS() do {} while (0)
75
76 /* Provide a CPP_SPEC appropriate for FreeBSD.  We just deal with the GCC 
77    option `-posix', and PIC issues.  */
78
79 #define FBSD_CPP_SPEC "                                                 \
80   %(cpp_cpu)                                                            \
81   %{fPIC|fpic|fPIE|fpie:-D__PIC__ -D__pic__}                            \
82   %{posix:-D_POSIX_SOURCE}"
83
84 /* Provide a STARTFILE_SPEC appropriate for FreeBSD.  Here we add
85    the magical crtbegin.o file (see crtstuff.c) which provides part 
86         of the support for getting C++ file-scope static object constructed 
87         before entering `main'.  */
88    
89 #define FBSD_STARTFILE_SPEC \
90   "%{!shared: \
91      %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} \
92                        %{!p:%{profile:gcrt1.o%s} \
93                          %{!profile:crt1.o%s}}}} \
94    crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
95
96 /* Provide a ENDFILE_SPEC appropriate for FreeBSD.  Here we tack on
97    the magical crtend.o file (see crtstuff.c) which provides part of 
98         the support for getting C++ file-scope static object constructed 
99         before entering `main', followed by a normal "finalizer" file, 
100         `crtn.o'.  */
101
102 #define FBSD_ENDFILE_SPEC \
103   "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
104
105 /* Provide a LIB_SPEC appropriate for FreeBSD as configured and as
106    required by the user-land thread model.  Before __FreeBSD_version
107    500016, select the appropriate libc, depending on whether we're
108    doing profiling or need threads support.  At __FreeBSD_version
109    500016 and later, when threads support is requested include both
110    -lc and the threading lib instead of only -lc_r.  To make matters
111    interesting, we can't actually use __FreeBSD_version provided by
112    <osreldate.h> directly since it breaks cross-compiling.  As a final
113    twist, make it a hard error if -pthread is provided on the command
114    line and gcc was configured with --disable-threads (this will help
115    avoid bug reports from users complaining about threading when they
116    misconfigured the gcc bootstrap but are later consulting FreeBSD
117    manual pages that refer to the mythical -pthread option).  */
118
119 /* Provide a LIB_SPEC appropriate for FreeBSD.  Just select the appropriate
120    libc, depending on whether we're doing profiling or need threads support.
121    (similar to the default, except no -lg, and no -p).  */
122
123 #ifdef FBSD_NO_THREADS
124 #define FBSD_LIB_SPEC "                                                 \
125   %{pthread: %eThe -pthread option is only supported on FreeBSD when gcc \
126 is built with the --enable-threads configure-time option.}              \
127   %{!shared:                                                            \
128     %{!pg: -lc}                                                         \
129     %{pg:  -lc_p}                                                       \
130   }"
131 #else
132 #if FBSD_MAJOR < 5
133 #define FBSD_LIB_SPEC "                                                 \
134   %{!shared:                                                            \
135     %{!pg:                                                              \
136       %{!pthread:-lc}                                                   \
137       %{pthread:-lc_r}}                                                 \
138     %{pg:                                                               \
139       %{!pthread:-lc_p}                                                 \
140       %{pthread:-lc_r_p}}                                               \
141   }"
142 #else
143 #define FBSD_LIB_SPEC "                                                 \
144   %{!shared:                                                            \
145     %{!pg: %{pthread:-lpthread} -lc}                                    \
146     %{pg:  %{pthread:-lpthread_p} -lc_p}                                \
147   }"
148 #endif
149 #endif
150
151 #if FBSD_MAJOR < 6
152 #define FBSD_DYNAMIC_LINKER "/usr/libexec/ld-elf.so.1"
153 #else
154 #define FBSD_DYNAMIC_LINKER "/libexec/ld-elf.so.1"
155 #endif