binutils Newspaper
JULY 29, 2026
gas Proposed

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

Adds an option to control GAS's conversion of local symbols to section symbols for ELF relocations.

Alan Modra acknowledges a patch that introduces the --reloc-section-sym option to GAS. This option controls whether eligible local symbols are converted to STT_SECTION symbols for ELF relocations. The conversion is performed to omit local symbols from .symtab when multiple local symbols reference the same section, saving space. The new option allows control over this behavior, with all (default), internal (only compiler-generated locals), and none (never convert) settings, which is beneficial for debugging and tools that rely on preserved symbol names.

In the Thread 1 participant
  1. Alan Modra <amodra@gmail.com> reviewer

    Acknowledges the patch and its usefulness for debugging and tool compatibility, finding it acceptable.

In Details

This discussion revolves around a change to GAS (the GNU Assembler) for ELF object files. The patch introduces a new command-line option, --reloc-section-sym, to control a specific optimization: the conversion of local symbols (e.g., .L symbols generated by the compiler) into references to STT_SECTION symbols. This optimization aims to reduce the size of the symbol table (.symtab) by omitting individual local symbols when they are the only ones referencing a particular section. The new option provides control over this conversion, allowing users to choose between converting all eligib…

For Context
GAS
The GNU Assembler, part of the GNU toolchain, which translates assembly language code into machine code.
ELF
Executable and Linkable Format, a standard file format for object files, executables, and shared libraries.
STT_SECTION symbol
A symbol of type 'section' in the ELF format, used to represent an entire section rather than a specific address within it.
relocations
Information stored in an object file that tells the linker how to modify memory addresses in the code or data when linking the object file into a final executable or library.
.symtab
A section in an object file that contains a symbol table, listing all symbols (like function names, variable names) defined or referenced by the code.
Filed Under: binutilsGASELFsymbolsrelocations