]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/config/riscv/linux.h
Update copyright years.
[thirdparty/gcc.git] / gcc / config / riscv / linux.h
CommitLineData
09cae750 1/* Definitions for RISC-V GNU/Linux systems with ELF format.
99dee823 2 Copyright (C) 1998-2021 Free Software Foundation, Inc.
09cae750
PD
3
4This file is part of GCC.
5
6GCC is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 3, or (at your option)
9any later version.
10
11GCC is distributed in the hope that it will be useful,
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
16You should have received a copy of the GNU General Public License
17along with GCC; see the file COPYING3. If not see
18<http://www.gnu.org/licenses/>. */
19
20#define TARGET_OS_CPP_BUILTINS() \
21 do { \
22 GNU_USER_TARGET_OS_CPP_BUILTINS(); \
23 } while (0)
24
25#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-riscv" XLEN_SPEC "-" ABI_SPEC ".so.1"
26
4d30a85e
MC
27#define MUSL_ABI_SUFFIX \
28 "%{mabi=ilp32:-sf}" \
29 "%{mabi=ilp32f:-sp}" \
30 "%{mabi=ilp32d:}" \
31 "%{mabi=lp64:-sf}" \
32 "%{mabi=lp64f:-sp}" \
37d57ac9 33 "%{mabi=lp64d:}"
4d30a85e
MC
34
35#undef MUSL_DYNAMIC_LINKER
36#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-riscv" XLEN_SPEC MUSL_ABI_SUFFIX ".so.1"
37
09cae750
PD
38/* Because RISC-V only has word-sized atomics, it requries libatomic where
39 others do not. So link libatomic by default, as needed. */
40#undef LIB_SPEC
41#ifdef LD_AS_NEEDED_OPTION
42#define LIB_SPEC GNU_USER_TARGET_LIB_SPEC \
43 " %{pthread:" LD_AS_NEEDED_OPTION " -latomic " LD_NO_AS_NEEDED_OPTION "}"
44#else
45#define LIB_SPEC GNU_USER_TARGET_LIB_SPEC " -latomic "
46#endif
47
f1bdc63a
AW
48#define ICACHE_FLUSH_FUNC "__riscv_flush_icache"
49
9bc5ecf3
AS
50#define CPP_SPEC "%{pthread:-D_REENTRANT}"
51
37d57ac9
JW
52#define LD_EMUL_SUFFIX \
53 "%{mabi=lp64d:}" \
54 "%{mabi=lp64f:_lp64f}" \
55 "%{mabi=lp64:_lp64}" \
56 "%{mabi=ilp32d:}" \
57 "%{mabi=ilp32f:_ilp32f}" \
58 "%{mabi=ilp32:_ilp32}"
59
09cae750 60#define LINK_SPEC "\
37d57ac9 61-melf" XLEN_SPEC "lriscv" LD_EMUL_SUFFIX " \
559fb136 62%{mno-relax:--no-relax} \
09cae750
PD
63%{shared} \
64 %{!shared: \
65 %{!static: \
66 %{rdynamic:-export-dynamic} \
67 -dynamic-linker " GNU_USER_DYNAMIC_LINKER "} \
68 %{static:-static}}"
12af29ab
JW
69
70#define TARGET_ASM_FILE_END file_end_indicate_exec_stack
5e664ed0
JW
71
72#define STARTFILE_PREFIX_SPEC \
73 "/lib" XLEN_SPEC "/" ABI_SPEC "/ " \
74 "/usr/lib" XLEN_SPEC "/" ABI_SPEC "/ " \
75 "/lib/ " \
76 "/usr/lib/ "