Revert hiding of DT_INIT and DT_FINI symbols
The linker will no longer hide the `_init` and `_fini` symbols by default, reverting a previous change.
This commit reverts the decision to automatically hide the _init and _fini symbols in ELF binaries. The linker’s previous behavior of hiding these symbols was found to be surprising and can be achieved through source code if needed, with minimal performance impact from leaving them visible.
In Details
The linker (ld) previously implemented logic to hide the _init and _fini functions by marking them as hidden symbols. This change reverts that behavior. The motivation was that ld automatically hiding these symbols could be unexpected, and that control over symbol visibility for initialization and finalization routines should primarily rest with the source code. The impact of leaving them visible is considered small.
- DT_INIT
- A dynamic section tag in an ELF file that specifies the address of the initialization function called when a shared object is loaded or initialized. Corresponds to the
_initsymbol. - DT_FINI
- A dynamic section tag in an ELF file that specifies the address of the finalization function called when a shared object is unloaded or finalized. Corresponds to the
_finisymbol. - ELF
- Executable and Linkable Format. A standard file format for executables, object code, shared libraries, and core dumps, primarily used on Unix-like operating systems.
- symbol visibility
- Controls whether a symbol (like a function or variable) defined in one object file is visible or accessible from other object files. 'Hidden' visibility means the symbol is not exported and cannot be directly referenced externally.
- linker
- A program that combines various pieces of code and data (object files and libraries) into a single executable file or library. It resolves symbol references between different modules.