readelf: Save and dump the original section header values

Project / Subsystem

binutils / readelf

Date

2026-07-04

Proposer

"H.J. Lu" <hjl.tools@gmail.com>

Source type

public_inbox

Consensus

Proposed

Sentiment

/10

Technical tradeoffs

  • Adds memory overhead to store original section header data, but this is managed by on-demand allocation.
  • Improves debuggability of malformed object files at the cost of slightly increased complexity in `readelf`.

All attributes

project
binutils
subsystem
readelf
patch_id
discussion_id
CAMe9rOrai4QD0Jq52-Zsd=hBNe9k2KnaqLZ7022yW=+8n_dX9w@mail.gmail.com
source_type
public_inbox
title
readelf: Save and dump the original section header values
headline
readelf: Save and dump original section header values
tldr
Preserve and display original section header values in readelf to aid debugging of malformed object files.
proposer
"H.J. Lu" <hjl.tools@gmail.com>
consensus
Proposed
outcome
proposed
sentiment_score
technical_tradeoffs
  • Adds memory overhead to store original section header data, but this is managed by on-demand allocation.
  • Improves debuggability of malformed object files at the cost of slightly increased complexity in `readelf`.
series_id
series_role
cover
series_parts
[]
tags
  • binutils
  • readelf
  • debugging
  • elf
bugzilla_url
date
2026-07-04T00:00:00.000Z

readelf: Save and dump the original section header values

This patch for readelf introduces functionality to save and display the original, potentially garbage, section header values before they are cleaned up or validated. This is intended to aid debugging by making inconsistent or incorrect header data visible when dumping section headers, helping to diagnose issues in malformed object files. The changes involve adding a new field to store these original values and a function to save them, with a modification to clear this storage on demand.