sh: Handle Linux core notes in generic ELF vector
Patch modifies the SH ELF backend to correctly handle Linux core notes, fixing an issue where GDB could not find registers in core dumps.
This patch addresses a bug in the SH ELF backend where the generic ELF vector was not properly handling Linux-specific core notes like NT_PRSTATUS and NT_PRPSINFO. This resulted in core files lacking a .reg section, preventing GDB from displaying registers. The fix ensures these notes are handled in the generic vector, which is inherited by the Linux vector.
In Details
The SH ELF backend in binutils was incorrectly prioritizing a generic ELF format over the Linux-specific one for core dumps. This patch changes the bfd_check_format_matches logic to ensure the Linux-specific notes (NT_PRSTATUS, NT_PRPSINFO) are processed, which are necessary for GDB to reconstruct register information in core dumps. Previously, elf32-shl was picked, which didn't handle these notes.
- ELF
- Executable and Linkable Format, a standard file format for executables, object code, shared libraries, and core dumps on Unix-like systems.
- Core file
- A file that contains a memory image of a process at the time it terminated abnormally (crashed). It's used for debugging.
- NT_PRSTATUS
- A note type in ELF core files that contains process status information, including register values.
- NT_PRPSINFO
- A note type in ELF core files that contains process information, such as process ID, command name, and user/group IDs.
- Registers
- Small, fast storage locations within a CPU that hold data currently being processed.