[PATCH v4] gas: add --reloc-section-sym={all,internal,none} option for ELF

Project / Subsystem

binutils / gas

Date

2026-07-01

Proposer

Fangrui Song <i@maskray.me>

Source type

public_inbox

Consensus

Proposed

Sentiment

8/10

Technical tradeoffs

  • Increases flexibility for debugging and tool integration at the cost of slightly larger symbol tables when 'none' or 'internal' options are used.
  • Adds complexity to the GAS command-line interface.

All attributes

project
binutils
subsystem
gas
patch_id
discussion_id
20260701035918.1453550-1-i@maskray.me
source_type
public_inbox
title
[PATCH v4] gas: add --reloc-section-sym={all,internal,none} option for ELF
headline
gas: add --reloc-section-sym={all,internal,none} option for ELF
tldr
Adds a new option to control how GAS converts local symbols referenced by relocations to section symbols, aiding debugging and tool compatibility.
proposer
Fangrui Song <i@maskray.me>
consensus
Proposed
outcome
proposed
sentiment_score
8
technical_tradeoffs
  • Increases flexibility for debugging and tool integration at the cost of slightly larger symbol tables when 'none' or 'internal' options are used.
  • Adds complexity to the GAS command-line interface.
series_id
series_role
standalone
series_parts
[]
tags
  • elf
  • gas
  • debugging
  • linker
  • symbols
bugzilla_url
date
2026-07-01T00:00:00.000Z

[PATCH v4] gas: add --reloc-section-sym={all,internal,none} option for ELF

This patch introduces the —reloc-section-sym option to GAS, allowing users to control the conversion of local symbols used in ELF relocations. By default, eligible local symbols are converted to reference section symbols (STT_SECTION), which can reduce .symtab entries. The new option allows this conversion to be limited to compiler-generated locals (‘internal’) or disabled entirely (‘none’), providing greater flexibility for debugging and compatibility with tools that benefit from preserved symbol names.