mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-15 19:39:33 +02:00
[PATCH 184/188] update writing binary import section for entities
other than function update table normalization to hard-code the element type From 545def919260e7d90ec3b948f242022378607079 Mon Sep 17 00:00:00 2001 From: Dmitry Boyarintsev <skalogryz.lists@gmail.com> Date: Thu, 9 Apr 2020 14:08:42 -0400 git-svn-id: branches/wasm@46180 -
This commit is contained in:
parent
0e4e94dfe2
commit
addfbaf889
utils/wasmbin
@ -692,6 +692,8 @@ var
|
||||
sc : TSectionRec;
|
||||
i : integer;
|
||||
im : TWasmImport;
|
||||
const
|
||||
isMutableFlag : array [boolean] of byte = (global_const, global_mut);
|
||||
begin
|
||||
SectionBegin(SECT_IMPORT, sc);
|
||||
|
||||
@ -704,6 +706,17 @@ begin
|
||||
if Assigned(im.fn) then begin
|
||||
dst.WriteByte(IMPDESC_FUNC);
|
||||
WriteU32(dst, im.fn.functype.typeNum);
|
||||
end else if Assigned(im.mem) then begin
|
||||
dst.WriteByte(IMPDESC_MEM);
|
||||
WriteLimit(dst, im.mem.min, im.mem.max)
|
||||
end else if Assigned(im.table) then begin
|
||||
dst.WriteByte(IMPDESC_TABLE);
|
||||
dst.WriteByte(im.table.elemsType);
|
||||
WriteLimit(dst, im.table.min, im.table.max);
|
||||
end else if Assigned(im.glob) then begin
|
||||
dst.WriteByte(IMPDESC_GLOBAL);
|
||||
dst.WriteByte(im.glob.tp);
|
||||
dst.WriteByte(isMutableFlag[im.glob.isMutable]);
|
||||
end;
|
||||
end;
|
||||
SectionEnd(sc);
|
||||
|
@ -222,6 +222,8 @@ begin
|
||||
de := m.AddElement;
|
||||
de.tableId.idNum := t.id.idNum;
|
||||
|
||||
if t.elemsType = 0 then t.elemsType := ELEMTYPE_FUNC;
|
||||
|
||||
de.funcCount:=se.funcCount;
|
||||
if se.funcCount>0 then begin
|
||||
SetLength(de.funcs, de.funcCount);
|
||||
|
Loading…
Reference in New Issue
Block a user