| 1 |
/* Definitions for RISC-V GNU/Linux systems with ELF format. |
| 2 |
Copyright (C) 1998-2025 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 3, 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 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 |
|
| 27 |
#define MUSL_ABI_SUFFIX \ |
| 28 |
"%{mabi=ilp32:-sf}" \ |
| 29 |
"%{mabi=ilp32f:-sp}" \ |
| 30 |
"%{mabi=ilp32d:}" \ |
| 31 |
"%{mabi=lp64:-sf}" \ |
| 32 |
"%{mabi=lp64f:-sp}" \ |
| 33 |
"%{mabi=lp64d:}" |
| 34 |
|
| 35 |
#undef MUSL_DYNAMIC_LINKER |
| 36 |
#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-riscv" XLEN_SPEC MUSL_ABI_SUFFIX ".so.1" |
| 37 |
|
| 38 |
#define ICACHE_FLUSH_FUNC "__riscv_flush_icache" |
| 39 |
|
| 40 |
#define CPP_SPEC "%{pthread:-D_REENTRANT}" |
| 41 |
|
| 42 |
#define LD_EMUL_SUFFIX \ |
| 43 |
"%{mabi=lp64d:}" \ |
| 44 |
"%{mabi=lp64f:_lp64f}" \ |
| 45 |
"%{mabi=lp64:_lp64}" \ |
| 46 |
"%{mabi=ilp32d:}" \ |
| 47 |
"%{mabi=ilp32f:_ilp32f}" \ |
| 48 |
"%{mabi=ilp32:_ilp32}" |
| 49 |
|
| 50 |
#define LINK_SPEC "\ |
| 51 |
-melf" XLEN_SPEC DEFAULT_ENDIAN_SPEC "riscv" LD_EMUL_SUFFIX " \ |
| 52 |
%{mno-relax:--no-relax} \ |
| 53 |
-X \ |
| 54 |
%{mbig-endian:-EB} \ |
| 55 |
%{mlittle-endian:-EL} \ |
| 56 |
%{shared} \ |
| 57 |
%{!shared: \ |
| 58 |
%{!static: \ |
| 59 |
%{!static-pie: \ |
| 60 |
%{rdynamic:-export-dynamic} \ |
| 61 |
-dynamic-linker " GNU_USER_DYNAMIC_LINKER "}} \ |
| 62 |
%{static:-static} %{static-pie:-static -pie --no-dynamic-linker -z text}}" |
| 63 |
|
| 64 |
#define STARTFILE_PREFIX_SPEC \ |
| 65 |
"/lib" XLEN_SPEC "/" ABI_SPEC "/ " \ |
| 66 |
"/usr/lib" XLEN_SPEC "/" ABI_SPEC "/ " \ |
| 67 |
"/lib/ " \ |
| 68 |
"/usr/lib/ " |
| 69 |
|
| 70 |
#define RISCV_USE_CUSTOMISED_MULTI_LIB select_by_abi |