[PATCH v2] RISC-V: Add support for the Shlcofideleg extension

Jiawei jiawei@iscas.ac.cn
Mon Nov 16 04:31:51 GMT 2026


Add Shlcofideleg 1.0, which permits delegation of local counter-overflow
interrupts to VS-mode.  Record its dependency on H and cover extension
recognition and implication in the assembler testsuite.

bfd/ChangeLog:

	* elfxx-riscv.c (riscv_implicit_subsets): Add Shlcofideleg.
	(riscv_supported_std_s_ext): Ditto.

gas/ChangeLog:

	* NEWS: Mention Shlcofideleg.
	* testsuite/gas/riscv/imply.s: Test its implication of H.
	* testsuite/gas/riscv/imply.d: Ditto.
	* testsuite/gas/riscv/march-help.l: New extension.

Signed-off-by: Jiawei <jiawei@iscas.ac.cn>
---
 bfd/elfxx-riscv.c                    | 2 ++
 gas/NEWS                             | 3 ++-
 gas/testsuite/gas/riscv/imply.d      | 1 +
 gas/testsuite/gas/riscv/imply.s      | 1 +
 gas/testsuite/gas/riscv/march-help.l | 1 +
 5 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/bfd/elfxx-riscv.c b/bfd/elfxx-riscv.c
index 31178c13193..6a16ceb760f 100644
--- a/bfd/elfxx-riscv.c
+++ b/bfd/elfxx-riscv.c
@@ -1354,6 +1354,7 @@ static const struct riscv_implicit_subset riscv_implicit_subsets[] =
 
   {"shcounterenw", "+h", check_implicit_always},
   {"shgatpa", "+h", check_implicit_always},
+  {"shlcofideleg", "+h", check_implicit_always},
   {"shtvala", "+h", check_implicit_always},
   {"shvsatpa", "+h", check_implicit_always},
   {"shvstvala", "+h", check_implicit_always},
@@ -1666,6 +1667,7 @@ static const struct riscv_supported_ext riscv_supported_std_s_ext[] =
   {"sha",		ISA_SPEC_CLASS_DRAFT,		1, 0, 0 },
   {"shcounterenw",	ISA_SPEC_CLASS_DRAFT,		1, 0, 0 },
   {"shgatpa",		ISA_SPEC_CLASS_DRAFT,		1, 0, 0 },
+  {"shlcofideleg",		ISA_SPEC_CLASS_DRAFT,		1, 0, 0 },
   {"shtvala",		ISA_SPEC_CLASS_DRAFT,		1, 0, 0 },
   {"shvsatpa",		ISA_SPEC_CLASS_DRAFT,		1, 0, 0 },
   {"shvstvala",		ISA_SPEC_CLASS_DRAFT,		1, 0, 0 },
diff --git a/gas/NEWS b/gas/NEWS
index cc1ef03a999..29a2c197018 100644
--- a/gas/NEWS
+++ b/gas/NEWS
@@ -14,7 +14,8 @@
 * Add support for new variants and encodings of RISC-V Zvabd extension v0.9.
 
 * Add support for RISC-V standard extensions:
-  ziccamoc 1.0, zama16b v1.0, sspmp v1.0, sspmpen v1.0 and smpmpdeleg v1.0.
+  ziccamoc 1.0, zama16b v1.0, sspmp v1.0, sspmpen v1.0, smpmpdeleg v1.0
+  and shlcofideleg v1.0.
 
 * The RISC-V option -mpriv-spec, the configure option --with-priv-spec and
   the privileged elf attributes set by .attribute are deprecated and have no
diff --git a/gas/testsuite/gas/riscv/imply.d b/gas/testsuite/gas/riscv/imply.d
index f3b93025330..56667cdfb9c 100644
--- a/gas/testsuite/gas/riscv/imply.d
+++ b/gas/testsuite/gas/riscv/imply.d
@@ -52,6 +52,7 @@ SYMBOL TABLE:
 [0-9a-f]+ l       .text	0+000 \$xrv32i2p1_h1p0_zicsr2p0_sha1p0_shcounterenw1p0_shgatpa1p0_shtvala1p0_shvsatpa1p0_shvstvala1p0_shvstvecd1p0_ssstateen1p0
 [0-9a-f]+ l       .text	0+000 \$xrv32i2p1_h1p0_zicsr2p0_shcounterenw1p0
 [0-9a-f]+ l       .text	0+000 \$xrv32i2p1_h1p0_zicsr2p0_shgatpa1p0
+[0-9a-f]+ l       .text	0+000 \$xrv32i2p1_h1p0_zicsr2p0_shlcofideleg1p0
 [0-9a-f]+ l       .text	0+000 \$xrv32i2p1_h1p0_zicsr2p0_shtvala1p0
 [0-9a-f]+ l       .text	0+000 \$xrv32i2p1_h1p0_zicsr2p0_shvsatpa1p0
 [0-9a-f]+ l       .text	0+000 \$xrv32i2p1_h1p0_zicsr2p0_shvstvala1p0
diff --git a/gas/testsuite/gas/riscv/imply.s b/gas/testsuite/gas/riscv/imply.s
index a029575e5a4..9c4087f5913 100644
--- a/gas/testsuite/gas/riscv/imply.s
+++ b/gas/testsuite/gas/riscv/imply.s
@@ -60,6 +60,7 @@ imply sha
 
 imply shcounterenw
 imply shgatpa
+imply shlcofideleg
 imply shtvala
 imply shvsatpa
 imply shvstvala
diff --git a/gas/testsuite/gas/riscv/march-help.l b/gas/testsuite/gas/riscv/march-help.l
index d69a290c4ab..7a8e671bb32 100644
--- a/gas/testsuite/gas/riscv/march-help.l
+++ b/gas/testsuite/gas/riscv/march-help.l
@@ -127,6 +127,7 @@ All available -march extensions for RISC-V:
 	sha                                     1.0
 	shcounterenw                            1.0
 	shgatpa                                 1.0
+	shlcofideleg                            1.0
 	shtvala                                 1.0
 	shvsatpa                                1.0
 	shvstvala                               1.0

base-commit: 2fd0db8608d730aceb123ed0cc6e5fae3967d4f9
-- 
2.43.0



More information about the Binutils mailing list