upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/src/pe_loader.cpp
diff options
context:
space:
mode:
authorJan Trencansky <jan.trencansky@protonmail.com>2026-11-26 13:13:43 -0500
committerJan Trencansky <jan.trencansky@protonmail.com>2026-11-26 13:13:43 -0500
commit8a600e14ebb7e4b1df31fb004c1c137b5797566b (patch)
treee49fab6608a78600a4f31e9238e6a129b78c08a7 /runtime/src/pe_loader.cpp
parentbdbc7e9236465c5d6a1305de6edd3fc09c2d6fd9 (diff)
parent338dc11ea622cb3ab0406cafd9af3f08a3740e50 (diff)
Merge #2315 (ZroIsHere): runtime: own the executable TLS exit callback
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'runtime/src/pe_loader.cpp')
-rw-r--r--runtime/src/pe_loader.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/runtime/src/pe_loader.cpp b/runtime/src/pe_loader.cpp
index fc73f37f5..81d2e208a 100644
--- a/runtime/src/pe_loader.cpp
+++ b/runtime/src/pe_loader.cpp
@@ -17,6 +17,7 @@
17#include <vector> 17#include <vector>
18 18
19#include "../shims/shims.h" 19#include "../shims/shims.h"
20#include "../shims/process_shim.h"
20#include "../shims/startup_trace.h" 21#include "../shims/startup_trace.h"
21#include "base_reservation.h" 22#include "base_reservation.h"
22#include "clzero_patch.h" 23#include "clzero_patch.h"
@@ -1198,6 +1199,15 @@ void __cdecl on_host_thread_event(DWORD reason) {
1198 std::fprintf(stderr, "[rt] loader: thread detach, slot %zu (%s): %s\n", i, m->name.c_str(), 1199 std::fprintf(stderr, "[rt] loader: thread detach, slot %zu (%s): %s\n", i, m->name.c_str(),
1199 e.what()); 1200 e.what());
1200 } 1201 }
1202 if (i == kMainImageSlot) {
1203 try {
1204 process::run_thread_local_exe_atexit_callback();
1205 } catch (const std::exception& e) {
1206 std::fprintf(stderr, "[rt] loader: executable thread-local destructors: %s\n", e.what());
1207 } catch (...) {
1208 std::fprintf(stderr, "[rt] loader: executable thread-local destructors threw an unknown exception\n");
1209 }
1210 }
1201 // Released even when the callbacks threw: a leaked block would be handed to the OS loader as the 1211 // Released even when the callbacks threw: a leaked block would be handed to the OS loader as the
1202 // helper's own TLS block and freed with it at thread exit. 1212 // helper's own TLS block and freed with it at thread exit.
1203 uninstall_thread_block(*m); 1213 uninstall_thread_block(*m);