[PATCH] RISC-V: Check if the merged ISA string is conflicting

Yu-Cheng Liang yclwlcy@gmail.com
Mon Dec 1 03:02:20 GMT 2025


On Mon, Jan 13, 2025 at 2:29 PM Yu-Cheng Liang <yclwlcy@gmail.com> wrote:
>
> In the current implementation, the linker does not check if the merged
> ISA string is conflicting when attempting to merge two ISA strings.
> For instance, no error message is generated when the linker links
> objectA (rv64i_zfinx) with objectB (rv64if).
>
> Signed-off-by: Yu-Cheng Liang <yclwlcy@gmail.com>
> ---
>  bfd/elfnn-riscv.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/bfd/elfnn-riscv.c b/bfd/elfnn-riscv.c
> index 3aba9c85b0f..0b8c7c33117 100644
> --- a/bfd/elfnn-riscv.c
> +++ b/bfd/elfnn-riscv.c
> @@ -3965,6 +3965,14 @@ riscv_merge_arch_attr_info (bfd *ibfd, char
> *in_arch, char *out_arch)
>
>    merged_arch_str = riscv_arch_str (ARCH_SIZE, &merged_subsets);
>
> +  /* Check if the merged ISA string is conflicting.  */
> +  riscv_subset_list_t subsets = {NULL, NULL, NULL};
> +  unsigned xlen;
> +  riscv_parse_subset_t riscv_rps_merged =
> +    {&subsets, _bfd_error_handler, &xlen, NULL, false};
> +  if (!riscv_parse_subset (&riscv_rps_merged, merged_arch_str))
> +    return NULL;
> +
>    /* Release the subset lists.  */
>    riscv_release_subset_list (&in_subsets);
>    riscv_release_subset_list (&out_subsets);
> --
> 2.47.1

Hi Nelson,

Just a quick ping on this patch.
Let me know if you need anything from my side.

Thanks,
Yu-Cheng


More information about the Binutils mailing list