mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-18 08:09:28 +02:00
+ add the __stack_pointer global import
This commit is contained in:
parent
e8c3f5d6b0
commit
905f0b1f78
@ -359,7 +359,7 @@ implementation
|
|||||||
objsec: TWasmObjSection;
|
objsec: TWasmObjSection;
|
||||||
segment_count: Integer = 0;
|
segment_count: Integer = 0;
|
||||||
cur_seg_ofs: qword = 0;
|
cur_seg_ofs: qword = 0;
|
||||||
imports_count: Integer = 1;
|
imports_count: Integer = 2;
|
||||||
begin
|
begin
|
||||||
for i:=0 to Data.ObjSectionList.Count-1 do
|
for i:=0 to Data.ObjSectionList.Count-1 do
|
||||||
begin
|
begin
|
||||||
@ -394,11 +394,18 @@ implementation
|
|||||||
WriteUleb(FWasmSections[wsiDataCount],segment_count);
|
WriteUleb(FWasmSections[wsiDataCount],segment_count);
|
||||||
|
|
||||||
WriteUleb(FWasmSections[wsiImport],imports_count);
|
WriteUleb(FWasmSections[wsiImport],imports_count);
|
||||||
|
{ import[0] }
|
||||||
WriteName(FWasmSections[wsiImport],'env');
|
WriteName(FWasmSections[wsiImport],'env');
|
||||||
WriteName(FWasmSections[wsiImport],'__linear_memory');
|
WriteName(FWasmSections[wsiImport],'__linear_memory');
|
||||||
WriteByte(FWasmSections[wsiImport],$02);
|
WriteByte(FWasmSections[wsiImport],$02); { mem }
|
||||||
WriteByte(FWasmSections[wsiImport],$00);
|
WriteByte(FWasmSections[wsiImport],$00); { min }
|
||||||
WriteUleb(FWasmSections[wsiImport],1);
|
WriteUleb(FWasmSections[wsiImport],1); { 1 page }
|
||||||
|
{ import[1] }
|
||||||
|
WriteName(FWasmSections[wsiImport],'env');
|
||||||
|
WriteName(FWasmSections[wsiImport],'__stack_pointer');
|
||||||
|
WriteByte(FWasmSections[wsiImport],$03); { global }
|
||||||
|
WriteByte(FWasmSections[wsiImport],$7F); { i32 }
|
||||||
|
WriteByte(FWasmSections[wsiImport],$01); { var }
|
||||||
|
|
||||||
Writer.write(WasmModuleMagic,SizeOf(WasmModuleMagic));
|
Writer.write(WasmModuleMagic,SizeOf(WasmModuleMagic));
|
||||||
Writer.write(WasmVersion,SizeOf(WasmVersion));
|
Writer.write(WasmVersion,SizeOf(WasmVersion));
|
||||||
|
Loading…
Reference in New Issue
Block a user