[PATCH] RISC-V: Check if the merged ISA string is conflicting
Yu-Cheng Liang
yclwlcy@gmail.com
Mon Dec 1 08:52:26 GMT 2025
Hi Nelson and Kito,
Thanks for the review and the reminder. I will provide another patch
with test cases later.
Yu-Cheng
On Mon, Dec 1, 2025 at 3:49 PM Kito Cheng <kito.cheng@sifive.com> wrote:
>
> I assume that should not break multilib building, mixing those
> conflict extensions together is problematic, so emitting error during
> linking stage is reasonable to me :)
>
> On Mon, Dec 1, 2025 at 3:39 PM Nelson Chu <nelson@rivosinc.com> wrote:
> >
> > Won't this break the multilib toolchain build? cc Kito that he knows more about multi-lib buildls of riscv-gnu-toolchain. Besides, any testcase?
> >
> > Nelson
> >
> > On Mon, Dec 1, 2025 at 11:02 AM Yu-Cheng Liang <yclwlcy@gmail.com> wrote:
> >>
> >> 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