binutils Newspaper
JULY 29, 2026
risc-v Proposed

RISC-V: First patch for arch attribute merging approved

Nelson Chu approves the first patch in the RISC-V linker arch attribute series, which fixes memory leaks.

Nelson Chu approves the first patch in Ethan Y. C. Liang’s series, which addresses memory leaks in the RISC-V linker’s architecture attribute merging function. The patch ensures that subset lists are properly released on all error paths, preventing memory leaks that could carry over to subsequent merges.

In the Thread 2 participants
  1. Nelson Chu <nelson.chu@sifive.com> reviewer

    Approves the first patch, stating it looks okay.

    “This looks Okay, thanks.”
  2. Ethan Y. C. Liang <ycl669@andestech.com> proposer

    Explains that the first patch fixes memory leaks by cleaning up subset lists on error paths.

    “riscv_merge_arch_attr_info returned early on the error paths without releasing in_subsets, out_subsets and merged_subsets, so the nodes already added to them were leaked. The leaked nodes of in_subsets and out_subsets also carry over into the next merge.”

In Details

Nelson Chu has reviewed and approved the first patch (part of a series) by Ethan Y. C. Liang. This patch modifies bfd/elfxx-riscv.c to fix memory leaks within the riscv_merge_arch_attr_info function. It ensures that in_subsets, out_subsets, and merged_subsets are properly deallocated in all error exit paths, preventing resource leaks and their carry-over to subsequent operations.

For Context
subset lists
Data structures holding parsed RISC-V ISA extensions relevant to linker attribute merging.
error paths
Code execution pathways taken when an error condition is encountered.
linker
The tool responsible for combining object files, in this case, ld from binutils.
RISC-V
An open standard Instruction Set Architecture (ISA) based on Reduced Instruction Set Computing.

Part of a Series

Filed Under: risc-vlinkermemory leakpatch review