Re: [PATCH] RISC-V: Check if the merged ISA string is conflicting
"Ethan Y. C. Liang" <[email protected]>
| Newsgroups | gmane.comp.gnu.binutils |
|---|---|
| Message-ID | <CALWc1WCcB_TFvaPKTkc26SMptvi6f9y2hgiV6hZrccEMKkJiRw@mail.gmail.com> |
Yep, you're right. I've already sent another patch series to address this: https://sourceware.org/pipermail/binutils/2026-July/150010.html Please take a look when you have a chance. On Tue, Jun 30, 2026 at 3:15 AM Jeffrey Law <[email protected]> wrote: > > > > On 1/12/2025 11:29 PM, Yu-Cheng Liang 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 <[email protected]> > > --- > > 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); > So this code was recently moved into elfxx-riscv.c. > > The patch applies cleanly over in that context and Kito already gave > approval around multilib questions that I think Nelson raised. > > The question I have is don't we possibly leak memory for various objects > allocated by riscv_parse_subset and its children and stored into the > subsets and perhaps other fields of riscv_rps_merged? > > Jeff >