[RFC PATCH 3/3] RISC-V: ".option norvc" to disable 'C' and subsets

Tsukasa OI research_trasio@irq.a4lg.com
Thu Jul 27 00:30:21 GMT 2023


From: Tsukasa OI <research_trasio@irq.a4lg.com>

Despite its deprecation, ".option norvc" may used to turn off the 'C'
extension.  This commit also disables its subsets, 'Zca', 'Zcf' and 'Zcd'
and clarifies that it won't completely do the job if other enabled
extensions depend on 'C' or 'Zc*'.

Note that, even if it does not "completely" work, we cannot emit any
compressed instructions after the ".option norvc" directive since it
disables RVC and prevents any 2-byte instructions from assembling.

gas/ChangeLog:

	* config/tc-riscv.c (s_riscv_option): Also turn off 'Zca', 'Zcf'
	and 'Zcd'.  Clarify the limitation of this directive.
---
 gas/config/tc-riscv.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c
index aaf8b9be64fd..4c582e7813b0 100644
--- a/gas/config/tc-riscv.c
+++ b/gas/config/tc-riscv.c
@@ -4351,7 +4351,11 @@ s_riscv_option (int x ATTRIBUTE_UNUSED)
     }
   else if (strcmp (name, "norvc") == 0)
     {
-      riscv_update_subset (&riscv_rps_as, "-c");
+      /* Compatibility:
+	 Disable classic 'C' extension and its subsets.
+	 It won't completely disable them if other enabled extensions
+	 depend on 'C' or 'Zc*'.  */
+      riscv_update_subset (&riscv_rps_as, "-c,-zca,-zcf,-zcd");
       riscv_reset_subsets_list_arch_str ();
       riscv_set_rvc (false);
     }
-- 
2.41.0



More information about the Binutils mailing list