elf: Hide DT_INIT and DT_FINI functions
Discussion regarding a patch to hide DT_INIT and DT_FINI functions in ELF binaries.
This discussion revolves around a patch intended to hide the DT_INIT and DT_FINI functions within ELF binaries. The conversation appears to be a long-running thread with multiple participants weighing in on the implications and correctness of the proposed change. The core technical aspect involves manipulating ELF dynamic section tags to control the visibility or behavior of initialization and finalization functions.
- contributor
Replies to a lengthy thread concerning a patch to hide DT_INIT and DT_FINI functions in ELF binaries.
“On Fri, Sep 11, 2026 at 9:34 PM Matt Rice <ratmice@gmail.com> wrote: > ...”
- contributor
Engaged in the discussion about hiding ELF DT_INIT and DT_FINI functions, with multiple prior messages in the thread.
“On Fri, Sep 11, 2026 at 7:47 PM H.J. Lu <hjl.tools@gmail.com> wrote: > ...”
- contributor
Participates in the ongoing debate about hiding DT_INIT and DT_FINI functions in ELF binaries.
“On Sat, Sep 12, 2026 at 10:12 AM Matt Rice <ratmice@gmail.com> wrote: > ...”
- contributor
Contributes to the discussion on a patch affecting DT_INIT and DT_FINI visibility in ELF files.
“On 11.09.2026 14:04, H.J. Lu wrote: > ...”
Technical Tradeoffs
- Hiding initialization/finalization functions might improve security by obscuring critical code paths, but could break existing tools or assumptions that rely on these functions being visible.
- Modifying ELF structures requires careful consideration of ABI compatibility and potential impacts on different operating systems and architectures.
- The decision to hide these functions involves balancing potential security benefits against compatibility concerns and the complexity of dynamic linker behavior.
In Details
This thread concerns a patch affecting ELF dynamic linking, specifically related to the DT_INIT and DT_FINI entries in the .dynamic section. These entries typically point to initialization and finalization functions, respectively, which are executed by the dynamic linker. The patch aims to 'hide' these functions, likely by modifying how the dynamic linker processes them, potentially for security or operational reasons. The extensive quoting suggests a detailed, multi-party discussion on the correctness and impact of this change on ELF binary loading and execution.
- ELF
- Executable and Linkable Format. A common standard file format for executable files, object code, shared libraries, and core dumps, primarily used on Unix-like systems.
- DT_INIT
- A dynamic section tag in ELF that indicates the address of a function to be executed when a shared object is loaded.
- DT_FINI
- A dynamic section tag in ELF that indicates the address of a function to be executed when a shared object is unloaded.
- Dynamic linker
- A program that runs when a program is executed. It loads shared libraries into memory and resolves symbols (e.g., function calls) between the executable and the libraries.
- Shared object
- A file that contains code and data that can be used by multiple programs simultaneously. Also known as a shared library or dynamic library.