struct TlsModule

Defined at line 38 of file ../../sdk/lib/ld/include/lib/ld/tls.h

This describes the details gleaned from the PT_TLS header for a module.

These are stored in an array indexed by TLS module ID number - 1, as the

module ID number zero is never used.

Note that while module ID number 1 is most often the main executable, that

need not always be so: if the main executable has no PT_TLS of its own, then

the earliest module loaded that does have a PT_TLS gets module ID 1.

What is importantly special about the main executable is that offsets in the

static TLS block are chosen with the main executable first--it may have been

linked with Local Exec TLS access code where the linker chose its expected

offsets at static link time. When the dynamic linker follows the usual

procedure of assigning module IDs in load order and then doing static TLS

layout in the same order, it always comes out the same. But the only real

constraint on the runtime layout chosen is that if the main executable has a

PT_TLS segment, it must be first and its offset from the thread pointer must

be the fixed value prescribed by the psABI. The adjacent private portions

of the runtime thread descriptor must be located such that both their own

alignment requirements and the p_align of module 1's PT_TLS are respected.

Public Members

Span<const std::byte> tls_initial_data
Addr tls_bss_size
Addr tls_alignment

Public Methods

typename Elf::size_type tls_size ()

Defined at line 40 of file ../../sdk/lib/ld/include/lib/ld/tls.h