binutils Newspaper
JUNE 15, 2026
bfd/risc-v Ready to Land

bfd/RISC-V: move _bfd_riscv_elf_merge_private_bfd_data()

The ARCH_SIZE parameter is factored out of _bfd_riscv_elf_merge_private_bfd_data() to avoid building the code twice.

This patch modifies the _bfd_riscv_elf_merge_private_bfd_data() function in the RISC-V backend of the Binary File Descriptor (BFD) library. The change refactors the code to accept ARCH_SIZE as a function parameter, preventing the function from being built twice with different ARCH_SIZE values, thus reducing code duplication.

In the Thread 1 participant
  1. Jiawei contributor

    Agrees with the patch, which factors out the ARCH_SIZE parameter to avoid building the function twice.

    “The sole size dependent parameter used there is ARCH_SIZE. For just this there's no good reason to build all of the involved code twice.”

In Details

This patch concerns the BFD library, a generic interface for manipulating object file formats. The RISC-V backend uses _bfd_riscv_elf_merge_private_bfd_data() to merge private data from different object files. Avoiding code duplication improves maintainability.

For Context

The Binary File Descriptor (BFD) library provides a common way to access and manipulate different types of object files (executables, libraries, etc.). This patch modifies a function within the RISC-V-specific part of the BFD library to avoid unnecessary code duplication. This makes the code easier to maintain and reduces the overall size of the library.

Filed Under: binutilsbfdrisc-vcode duplicationrefactoring