mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-05-25 07:02:47 -04:00
Use tls_model("global-dynamic") for JKRHeap on GCC
This commit is contained in:
@@ -31,7 +31,14 @@ JKRHeap* JKRHeap::sSystemHeap;
|
||||
#if TARGET_PC
|
||||
// JSystem normally has a thread switch callback to track the correct heap.
|
||||
// We can't do this as we're (currently) using true OS threads. So use a true thread local.
|
||||
static thread_local JKRHeap* sCurrentHeap;
|
||||
// On Linux/GCC, thread_local in a shared library requires global-dynamic TLS model
|
||||
// (the default local-exec is incompatible with -fPIC). MSVC and macOS/Clang handle this automatically.
|
||||
#if defined(__GNUC__) && !defined(__clang__) && !defined(_MSC_VER)
|
||||
#define TLS_GLOBAL_DYNAMIC __attribute__((tls_model("global-dynamic")))
|
||||
#else
|
||||
#define TLS_GLOBAL_DYNAMIC
|
||||
#endif
|
||||
static thread_local TLS_GLOBAL_DYNAMIC JKRHeap* sCurrentHeap;
|
||||
#else
|
||||
JKRHeap* JKRHeap::sCurrentHeap;
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user