+ allow referencing TLS_SIZE_SYM, TLS_ALIGN_SYM and TLS_BASE_SYM from WebAssembly inline asm

This commit is contained in:
Nikolay Nikolov 2024-07-22 16:45:26 +03:00
parent 43229cdf2e
commit ee3ff19312

View File

@ -720,6 +720,7 @@ Unit rawasmtext;
var
srsym: tsym;
srsymtable: TSymtable;
globsym: TWasmGlobalAsmSymbol;
begin
result:=nil;
case actasmtoken of
@ -985,6 +986,21 @@ Unit rawasmtext;
result.operands[1].opr.symbol:=thlcgwasm(hlcg).RefStackPointerSym;
Consume(AS_ID);
end;
'$'+TLS_SIZE_SYM,
'$'+TLS_ALIGN_SYM,
'$'+TLS_BASE_SYM:
begin
globsym:=TWasmGlobalAsmSymbol(
current_asmdata.RefAsmSymbolByClass(
TWasmGlobalAsmSymbol,
Copy(actasmpattern,2,Length(actasmpattern)-1),
AT_WASM_GLOBAL));
globsym.WasmGlobalType:=wbt_i32;
result.ops:=1;
result.operands[1].opr.typ:=OPR_SYMBOL;
result.operands[1].opr.symbol:=globsym;
Consume(AS_ID);
end;
else
internalerror(2024072002);
end;