[PATCH 3/5] readelf: Consolidate get_[32|64]bit_program_headers

Project / Subsystem

binutils / readelf

Date

2026-07-09

Proposer

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

Source type

public_inbox

Consensus

Proposed

Sentiment

/10

Technical tradeoffs

  • Reduces code duplication by merging 32-bit and 64-bit parsing logic.
  • Improves maintainability of the `readelf` tool.

All attributes

project
binutils
subsystem
readelf
patch_id
discussion_id
20260709124052.680684-4-hjl.tools@gmail.com
source_type
public_inbox
title
[PATCH 3/5] readelf: Consolidate get_[32|64]bit_program_headers
headline
readelf: Consolidate get_[32|64]bit_program_headers
tldr
Consolidates 32-bit and 64-bit program header reading functions into one in readelf.
proposer
H.J. Lu <hjl.tools@gmail.com>
consensus
Proposed
outcome
proposed
sentiment_score
technical_tradeoffs
  • Reduces code duplication by merging 32-bit and 64-bit parsing logic.
  • Improves maintainability of the `readelf` tool.
series_id
binutils:readelf: consolidate get_[32|64]bit_program_headers
series_role
reply
series_parts
[]
tags
  • readelf
  • elf
  • program headers
  • refactoring
  • code consolidation
bugzilla_url
date
2026-07-09T00:00:00.000Z

[PATCH 3/5] readelf: Consolidate get_[32|64]bit_program_headers

This patch consolidates the get_32bit_program_headers and get_64bit_program_headers functions in readelf.c into a single get_program_headers function. The new function efficiently handles both 32-bit and 64-bit ELF program headers, using the BYTE_GET_SIZE macro for reading external ELF program header fields. This consolidation aims to eliminate code duplication and enhance the maintainability of the readelf utility, addressing PR binutils/34356.