]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/config/netbsd-elf.h
Update copyright years.
[thirdparty/gcc.git] / gcc / config / netbsd-elf.h
CommitLineData
f982f805 1/* Common configuration file for NetBSD ELF targets.
99dee823 2 Copyright (C) 2002-2021 Free Software Foundation, Inc.
f982f805
JT
3 Contributed by Wasabi Systems, Inc.
4
7ec022b2 5This file is part of GCC.
f982f805 6
7ec022b2 7GCC is free software; you can redistribute it and/or modify
f982f805 8it under the terms of the GNU General Public License as published by
2f83c7d6 9the Free Software Foundation; either version 3, or (at your option)
f982f805
JT
10any later version.
11
7ec022b2 12GCC is distributed in the hope that it will be useful,
f982f805
JT
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
2f83c7d6
NC
18along with GCC; see the file COPYING3. If not see
19<http://www.gnu.org/licenses/>. */
f982f805 20
52f4fff6
JT
21/* TARGET_OS_CPP_BUILTINS() common to all NetBSD ELF targets. */
22#define NETBSD_OS_CPP_BUILTINS_ELF() \
23 do \
24 { \
25 NETBSD_OS_CPP_BUILTINS_COMMON(); \
52f4fff6
JT
26 } \
27 while (0)
f982f805 28
f982f805
JT
29/* Provide a STARTFILE_SPEC appropriate for NetBSD ELF. Here we
30 provide support for the special GCC option -static. On ELF
31 targets, we also add the crtbegin.o file, which provides part
32 of the support for getting C++ file-scope static objects
33 constructed before entering "main". */
34
1ebe8c03 35#define NETBSD_STARTFILE_SPEC \
f982f805
JT
36 "%{!shared: \
37 %{pg:gcrt0%O%s} \
38 %{!pg: \
39 %{p:gcrt0%O%s} \
40 %{!p:crt0%O%s}}} \
f3226a90 41 %:if-exists(crti%O%s) \
152a5a9c 42 %{static:%:if-exists-else(crtbeginT%O%s crtbegin%O%s)} \
a0f503a0
MR
43 %{!static: \
44 %{!shared: \
45 %{!pie:crtbegin%O%s} \
46 %{pie:crtbeginS%O%s}} \
47 %{shared:crtbeginS%O%s}}"
f982f805 48
1ebe8c03
JT
49#undef STARTFILE_SPEC
50#define STARTFILE_SPEC NETBSD_STARTFILE_SPEC
51
f982f805
JT
52
53/* Provide an ENDFILE_SPEC appropriate for NetBSD ELF. Here we
54 add crtend.o, which provides part of the support for getting
55 C++ file-scope static objects deconstructed after exiting "main". */
56
1ebe8c03 57#define NETBSD_ENDFILE_SPEC \
a0f503a0
MR
58 "%{!shared: \
59 %{!pie:crtend%O%s} \
60 %{pie:crtendS%O%s}} \
61 %{shared:crtendS%O%s} \
f3226a90 62 %:if-exists(crtn%O%s)"
f982f805 63
1ebe8c03
JT
64#undef ENDFILE_SPEC
65#define ENDFILE_SPEC NETBSD_ENDFILE_SPEC
f982f805
JT
66
67/* Provide a LINK_SPEC appropriate for NetBSD ELF. Here we provide
68 support for the special GCC options -assert, -R, -rpath, -shared,
6bb5d2e7
JT
69 -nostdlib, -static, -rdynamic, and -dynamic-linker.
70
71 Target-specific code can use this in conjunction with any other
72 target-specific LINK_SPEC options.
73
74 Target-specific code must provide the %(netbsd_entry_point) spec. */
75
b27c1082
MT
76#define NETBSD_LINK_LD_ELF_SO_SPEC \
77 "%{!dynamic-linker:-dynamic-linker /usr/libexec/ld.elf_so}"
78
6bb5d2e7
JT
79#define NETBSD_LINK_SPEC_ELF \
80 "%{assert*} %{R*} %{rpath*} \
81 %{shared:-shared} \
12a87083 82 %{symbolic:-Bsymbolic} \
6bb5d2e7
JT
83 %{!shared: \
84 -dc -dp \
85 %{!nostdlib: \
7aed7dfc 86 %{!r: \
6bb5d2e7
JT
87 %{!e*:-e %(netbsd_entry_point)}}} \
88 %{!static: \
89 %{rdynamic:-export-dynamic} \
e59dabd2 90 -dynamic-linker /usr/libexec/ld.elf_so} \
f982f805 91 %{static:-static}}"
4392a547 92
b27c1082
MT
93/* Provide the standard list of subtarget extra specs for NetBSD targets. */
94#define NETBSD_SUBTARGET_EXTRA_SPECS \
95 { "netbsd_link_ld_elf_so", NETBSD_LINK_LD_ELF_SO_SPEC }, \
96 { "netbsd_cpp_spec", NETBSD_CPP_SPEC }, \
97 { "netbsd_link_spec", NETBSD_LINK_SPEC_ELF }, \
98 { "netbsd_entry_point", NETBSD_ENTRY_POINT }, \
99 { "netbsd_endfile_spec", NETBSD_ENDFILE_SPEC },
100
101#undef SUBTARGET_EXTRA_SPECS
102#define SUBTARGET_EXTRA_SPECS NETBSD_SUBTARGET_EXTRA_SPECS
103
4392a547
KW
104/* Use --as-needed -lgcc_s for eh support. */
105#ifdef HAVE_LD_AS_NEEDED
106#define USE_LD_AS_NEEDED 1
107#endif