[PATCH 4/4] RISC-V: Fixed the broken .option norvc and .option arch, -c
Nelson Chu
nelson@rivosinc.com
Fri Jul 4 05:42:39 GMT 2025
---
bfd/elfxx-riscv.c | 9 ++++++++-
gas/testsuite/gas/riscv/option-arch-rvc.d | 13 ++++++++-----
2 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/bfd/elfxx-riscv.c b/bfd/elfxx-riscv.c
index 43d3c0d0884..87d4b462091 100644
--- a/bfd/elfxx-riscv.c
+++ b/bfd/elfxx-riscv.c
@@ -2707,7 +2707,14 @@ riscv_update_subset1 (riscv_parse_subset_t *rps,
}
if (removed)
- riscv_remove_subset (rps->subset_list, subset);
+ {
+ riscv_remove_subset (rps->subset_list, subset);
+
+ /* FIXME: This is a workaround that only make the c removal works,
+ but should find a way to correct others. */
+ if (strcmp (subset, "c") == 0)
+ riscv_update_subset (rps, "-zca,-zcd,-zcf");
+ }
else
{
riscv_subset_t *isubset = NULL;
diff --git a/gas/testsuite/gas/riscv/option-arch-rvc.d b/gas/testsuite/gas/riscv/option-arch-rvc.d
index 8e2fb4721ff..6907c02fbb1 100644
--- a/gas/testsuite/gas/riscv/option-arch-rvc.d
+++ b/gas/testsuite/gas/riscv/option-arch-rvc.d
@@ -15,8 +15,11 @@ SYMBOL TABLE:
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 \$xrv64i2p0_f2p0_d2p0_zca1p0_zcd1p0
+0+14 l .text 0+00 \$xrv64i2p0_f2p0_d2p0
+0+18 l .text 0+00 \$xrv32i2p0_f2p0_zca1p0_zcf1p0
+0+1a l .text 0+00 \$xrv32i2p0_f2p0
+0+1e l .text 0+00 \$xrv64i2p0_f2p0_d2p0_zca1p0_zcd1p0
+0+20 l .text 0+00 \$xrv64i2p0_f2p0_d2p0
0+0 l d .riscv.attributes 0+00 .riscv.attributes
@@ -30,9 +33,9 @@ Disassembly of section .text:
[ ]+[0-9a-f]+:[ ]+2108[ ]+c\.fld[ ]+fa0,0\(a0\)
[ ]+[0-9a-f]+:[ ]+00053507[ ]+fld[ ]+fa0,0\(a0\)
[ ]+[0-9a-f]+:[ ]+0001[ ]+c\.addi[ ]+zero,0
-[ ]+[0-9a-f]+:[ ]+0001[ ]+c\.addi[ ]+zero,0
-[ ]+[0-9a-f]+:[ ]+6108[ ]+c\.flw[ ]+fa0,0\(a0\)
+[ ]+[0-9a-f]+:[ ]+00000013[ ]+addi[ ]+zero,zero,0
[ ]+[0-9a-f]+:[ ]+6108[ ]+c\.flw[ ]+fa0,0\(a0\)
+[ ]+[0-9a-f]+:[ ]+00052507[ ]+flw[ ]+fa0,0\(a0\)
[ ]+[0-9a-f]+:[ ]+2108[ ]+c\.fld[ ]+fa0,0\(a0\)
-[ ]+[0-9a-f]+:[ ]+2108[ ]+c\.fld[ ]+fa0,0\(a0\)
+[ ]+[0-9a-f]+:[ ]+00053507[ ]+fld[ ]+fa0,0\(a0\)
#...
--
2.39.5 (Apple Git-154)
More information about the Binutils
mailing list