Fix TLS issues

This commit is contained in:
momo5502 2019-01-20 17:29:37 +01:00
parent af35816c0b
commit 4c86842b7f
5 changed files with 8 additions and 6 deletions

View File

@ -6,7 +6,7 @@ function chaiscript.import()
chaiscript.includes() chaiscript.includes()
defines { defines {
"CHAISCRIPT_NO_THREADS" -- :( --"CHAISCRIPT_NO_THREADS" -- :(
} }
end end

5
src/a.cpp Normal file
View File

@ -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];

View File

@ -9,8 +9,6 @@
//#define GENERATE_DIFFS //#define GENERATE_DIFFS
__declspec(thread) char tls_data[TLS_PAYLOAD_SIZE];
DECLSPEC_NORETURN void WINAPI exit_hook(const int code) DECLSPEC_NORETURN void WINAPI exit_hook(const int code)
{ {
module_loader::pre_destroy(); module_loader::pre_destroy();

View File

@ -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='*'\"") #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") #pragma bss_seg(".payload")
char payload_data[BINARY_PAYLOAD_SIZE]; char payload_data[BINARY_PAYLOAD_SIZE];

View File

@ -60,3 +60,5 @@
#include "resource.hpp" #include "resource.hpp"
using namespace std::literals; using namespace std::literals;
extern __declspec(thread) char tls_data[TLS_PAYLOAD_SIZE];