aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/riscv/riscv-opts.h
diff options
context:
space:
mode:
authorKito Cheng <kito.cheng@sifive.com>2023-05-04 15:12:27 +0800
committerKito Cheng <kito.cheng@sifive.com>2023-05-08 15:00:51 +0800
commit17d683d4d3dc95d13096ec52ad9937a2b011f9a4 (patch)
tree7658f50831d89d8f711701eb1a7bac219e178765 /gcc/config/riscv/riscv-opts.h
parent31c70a7daa368767f0f58e0389deb2c69d9e14fd (diff)
downloadgcc-17d683d4d3dc95d13096ec52ad9937a2b011f9a4.zip
gcc-17d683d4d3dc95d13096ec52ad9937a2b011f9a4.tar.gz
gcc-17d683d4d3dc95d13096ec52ad9937a2b011f9a4.tar.bz2
RISC-V: Handle multi-lib path correclty for linux
RISC-V Linux encodes the ABI into the path, so in theory, we can only use that to select multi-lib paths, and no way to use different multi-lib paths between `rv32i/ilp32` and `rv32ima/ilp32`, we'll mapping both to `/lib/ilp32`. It's hard to do that with GCC's builtin multi-lib selection mechanism; builtin mechanism did the option string compare and then enumerate all possible reuse rules during the build time. However, it's impossible to RISC-V; we have a huge number of combinations of `-march`, so implementing a customized multi-lib selection becomes the only solution. Multi-lib configuration is only used for determines which ISA should be used when compiling the corresponding ABI variant after this patch. During the multi-lib selection stage, only consider -mabi as the only key to select the multi-lib path. gcc/ChangeLog: * common/config/riscv/riscv-common.cc (riscv_select_multilib_by_abi): New. (riscv_select_multilib): New. (riscv_compute_multilib): Extract logic to riscv_select_multilib and also handle select_by_abi. * config/riscv/elf.h (RISCV_USE_CUSTOMISED_MULTI_LIB): Change it to select_by_abi_arch_cmodel from 1. * config/riscv/linux.h (RISCV_USE_CUSTOMISED_MULTI_LIB): Define. * config/riscv/riscv-opts.h (enum riscv_multilib_select_kind): New.
Diffstat (limited to 'gcc/config/riscv/riscv-opts.h')
-rw-r--r--gcc/config/riscv/riscv-opts.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/config/riscv/riscv-opts.h b/gcc/config/riscv/riscv-opts.h
index 4207db2..1b2e6de 100644
--- a/gcc/config/riscv/riscv-opts.h
+++ b/gcc/config/riscv/riscv-opts.h
@@ -82,6 +82,15 @@ enum riscv_autovec_lmul_enum {
RVV_M8 = 8
};
+enum riscv_multilib_select_kind {
+ /* Select multilib by builtin way. */
+ select_by_builtin,
+ /* Select multilib by ABI, arch and code model. */
+ select_by_abi_arch_cmodel,
+ /* Select multilib by ABI only. */
+ select_by_abi,
+};
+
#define MASK_ZICSR (1 << 0)
#define MASK_ZIFENCEI (1 << 1)