From f432b5e10e070d3ce005cf57d6b9f60658092268 Mon Sep 17 00:00:00 2001 From: Tsukasa OI Date: Fri, 9 Sep 2022 11:56:25 +0000 Subject: [PATCH] RISC-V: Add 'Smepmp' with 'Zicsr' dependency Volume II: Privileged Architecture of the RISC-V ISA Manual states that the privileged architecture requires the 'Zicsr' extension. However, current GNU Binutils has no direct way whether the program has dependency to the privileged architecture itself. As a workaround, we should add implications from privileged extensions that either add new CSRs, extend existing CSRs or depends on using CSRs. This commit adds the 'Smepmp' extension (that extends CSRs defined in the privileged architecture and should have indirect dependency to 'Zicsr'). bfd/ChangeLog: * elfxx-riscv.c (riscv_implicit_subsets): Add 'Smepmp' -> 'Zicsr' implication. (riscv_supported_std_s_ext): Add 'Smepmp'. --- bfd/elfxx-riscv.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bfd/elfxx-riscv.c b/bfd/elfxx-riscv.c index d9503c1dcda..896c0445770 100644 --- a/bfd/elfxx-riscv.c +++ b/bfd/elfxx-riscv.c @@ -1097,6 +1097,7 @@ static struct riscv_implicit_subset riscv_implicit_subsets[] = {"zks", "zbkx", check_implicit_always}, {"zks", "zksed", check_implicit_always}, {"zks", "zksh", check_implicit_always}, + {"smepmp", "zicsr", check_implicit_always}, {"smstateen", "zicsr", check_implicit_always}, {"sscofpmf", "zicsr", check_implicit_always}, {"sstc", "zicsr", check_implicit_always}, @@ -1213,6 +1214,7 @@ static struct riscv_supported_ext riscv_supported_std_z_ext[] = static struct riscv_supported_ext riscv_supported_std_s_ext[] = { + {"smepmp", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 }, {"smstateen", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 }, {"sscofpmf", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 }, {"sstc", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 },