HomeFreeBSD

Rework alignment handling in __libc_allocate_tls() for Variant I of TLS layout.

Description

Rework alignment handling in __libc_allocate_tls() for Variant I of TLS layout.

There are two versions of variant I of TLS

  • ARM and aarch64 uses original version of variant I here TP points to start of TCB followed by aligned TLS segment. Both TCB and TLS must be aligned to alignment of TLS section. The TCB[0] points to DTV vector and DTV values are real addresses (without bias).
  • MIPS, PowerPC and RISC-V use modified version of variant I, where TP points (with bias) to TLS and TCB immediately precedes TLS without any alignment gap. Only TLS should be aligned. The TCB[0] points to DTV vector and DTV values are biased by constant value (0x8000) from real addresses.

Take all this in account when allocating memory for TLS structures.

MFC after: 1 month
Reviewed by: kib, mizhka
Tested by: mizhka(on mips)
Differential Revision: https://reviews.freebsd.org/D13378

Details

Provenance
mmelAuthored on
Reviewer
kib
Differential Revision
D13378: Rework alignment handling in __libc_allocate_tls() for Variant I of TLS layout.
Parents
rS326793: MFC r326311:
Branches
Unknown
Tags
Unknown