binutils Newspaper
JUNE 15, 2026
mips Proposed

mips: section .note.gnu.build-id can't be allocated in segment

Fixes an objcopy error on MIPS when .note.gnu.build-id follows SHT_NOBITS sections due to file offset tracking.

This patch resolves an error encountered during objcopy on MIPS systems. The error occurred when the .note.gnu.build-id section, which has the type SHT_PROGBITS, immediately followed sections with the type SHT_NOBITS (e.g., .MIPS.abiflags and .reginfo). The underlying cause was a bug in file offset tracking within the assign_file_positions_for_load_sections function.

In the Thread 1 participant
  1. Alan Modra <amodra@gmail.com> proposer

    Proposes a fix for an objcopy error on MIPS systems related to section allocation.

In Details

This patch addresses an issue in bfd/elf.c within the assign_file_positions_for_load_sections function. The problem arises when processing ELF files for MIPS targets where a SHT_PROGBITS section (.note.gnu.build-id) immediately follows SHT_NOBITS sections (.MIPS.abiflags, .reginfo). The fix ensures correct file offset tracking, resolving the allocation error during objcopy operations.

For Context

The objcopy utility is used to copy and translate object files. ELF files are a standard format for executables, object code, shared libraries, and core dumps. ELF files are divided into sections, some of which contain code or data (SHT_PROGBITS) and some of which don't (SHT_NOBITS). This patch fixes an issue where objcopy would fail on MIPS architectures when a section containing data immediately followed a section that didn't, which makes the toolchain more reliable.

Filed Under: binutilsobjcopyMIPSELFsection allocation