Support thread_local on the EE with emulated TLS #4

Merged
techwritescode merged 2 commits from emulated-tls into main 2026-10-11 15:53:44 +00:00

The R5900 has no rdhwr, so native MIPS TLS cannot fetch a thread pointer. Build the EE with -femulated-tls instead.

  • Pass -femulated-tls from the EE driver config and the libc++ build.
  • New step 08 adds compiler-rt's emutls.o to the EE builtins archive (compiler-rt leaves it out of baremetal builds).
  • Build libc++abi's __cxa_thread_atexit so thread_local objects with destructors link and run them at thread exit.
  • README note.

Depends on the ps2/llvm PR for the libc++abi change; merge that into r5900-ee first. Tested in PCSX2 and on a real console. Tracks PS2-105.

🤖 Generated with Claude Code

The R5900 has no rdhwr, so native MIPS TLS cannot fetch a thread pointer. Build the EE with -femulated-tls instead. - Pass -femulated-tls from the EE driver config and the libc++ build. - New step 08 adds compiler-rt's emutls.o to the EE builtins archive (compiler-rt leaves it out of baremetal builds). - Build libc++abi's __cxa_thread_atexit so thread_local objects with destructors link and run them at thread exit. - README note. Depends on the ps2/llvm PR for the libc++abi change; merge that into r5900-ee first. Tested in PCSX2 and on a real console. Tracks PS2-105. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Support thread_local on the EE with emulated TLS
Some checks failed
Build / build-native-linux (push) Has been cancelled
649fe757c3
The R5900 has no rdhwr, so native MIPS TLS cannot fetch a thread pointer.
Build the EE with -femulated-tls, add compiler-rt's emutls.o to the EE
builtins archive (step 08), and build libc++abi's __cxa_thread_atexit so
thread_local objects with destructors link and run their destructors at
thread exit.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
CI: build the toolchain on the llvm-build-host runner
Some checks failed
Build / build-native-linux (push) Has been cancelled
1ceef3c3c4
The native Linux build and the Windows cross build are the long jobs; run
them on the dedicated runner. The packaging jobs stay on the shared one.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
techwritescode force-pushed emulated-tls from 1ceef3c3c4
Some checks failed
Build / build-native-linux (push) Has been cancelled
to 2fd0165b24
Some checks failed
Build / build-native-linux (push) Failing after 2m2s
Build / build-windows-cross (push) Has been skipped
2026-10-11 15:30:31 +00:00
Compare
Make the emutls scripts executable
All checks were successful
Build / build-native-linux (push) Successful in 1m50s
Build / build-windows-cross (push) Successful in 2m1s
4741a54ef9
The step runner executes steps directly; the new files were committed
without the executable bit, which failed the CI build.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
techwritescode force-pushed emulated-tls from 4741a54ef9
All checks were successful
Build / build-native-linux (push) Successful in 1m50s
Build / build-windows-cross (push) Successful in 2m1s
to 5961c2562c
All checks were successful
Build / build-native-linux (push) Successful in 1m51s
Build / build-windows-cross (push) Successful in 1m45s
2026-10-11 15:46:22 +00:00
Compare
techwritescode deleted branch emulated-tls 2026-10-11 15:53:44 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
ps2/llvm-toolchain!4
No description provided.