kit

kit
git clone https://git.ryansepassi.com/git/kit.git
Log | Files | Refs | README

commit 5a0e24dcba8784c652d4be3e3b6640564fcf52b4
parent 5f1b0107a2365050f74e08713d520be2f8df9408
Author: Ryan Sepassi <rsepassi@gmail.com>
Date:   Tue, 16 Jun 2026 22:32:14 -0700

arm32 TLS-as-static: place .tdata/.tbss in the bare linker script

The freestanding single-thread model treats __thread vars as plain static
instances (M-profile has no thread register), addressed absolutely via MOVW/MOVT
— but the bare-metal linker script never placed .tdata/.tbss, so the initial
value was never seeded (read 0) and TLS symbols resolved to ~0. Fold .tdata into
.data (flash-LMA-seeded by the reset stub) and .tbss into .bss (zeroed). Fixes
141_threadlocal_mutate and 142_threadlocal_multi (O0+O1).

Diffstat:
Mtest/lib/exec_bare.sh | 5+++++
1 file changed, 5 insertions(+), 0 deletions(-)

diff --git a/test/lib/exec_bare.sh b/test/lib/exec_bare.sh @@ -557,12 +557,17 @@ SECTIONS { .data : ALIGN(4) { _sdata = .; *(.data*) + /* Single-thread TLS-as-static: __thread initialized data is a plain static + * instance, seeded from flash by the reset stub like .data. */ + *(.tdata*) . = ALIGN(4); _edata = .; } > SRAM AT> FLASH .bss (NOLOAD) : ALIGN(4) { _sbss = .; *(.bss*) + /* Single-thread TLS-as-static: __thread zero data folds into .bss. */ + *(.tbss*) *(COMMON) . = ALIGN(4); _ebss = .;