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

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-6-hjl.tools@gmail.com
source_type
public_inbox
title
[PATCH 5/5] readelf: Consolidate get_[32|64]bit_dynamic_section
headline
readelf: Consolidate get_[32|64]bit_dynamic_section
tldr
Consolidates 32-bit and 64-bit dynamic section reading functions into a single function 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_dynamic_section
series_role
reply
series_parts
[]
tags
  • readelf
  • elf
  • dynamic section
  • refactoring
  • code consolidation
bugzilla_url
date
2026-07-09T00:00:00.000Z

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

This patch consolidates the get_32bit_dynamic_section and get_64bit_dynamic_section functions in readelf.c into a single get_dynamic_section function. The new function is designed to handle both 32-bit and 64-bit ELF dynamic sections, using BYTE_GET_SIZE to retrieve external dynamic tags. This change aims to reduce code duplication and improve maintainability within the readelf utility, addressing PR binutils/34356.