[PATCH 2/4] RISC-V: Fixed that .option push/pop won't recover the xlen

Nelson Chu nelson@rivosinc.com
Fri Jul 4 05:42:37 GMT 2025


---
 gas/config/tc-riscv.c                     | 3 +++
 gas/testsuite/gas/riscv/option-arch-rvc.d | 8 ++++----
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c
index d0030de4681..60e4f5bf813 100644
--- a/gas/config/tc-riscv.c
+++ b/gas/config/tc-riscv.c
@@ -332,6 +332,7 @@ struct riscv_option_stack
   struct riscv_option_stack *next;
   struct riscv_set_options options;
   riscv_subset_list_t *subset_list;
+  unsigned xlen;
 };
 
 static struct riscv_option_stack *riscv_opts_stack = NULL;
@@ -5113,6 +5114,7 @@ s_riscv_option (int x ATTRIBUTE_UNUSED)
       s->next = riscv_opts_stack;
       s->options = riscv_opts;
       s->subset_list = riscv_rps_as.subset_list;
+      s->xlen = xlen;
       riscv_opts_stack = s;
       riscv_rps_as.subset_list = riscv_copy_subset_list (s->subset_list);
     }
@@ -5129,6 +5131,7 @@ s_riscv_option (int x ATTRIBUTE_UNUSED)
 	  riscv_opts_stack = s->next;
 	  riscv_opts = s->options;
 	  riscv_rps_as.subset_list = s->subset_list;
+	  xlen = s->xlen;
 	  riscv_release_subset_list (release_subsets);
 	  free (s);
 	}
diff --git a/gas/testsuite/gas/riscv/option-arch-rvc.d b/gas/testsuite/gas/riscv/option-arch-rvc.d
index 767854689cb..d41a057102b 100644
--- a/gas/testsuite/gas/riscv/option-arch-rvc.d
+++ b/gas/testsuite/gas/riscv/option-arch-rvc.d
@@ -12,11 +12,11 @@ SYMBOL TABLE:
 0+02 l       .text	0+00 \$xrv64i2p0
 0+06 l       .text	0+00 \$xrv32i2p0_f2p0_c2p0
 0+08 l       .text	0+00 \$xrv32i2p0_f2p0
-0+0c l       .text	0+00 \$xrv32i2p0_f2p0_d2p0_c2p0
-0+0e l       .text	0+00 \$xrv32i2p0_f2p0_d2p0
-0+12 l       .text	0+00 \$xrv32i2p0_f2p0_d2p0_zca1p0
+0+0c l       .text	0+00 \$xrv64i2p0_f2p0_d2p0_c2p0
+0+0e l       .text	0+00 \$xrv64i2p0_f2p0_d2p0
+0+12 l       .text	0+00 \$xrv64i2p0_f2p0_d2p0_zca1p0
 0+16 l       .text	0+00 \$xrv32i2p0_f2p0_zca1p0_zcf1p0
-0+1a l       .text	0+00 \$xrv32i2p0_f2p0_d2p0_zca1p0_zcd1p0
+0+1a l       .text	0+00 \$xrv64i2p0_f2p0_d2p0_zca1p0_zcd1p0
 0+0 l    d  .riscv.attributes	0+00 .riscv.attributes
 
 
-- 
2.39.5 (Apple Git-154)



More information about the Binutils mailing list