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

Paul Walmsley <[email protected]> Wed, 7 Jan 2026 13:42:24 -0700 (MST)
Newsgroups org.kernel.vger.linux-sparse
Message-ID <[email protected]>
On Fri, 2 Jan 2026, Ben Dooks wrote:

> 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.
> 
> Signed-off-by: Ben Dooks <[email protected]>
> ---
>  target-riscv.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/target-riscv.c b/target-riscv.c
> index 80c25285..ddf50e61 100644
> --- a/target-riscv.c
> +++ b/target-riscv.c
> @@ -56,7 +56,7 @@ static void parse_march_riscv(const char *arg)
>  
>  	// Each -march=.. options entirely overrides previous ones
>  	riscv_flags = 0;
> -
> +	

Looks like some horizontal whitespace was inadvertently added here.

>  	for (i = 0; i < ARRAY_SIZE(basic_sets); i++) {
>  		const char *pat = basic_sets[i].pattern;
>  		size_t len = strlen(pat);
> @@ -80,6 +80,7 @@ ext:
>  		if (!strncmp(arg, pat, len)) {
>  			riscv_flags |= extensions[i].flags;
>  			arg += len;
> +			i = 0;
>  		}
>  	}
>  	if (arg[0])


Tested-by: Paul Walmsley <[email protected]>


- Paul