[PATCH RESEND 2/2] RISC-V: restart extension search on match

Ben Dooks <[email protected]> Fri, 1 May 2026 10:40:26 +0100
Newsgroups org.kernel.vger.linux-sparse
Message-ID <[email protected]>
If we are passed multiple extensions in -march, don't assume these will
be in any sort of order. If we do match, then restart the loop by setting
the search back to 0, and retrying.

This sorts out issues with the current kernel build where there are now
lots of extensions for the rv64i and even adding zacas doesn't silence the
warnings generated.

Tested-by: Paul Walmsley <[email protected]>
Signed-off-by: Ben Dooks <[email protected]>
---
v2:
  - fixed accidental whitespace change.
---
 target-riscv.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/target-riscv.c b/target-riscv.c
index 80c25285..cd6104b2 100644
--- a/target-riscv.c
+++ b/target-riscv.c
@@ -80,6 +80,7 @@ ext:
 		if (!strncmp(arg, pat, len)) {
 			riscv_flags |= extensions[i].flags;
 			arg += len;
+			i = 0;
 		}
 	}
 	if (arg[0])
-- 
2.37.2.352.g3c44437643