binutils Newspaper
OCTOBER 6, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
elf

elf: Hide DT_INIT and DT_FINI symbols

binutils: Prevents DT_INIT and DT_FINI functions from appearing in the dynamic symbol table.

This change modifies the ELF linker to hide the special functions used for DT_INIT and DT_FINI from the dynamic symbol table. This prevents these internal linker-defined symbols from being visible to dynamic loaders or other tools that inspect the symbol table, addressing PR ld/34623.

In Details

The ELF linker, via bfd/elflink.c, uses specific functions to define the DT_INIT and DT_FINI entries in the dynamic section of an executable or shared library. These functions are internal to the linker's operation and should not be exposed in the dynamic symbol table. This commit introduces a call to elf_backend_hide_symbol for the symbols corresponding to DT_INIT and DT_FINI after they are added to the dynamic entries. This ensures they are not exported, resolving PR ld/34623 and cleaning up the dynamic symbol table.

For Context
ELF
Executable and Linkable Format. A standard file format for object files, executables, and shared libraries used on many Unix-like systems.
DT_INIT
A tag in the ELF program header table indicating the address of a function to be executed when a shared object is loaded. This is typically an initialization function.
DT_FINI
A tag in the ELF program header table indicating the address of a function to be executed when a shared object is unloaded. This is typically a finalization function.
dynamic symbol table
A section within an ELF file that contains symbols relevant for dynamic linking, such as exported functions and global variables. This table is used by the dynamic loader at runtime.
linker
A program that combines object files and libraries into an executable file or a shared library. It resolves symbol references between them.
BFD
Binary File Descriptor library. A low-level library used by binutils and GDB to provide a common interface for accessing various binary object file formats.
Filed Under: elflinkersymbol-tablerefactor