[PATCH] RISC-V: Support pointer masking extension 1.0

Jerry Zhang Jian jerry.zhangjian@sifive.com
Mon Mar 17 12:16:35 GMT 2025


- Adding Ssnpm, Smnpm, Smmpm, Sspm, and Supm
- No new CSR added
- Pointer masking only applies to RV64
- Ref: https://github.com/riscv/riscv-j-extension/releases/download/pointer-masking-ratified/pointer-masking-ratified.pdf

Signed-off-by: Jerry Zhang Jian <jerry.zhangjian@sifive.com>
---
 bfd/elfxx-riscv.c                    | 35 ++++++++++++++++++++++++++++
 gas/testsuite/gas/riscv/march-help.l |  5 ++++
 2 files changed, 40 insertions(+)

diff --git a/bfd/elfxx-riscv.c b/bfd/elfxx-riscv.c
index fd2cb74df80..079ab574fa7 100644
--- a/bfd/elfxx-riscv.c
+++ b/bfd/elfxx-riscv.c
@@ -1477,6 +1477,11 @@ static struct riscv_supported_ext riscv_supported_std_s_ext[] =
   {"svnapot",		ISA_SPEC_CLASS_DRAFT,		1, 0, 0 },
   {"svpbmt",		ISA_SPEC_CLASS_DRAFT,		1, 0, 0 },
   {"ssqosid",		ISA_SPEC_CLASS_DRAFT,		1, 0, 0 },
+  {"ssnpm",		ISA_SPEC_CLASS_DRAFT, 1, 0, 0},
+  {"smnpm",		ISA_SPEC_CLASS_DRAFT, 1, 0, 0},
+  {"smmpm",		ISA_SPEC_CLASS_DRAFT, 1, 0, 0},
+  {"sspm",		ISA_SPEC_CLASS_DRAFT, 1, 0, 0},
+  {"supm",		ISA_SPEC_CLASS_DRAFT, 1, 0, 0},
   {NULL, 0, 0, 0, 0}
 };
 
@@ -2124,6 +2129,36 @@ riscv_parse_check_conflicts (riscv_parse_subset_t *rps)
 	(_("`xtheadvector' is conflict with the `v' extension"));
       no_conflict = false;
     }
+  if (riscv_lookup_subset (rps->subset_list, "ssnpm", &subset) && xlen != 64)
+    {
+      rps->error_handler (_ ("rv%d does not support the `ssnpm' extension"),
+			  xlen);
+      no_conflict = false;
+    }
+  if (riscv_lookup_subset (rps->subset_list, "smnpm", &subset) && xlen != 64)
+    {
+      rps->error_handler (_ ("rv%d does not support the `smnpm' extension"),
+			  xlen);
+      no_conflict = false;
+    }
+  if (riscv_lookup_subset (rps->subset_list, "smmpm", &subset) && xlen != 64)
+    {
+      rps->error_handler (_ ("rv%d does not support the `smmpm' extension"),
+			  xlen);
+      no_conflict = false;
+    }
+  if (riscv_lookup_subset (rps->subset_list, "sspm", &subset) && xlen != 64)
+    {
+      rps->error_handler (_ ("rv%d does not support the `sspm' extension"),
+			  xlen);
+      no_conflict = false;
+    }
+  if (riscv_lookup_subset (rps->subset_list, "supm", &subset) && xlen != 64)
+    {
+      rps->error_handler (_ ("rv%d does not support the `supm' extension"),
+			  xlen);
+      no_conflict = false;
+    }
 
   bool support_zve = false;
   bool support_zvl = false;
diff --git a/gas/testsuite/gas/riscv/march-help.l b/gas/testsuite/gas/riscv/march-help.l
index b7975ff9ade..7eb614003c5 100644
--- a/gas/testsuite/gas/riscv/march-help.l
+++ b/gas/testsuite/gas/riscv/march-help.l
@@ -140,6 +140,11 @@ All available -march extensions for RISC-V:
 	svnapot                                 1.0
 	svpbmt                                  1.0
 	ssqosid                                 1.0
+	ssnpm                                   1.0
+	smnpm                                   1.0
+	smmpm                                   1.0
+	sspm                                    1.0
+	supm                                    1.0
 	xcvalu                                  1.0
 	xcvbi                                   1.0
 	xcvbitmanip                             1.0
-- 
2.46.0



More information about the Binutils mailing list