binutils Newspaper
OCTOBER 6, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
sh

Prefer targets with more sections when resolving core file formats

Binutils now prioritizes SH core file targets with more sections to ensure correct register information is parsed.

This patch improves core file support for SH targets by modifying bfd_check_format_matches. When multiple targets have equivalent matching scores, the function now prefers targets that define a higher number of sections. This is crucial for SH Linux core files, where only a specific target (elf32-sh-linux) correctly interprets NT_PRSTATUS notes and generates the necessary .reg section for registers.

In Details

In bfd/format.c, bfd_check_format_matches determines the BFD target to use for an object file. For SH targets, several formats like elf32-shl, elf32-sh-linux, etc., can have identical matching priorities. This commit changes the tie-breaking logic: if multiple targets match equally, it now selects the one with the highest section count. This resolves PR 34676, ensuring that elf32-sh-linux is chosen over other equivalent SH targets, as it's the only one that correctly processes NT_PRSTATUS notes and creates the register section for core dumps.

For Context
SH
SuperH, a family of 32-bit microprocessors developed by Hitachi.
core file
A file containing a snapshot of a process's memory and state at the time it crashed, used for debugging.
NT_PRSTATUS
A note type in Linux core dump files that contains process status information, including register values.
BFD
The Binary File Descriptor library, a core component of GNU Binutils that provides a common interface for reading and writing various object file formats.
section
A part of an object file or executable that contains related data, such as code (.text), initialized data (.data), or uninitialized data (.bss).
Filed Under: core dumpdebuggershbugfix