diff --git a/deps/premake/chaiscript.lua b/deps/premake/chaiscript.lua index 6d961b1..25fe76d 100644 --- a/deps/premake/chaiscript.lua +++ b/deps/premake/chaiscript.lua @@ -6,7 +6,7 @@ function chaiscript.import() chaiscript.includes() defines { - "CHAISCRIPT_NO_THREADS" -- :( + --"CHAISCRIPT_NO_THREADS" -- :( } end diff --git a/src/a.cpp b/src/a.cpp new file mode 100644 index 0000000..4948926 --- /dev/null +++ b/src/a.cpp @@ -0,0 +1,5 @@ +#include "std_include.hpp" + +// The naming of the file enforces early linking and thus +// a better placement in the tls segment +__declspec(thread) char tls_data[TLS_PAYLOAD_SIZE]; \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index 31bd3e8..868c1a5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -9,8 +9,6 @@ //#define GENERATE_DIFFS -__declspec(thread) char tls_data[TLS_PAYLOAD_SIZE]; - DECLSPEC_NORETURN void WINAPI exit_hook(const int code) { module_loader::pre_destroy(); diff --git a/src/std_include.cpp b/src/std_include.cpp index 26ca2df..a72351b 100644 --- a/src/std_include.cpp +++ b/src/std_include.cpp @@ -9,9 +9,6 @@ #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"") -// Moved to main.cpp to enforce early linking -//__declspec(thread) char tls_data[TLS_PAYLOAD_SIZE]; - #pragma bss_seg(".payload") char payload_data[BINARY_PAYLOAD_SIZE]; diff --git a/src/std_include.hpp b/src/std_include.hpp index bbaa8b7..e778e6f 100644 --- a/src/std_include.hpp +++ b/src/std_include.hpp @@ -60,3 +60,5 @@ #include "resource.hpp" using namespace std::literals; + +extern __declspec(thread) char tls_data[TLS_PAYLOAD_SIZE]; \ No newline at end of file