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:
authorZroFreaks <42916282+ZroIsHere@users.noreply.github.com>2026-11-26 08:52:38 +0100
committerZroFreaks <42916282+ZroIsHere@users.noreply.github.com>2026-11-26 08:52:38 +0100
commit338dc11ea622cb3ab0406cafd9af3f08a3740e50 (patch)
tree1bafd06087f63aa27cfb3286e2f5a3a72dc7b609 /runtime/src/pe_loader.cpp
parenta73a57e1339be072baf5522351c8ec7f1482b56b (diff)
runtime: own the executable TLS exit callback
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);