[PATCH v2] RISC-V: Fixed the broken .option norvc and .option arch, -c

Jan Beulich jbeulich@suse.com
Fri Jul 4 07:33:15 GMT 2025


On 04.07.2025 09:19, Nelson Chu wrote:
> --- a/bfd/elfxx-riscv.c
> +++ b/bfd/elfxx-riscv.c
> @@ -2707,7 +2707,15 @@ 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,-zcb,-zce,-zcmp,-zcmt,"
> +				      "-zcmop,-zclsd");
> +	}

On the assumption that this is the complete (current) set of Zc* extensions,
this looks good to me, fwiw. What I keep forgetting is why the handling of C
isn't done using the normal dependency chains between extensions. IOW I can
only assume there is a reason that we need such a hack. (Might be a good
idea to have a non-empty description in this change.)

Jan


More information about the Binutils mailing list