+ added startup code for WASI

git-svn-id: branches/wasm@48304 -
This commit is contained in:
nickysn 2021-01-22 00:41:51 +00:00
parent 7f60637c92
commit f5f15e3dbf
4 changed files with 46 additions and 1 deletions

1
.gitattributes vendored
View File

@ -12193,6 +12193,7 @@ rtl/unix/x86.pp svneol=native#text/plain
rtl/wasi/Makefile svneol=native#text/plain
rtl/wasi/Makefile.fpc svneol=native#text/plain
rtl/wasi/rtldefs.inc svneol=native#text/plain
rtl/wasi/si_prc.pp svneol=native#text/plain
rtl/wasi/sysdir.inc svneol=native#text/plain
rtl/wasi/sysfile.inc svneol=native#text/plain
rtl/wasi/sysheap.inc svneol=native#text/plain

View File

@ -393,7 +393,8 @@ interface
system_i386_openbsd,system_x86_64_openbsd,
system_riscv32_linux,system_riscv64_linux,
system_aarch64_win64,
system_z80_zxspectrum,system_z80_msxdos
system_z80_zxspectrum,system_z80_msxdos,
system_wasm32_wasi
]+systems_darwin+systems_amigalike;
{ all systems that use the PE+ header in the PE/COFF file

View File

@ -66,6 +66,8 @@ type
constructor Create;override;
procedure SetDefaultInfo;override;
procedure InitSysInitUnitName;override;
function MakeExecutable:boolean;override;
function MakeSharedLibrary:boolean;override;
end;
@ -96,6 +98,11 @@ begin
//Info.DllCmd[2] := 'wasmtool --exportrename $INPUT $EXE';
end;
procedure tlinkerwasi.InitSysInitUnitName;
begin
sysinitunit:='si_prc';
end;
function tlinkerwasi.MakeExecutable:boolean;
var
GCSectionsStr : ansistring;

36
rtl/wasi/si_prc.pp Normal file
View File

@ -0,0 +1,36 @@
{
This file is part of the Free Pascal run time library.
Copyright (c) 2021 by Free Pascal development team
This file implements the startup code for WebAssembly programs that
don't link to the C library.
See the file COPYING.FPC, included in this distribution,
for details about the copyright.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
**********************************************************************}
unit si_prc;
interface
procedure _start;
implementation
procedure PASCALMAIN; external 'PASCALMAIN';
procedure _start;
begin
PASCALMAIN;
end;
exports
_start;
end.