+ declare the three magic global variables (__tls_size, __tls_align, __tls_base), created by the linker, when WebAssembly multithreading is enabled

This commit is contained in:
Nikolay Nikolov 2022-07-14 03:57:06 +03:00
parent 4db653998b
commit 7475d22154
2 changed files with 18 additions and 0 deletions

View File

@ -350,6 +350,17 @@ uses
STACK_POINTER_SYM = '__stack_pointer';
{ The exception tag symbol, used for FPC exceptions }
FPC_EXCEPTION_TAG_SYM = '__FPC_exception';
{ Immutable global variable, created by the linker, when multithreading
support is enabled. Contains the total size (plus padding) of all the
threadvars, used by the program. }
TLS_SIZE_SYM = '__tls_size';
{ Immutable global variable, created by the linker, when multithreading
support is enabled. Contains the alignment requirement for the thread
local block. }
TLS_ALIGN_SYM = '__tls_align';
{ Mutable global variable, created by the linker, when multithreading
support is enabled. }
TLS_BASE_SYM = '__tls_base';
{*****************************************************************************
Helpers

View File

@ -98,6 +98,13 @@ implementation
list.Concat(tai_globaltype.create(STACK_POINTER_SYM,wbt_i32,false));
if ts_wasm_threads in current_settings.targetswitches then
begin
list.Concat(tai_globaltype.create(TLS_SIZE_SYM,wbt_i32,true));
list.Concat(tai_globaltype.create(TLS_ALIGN_SYM,wbt_i32,true));
list.Concat(tai_globaltype.create(TLS_BASE_SYM,wbt_i32,false));
end;
if ts_wasm_native_exceptions in current_settings.targetswitches then
begin
list.Concat(tai_tagtype.create(FPC_EXCEPTION_TAG_SYM, []));