From 408e388af3e48f51925fa2502a3b21a23478418e Mon Sep 17 00:00:00 2001 From: Nikolay Nikolov Date: Mon, 1 Jan 2024 17:36:52 +0200 Subject: [PATCH] + wasm internal linker: internally define the '__stack_pointer' global symbol --- compiler/ogwasm.pas | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/compiler/ogwasm.pas b/compiler/ogwasm.pas index 23cbd87f59..c7d404ae0c 100644 --- a/compiler/ogwasm.pas +++ b/compiler/ogwasm.pas @@ -254,6 +254,7 @@ interface procedure GenerateLibraryImports(ImportLibraryList:TFPHashObjectList);override; procedure AfterUnusedSectionRemoval;override; procedure MemPos_ExeSection(const aname:string);override; + procedure Load_Start;override; end; { TWasmAssembler } @@ -4467,6 +4468,15 @@ implementation inherited MemPos_ExeSection(aname); end; + procedure TWasmExeOutput.Load_Start; + const + aname='__stack_pointer'; + begin + inherited Load_Start; + internalObjData.createsection('*'+aname,0,[]); + internalObjData.SymbolDefine(aname,AB_GLOBAL,AT_WASM_GLOBAL); + end; + procedure TWasmExeOutput.PrepareImports; function AddFunctionImport(const libname,symname:TCmdStr; functype: TWasmFuncType): Integer;