]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/config/freebsd-spec.h
Update copyright years.
[thirdparty/gcc.git] / gcc / config / freebsd-spec.h
CommitLineData
b6458e85 1/* Base configuration file for all FreeBSD targets.
a945c346 2 Copyright (C) 1999-2024 Free Software Foundation, Inc.
b6458e85 3
7ec022b2 4This file is part of GCC.
b6458e85 5
7ec022b2 6GCC is free software; you can redistribute it and/or modify
b6458e85 7it under the terms of the GNU General Public License as published by
2f83c7d6 8the Free Software Foundation; either version 3, or (at your option)
b6458e85
DB
9any later version.
10
7ec022b2 11GCC is distributed in the hope that it will be useful,
b6458e85
DB
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
748086b7
JJ
16Under Section 7 of GPL version 3, you are granted additional
17permissions described in the GCC Runtime Library Exception, version
183.1, as published by the Free Software Foundation.
19
20You should have received a copy of the GNU General Public License and
21a copy of the GCC Runtime Library Exception along with this program;
22see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
2f83c7d6 23<http://www.gnu.org/licenses/>. */
b6458e85
DB
24
25/* Common FreeBSD configuration.
26 All FreeBSD architectures should include this file, which will specify
27 their commonalities.
28 Adapted from gcc/config/freebsd.h by
29 David O'Brien <obrien@FreeBSD.org>
30 Loren J. Rittle <ljrittle@acm.org>. */
31
32
33/* In case we need to know. */
34#define USING_CONFIG_FREEBSD_SPEC 1
35
7358f10d
LR
36#define FBSD_TARGET_OS_CPP_BUILTINS() \
37 do \
38 { \
4976b95c 39 builtin_define_with_int_value ("__FreeBSD__", FBSD_MAJOR); \
7358f10d 40 builtin_define_std ("unix"); \
7358f10d
LR
41 builtin_define ("__KPRINTF_ATTRIBUTE__"); \
42 builtin_assert ("system=unix"); \
43 builtin_assert ("system=bsd"); \
44 builtin_assert ("system=FreeBSD"); \
45 FBSD_TARGET_CPU_CPP_BUILTINS(); \
46 } \
47 while (0)
48
ff482c8d 49/* Define the default FreeBSD-specific per-CPU hook code. */
7358f10d 50#define FBSD_TARGET_CPU_CPP_BUILTINS() do {} while (0)
b6458e85
DB
51
52/* Provide a CPP_SPEC appropriate for FreeBSD. We just deal with the GCC
53 option `-posix', and PIC issues. */
54
55#define FBSD_CPP_SPEC " \
56 %(cpp_cpu) \
f1aa042f 57 %(cpp_arch) \
b6458e85
DB
58 %{posix:-D_POSIX_SOURCE}"
59
60/* Provide a STARTFILE_SPEC appropriate for FreeBSD. Here we add
61 the magical crtbegin.o file (see crtstuff.c) which provides part
62 of the support for getting C++ file-scope static object constructed
991b6592 63 before entering `main'. */
b6458e85
DB
64
65#define FBSD_STARTFILE_SPEC \
66 "%{!shared: \
67 %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} \
68 %{!p:%{profile:gcrt1.o%s} \
8ea0dcb9
AT
69 %{!profile: \
70 %{pie: Scrt1.o%s;:crt1.o%s}}}}} \
71 crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
b6458e85
DB
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 \
8ea0dcb9 80 "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
b6458e85 81
1eae4574
GP
82/* When threads support is requested include both -lc and the threading
83 library (which assumes FreeBSD 5.x or later, __FreeBSD_version 500016
84 to be precise).
85 And make it a hard error if -pthread is provided on the command
1763d000
DB
86 line and gcc was configured with --disable-threads (this will help
87 avoid bug reports from users complaining about threading when they
b6458e85
DB
88 misconfigured the gcc bootstrap but are later consulting FreeBSD
89 manual pages that refer to the mythical -pthread option). */
90
91/* Provide a LIB_SPEC appropriate for FreeBSD. Just select the appropriate
92 libc, depending on whether we're doing profiling or need threads support.
35fd3193 93 (similar to the default, except no -lg, and no -p). */
b6458e85
DB
94
95#ifdef FBSD_NO_THREADS
96#define FBSD_LIB_SPEC " \
97 %{pthread: %eThe -pthread option is only supported on FreeBSD when gcc \
98is built with the --enable-threads configure-time option.} \
99 %{!shared: \
100 %{!pg: -lc} \
101 %{pg: -lc_p} \
102 }"
103#else
92018897
DB
104#define FBSD_LIB_SPEC " \
105 %{!shared: \
106 %{!pg: %{pthread:-lpthread} -lc} \
107 %{pg: %{pthread:-lpthread_p} -lc_p} \
67932abf
AG
108 } \
109 %{shared: \
110 %{pthread:-lpthread} -lc \
92018897 111 }"
b6458e85 112#endif
1eae4574
GP
113
114/* To make matters interesting, we can't actually use __FreeBSD_version
115 provided by <osreldate.h> directly since it breaks cross-compiling. */
2de2f846
DB
116
117#if FBSD_MAJOR < 6
118#define FBSD_DYNAMIC_LINKER "/usr/libexec/ld-elf.so.1"
119#else
120#define FBSD_DYNAMIC_LINKER "/libexec/ld-elf.so.1"
121#endif
2208d2ac 122
deb3f362
JJ
123/* NOTE: The freebsd-spec.h header is included also for various
124 non-FreeBSD powerpc targets, thus it should never define macros
125 other than FBSD_* prefixed ones, or USING_CONFIG_FREEBSD_SPEC. */