binutils Newspaper
OCTOBER 6, 2026
readelf — Proposed

readelf: Don't dump GOT section after seeing error

Suggestion to generalize readelf error handling beyond just the GOT section.

Jan Beulich reviews a patch for readelf that prevents dumping the GOT section after errors occur, acknowledging its usefulness for the specific case. He suggests that this error-handling model might be beneficial to generalize and apply to other sections or contexts within readelf as well, improving overall robustness.

In the Thread 2 participants
  1. H. J. Lu proposer

    Submits a patch to prevent `readelf` from dumping the GOT section after encountering errors, citing PR binutils/34473.

    “Don't dump GOT section contents after seeing errors in input: readelf: Error: Section 10 has invalid sh_entsize of 0 readelf: Error: (Using the expected size of 18 for the rest of this dump) readelf: Error: Too many program headers - 0x3030 - the file is not that big PR binutils/34473 * elfcomm.c (seen_error): New. (seen_elf_error): Likewise. (clear_elf_error): Likewise. (error): Set seen_error…”
  2. Jan Beulich <jbeulich@suse.com> reviewer

    Approves the patch for `readelf` but suggests generalizing the error-handling approach to other parts of the tool.

    “Okay. And this model may want widening to elsewhere, not limited to readelf.”

Technical Tradeoffs

  • Improves robustness by preventing `readelf` from producing potentially misleading output after encountering errors.
  • Generalizing the error handling could increase code complexity but enhance overall stability across various object file formats.

In Details

A patch for readelf prevents the Global Offset Table (GOT) section from being dumped if other errors are encountered during parsing. Reviewer Jan Beulich agrees with the change but proposes extending this safer error-handling strategy to other parts of readelf to improve its robustness when dealing with malformed object files.

For Context
readelf
A utility that displays information about ELF (Executable and Linkable Format) files, commonly used for inspecting object files and executables.
GOT
Global Offset Table. A table used in position-independent code (PIC) to store addresses of global symbols, allowing them to be resolved at runtime.
ELF
Executable and Linkable Format. A standard file format for executables, object code, shared libraries, and core dumps on many Unix-like systems.
PR binutils/34473
A specific bug report (Problem Report) filed against the binutils project, identified by number 34473.
patch
A piece of code that modifies existing software to fix bugs, add features, or improve performance.
Filed Under: binutilsreadelferror handlingGOTELF