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

Message ID 8aaf145c772b2d3752b0ae08ce93de34494b7020.1690417818.git.research_trasio@irq.a4lg.com
State Unresolved
Headers
Series RISC-V: Add complex extension implications (incl. 'C'+'[FD]') |

Checks

Context Check Description
snail/binutils-gdb-check warning Git am fail log

Commit Message

Tsukasa OI July 27, 2023, 12:30 a.m. UTC
  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(-)
  

Patch

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);
     }