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

Alan Modra amodra@gmail.com
Thu Jul 2 02:58:12 GMT 2026


On Tue, Jun 30, 2026 at 08:59:18PM -0700, Fangrui Song wrote:
> From: Fangrui Song <maskray@sourceware.org>
> 
> When generating relocations for non-ifunc local symbols that satisfies
> several conditions, GAS converts them to reference the section symbol
> (STT_SECTION) instead, folding the original symbol's offset into the
> addend.  This allows the original local symbol to be omitted from
> .symtab, but the STT_SECTION symbol itself must be present, so the
> conversion saves .symtab entries only when a section has more than one
> local symbol referenced by relocations.
> 
> Add --reloc-section-sym to control this conversion:
> 
> - all (default): convert all eligible local symbols
> - internal: only convert compiler-generated locals (.L prefix)
> - none: never convert; keep all symbols as-is in relocations
> 
> This is useful for debugging and for tools that benefit from preserved
> symbol names.
> 
> PR gas/33885

OK, thanks.

-- 
Alan Modra


More information about the Binutils mailing list