[PATCH 1/5] readelf: Consolidate get_[32|64]bit_section_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-2-hjl.tools@gmail.com
source_type
public_inbox
title
[PATCH 1/5] readelf: Consolidate get_[32|64]bit_section_headers
headline
readelf: Consolidate get_[32|64]bit_section_headers
tldr
Consolidates 32-bit and 64-bit section 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_section_headers
series_role
reply
series_parts
[]
tags
  • readelf
  • elf
  • section headers
  • refactoring
  • code consolidation
bugzilla_url
date
2026-07-09T00:00:00.000Z

[PATCH 1/5] readelf: Consolidate get_[32|64]bit_section_headers

This patch consolidates the get_32bit_section_headers and get_64bit_section_headers functions in readelf.c into a single get_section_headers function. The new function handles both 32-bit and 64-bit ELF section headers, utilizing the BYTE_GET_SIZE macro for reading external ELF section header fields. This consolidation aims to reduce code duplication and enhance maintainability within the readelf utility, addressing PR binutils/34356.