Represents an ELF TLS variant.
In all variants, the TP and the TLS blocks must be aligned to the p_align value in the
PT_TLS ELF program header. Everything else has natural alignment.
The location of the DTV does not actually matter. For simplicity, we put it in the TLS area, but there is no actual ABI requirement that it reside there.
const Variant = enum
const Variant = enum {
/// The original Variant I:
///
/// ----------------------------------------
/// | DTV | Zig TCB | ABI TCB | TLS Blocks |
/// ----------------^-----------------------
/// `-- The TP register points here.
///
/// The layout in this variant necessitates separate alignment of both the TP and the TLS
/// blocks.
///
/// The first word in the ABI TCB points to the DTV. For some architectures, there may be a
/// second word with an unspecified meaning.
I_original,
/// The modified Variant I:
///
/// --------------------------------------------
/// | DTV | Zig TCB | ABI TCB | TLS Blocks |
/// ------------------------------^-------------
/// `-- The TP register points here (*inside* the TLS blocks).
///
/// The offset from the start of the TLS blocks to the TP register is `current_tp_offset`. It
/// may be zero, in which case the TP register points to the start of the TLS blocks.
///
/// The first (and only) word in the ABI TCB points to the DTV.
I_modified,
/// Variant II:
///
/// ----------------------------------------
/// | TLS Blocks | ABI TCB | Zig TCB | DTV |
/// -------------^--------------------------
/// `-- The TP register points here.
///
/// The first (and only) word in the ABI TCB points to the ABI TCB itself.
II,
}