diff options
author | nickysn <nickysn@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2020-07-29 19:02:27 +0000 |
---|---|---|
committer | nickysn <nickysn@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2020-07-29 19:02:27 +0000 |
commit | 405e212452eba2c06c7cb251f830c6f4126ff066 (patch) | |
tree | f05a7f9baaa5d56192abfabbd46ad49bcfcb5768 | |
parent | 16f0526649c784dbe6e085737563c0352348a497 (diff) | |
download | fpc-405e212452eba2c06c7cb251f830c6f4126ff066.tar.gz |
[PATCH 55/83] minor fixes and cleanups for the wasm target (#1)
* wasm: add support to the Makefile.fpc files. Makefiles needs to be regen'd
* wasm: include fpcdefs.inc in all units
* wasm: one more missing fpcdefs.inc
* wasm: define some system macro defaults
* + increase the size of some tsysteminfo fields, as wasm uses longer names, this fixes some warnings
* wasm: fixed mkwasmreg program name
* wasm: don't override MakeCmdLine, the inherited function serves us just fine, as it also replaces . Also fixes a warning about result being uninitialized
From 3f1ed3fd157d3ed217ef8845ade8e3e3630f424b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?K=C3=A1roly=20Balogh?= <charlie@amigaspirit.hu>
Date: Mon, 23 Sep 2019 04:08:46 +0200
git-svn-id: https://svn.freepascal.org/svn/fpc/branches/wasm@45932 3ad0048d-3df7-0310-abae-a5850022a9f2
-rw-r--r-- | Makefile.fpc | 3 | ||||
-rw-r--r-- | compiler/Makefile.fpc | 14 | ||||
-rw-r--r-- | compiler/options.pas | 7 | ||||
-rw-r--r-- | compiler/systems.pas | 6 | ||||
-rw-r--r-- | compiler/systems/t_wasm.pas | 2 | ||||
-rw-r--r-- | compiler/utils/mkwasmreg.pp | 2 | ||||
-rw-r--r-- | compiler/wasm/agbinaryen.pas | 9 | ||||
-rw-r--r-- | compiler/wasm/agwat.pas | 3 | ||||
-rw-r--r-- | compiler/wasm/nwasmflw.pas | 2 | ||||
-rw-r--r-- | compiler/wasm/wasmdef.pas | 2 |
10 files changed, 34 insertions, 16 deletions
diff --git a/Makefile.fpc b/Makefile.fpc index 94ccd7778e..775e87974f 100644 --- a/Makefile.fpc +++ b/Makefile.fpc @@ -91,6 +91,9 @@ endif ifeq ($(CPU_TARGET),riscv64) PPSUF=rv64 endif +ifeq ($(CPU_TARGET),wasm) +PPSUF=wasm +endif # cross compilers uses full cpu_target, not just ppc-suffix # (except if the target cannot run a native compiler) diff --git a/compiler/Makefile.fpc b/compiler/Makefile.fpc index b422d1b65b..b2c899dd14 100644 --- a/compiler/Makefile.fpc +++ b/compiler/Makefile.fpc @@ -32,7 +32,7 @@ fpcdir=.. unexport FPC_VERSION FPC_COMPILERINFO # Which platforms are ready for inclusion in the cycle -CYCLETARGETS=i386 powerpc sparc arm x86_64 powerpc64 m68k armeb mipsel mips avr jvm i8086 aarch64 sparc64 riscv32 riscv64 +CYCLETARGETS=i386 powerpc sparc arm x86_64 powerpc64 m68k armeb mipsel mips avr jvm i8086 aarch64 sparc64 riscv32 riscv64 wasm # All supported targets used for clean ALLTARGETS=$(CYCLETARGETS) @@ -225,6 +225,9 @@ endif ifeq ($(CPC_TARGET),riscv64) CPUSUF=rv64 endif +ifeq ($(CPC_TARGET),wasm) +CPUSUF=wasm +endif # Do not define the default -d$(CPU_TARGET) because that # will conflict with our -d$(CPC_TARGET) @@ -356,6 +359,11 @@ ifeq ($(PPC_TARGET),riscv64) override LOCALOPT+=-Furiscv endif +# WASM specific +ifeq ($(PPC_TARGET),wasm) +override LOCALOPT+=-dNOOPT +endif + OPTWPOCOLLECT=-OWdevirtcalls,optvmts -FW$(BASEDIR)/pp1.wpo OPTWPOPERFORM=-Owdevirtcalls,optvmts -Fw$(BASEDIR)/pp1.wpo # symbol liveness WPO requires nm, smart linking and no stripping (the latter @@ -586,8 +594,8 @@ endif # cpu targets ##################################################################### -PPC_TARGETS=i386 m68k powerpc sparc arm armeb x86_64 powerpc64 mips mipsel avr jvm i8086 aarch64 sparc64 riscv32 riscv64 -PPC_SUFFIXES=386 68k ppc sparc arm armeb x64 ppc64 mips mipsel avr jvm 8086 a64 sparc64 rv32 rv64 +PPC_TARGETS=i386 m68k powerpc sparc arm armeb x86_64 powerpc64 mips mipsel avr jvm i8086 aarch64 sparc64 riscv32 riscv64 wasm +PPC_SUFFIXES=386 68k ppc sparc arm armeb x64 ppc64 mips mipsel avr jvm 8086 a64 sparc64 rv32 rv64 wasm INSTALL_TARGETS=$(addsuffix _exe_install,$(sort $(CYCLETARGETS) $(PPC_TARGETS))) SYMLINKINSTALL_TARGETS=$(addsuffix _symlink_install,$(sort $(CYCLETARGETS) $(PPC_TARGETS))) diff --git a/compiler/options.pas b/compiler/options.pas index 3c4199fdbe..8f6d233817 100644 --- a/compiler/options.pas +++ b/compiler/options.pas @@ -3705,6 +3705,13 @@ procedure read_arguments(cmd:TCmdStr); def_system_macro('FPC_REQUIRES_PROPER_ALIGNMENT'); {$endif riscv64} + {$ifdef wasm} + def_system_macro('CPUWASM'); + def_system_macro('CPU32'); + def_system_macro('FPC_CURRENCY_IS_INT64'); + def_system_macro('FPC_COMP_IS_INT64'); + {$endif wasm} + {$if defined(cpu8bitalu)} def_system_macro('CPUINT8'); {$elseif defined(cpu16bitalu)} diff --git a/compiler/systems.pas b/compiler/systems.pas index 02def202a0..96afcebb63 100644 --- a/compiler/systems.pas +++ b/compiler/systems.pas @@ -198,14 +198,14 @@ interface resobjext : string[7]; sharedlibext : string[10]; staticlibext, - staticlibprefix : string[4]; + staticlibprefix : string[6]; sharedlibprefix : string[4]; sharedClibext : string[10]; staticClibext, - staticClibprefix : string[4]; + staticClibprefix : string[6]; sharedClibprefix : string[4]; importlibprefix : string[10]; - importlibext : string[4]; + importlibext : string[6]; Cprefix : string[2]; newline : string[2]; dirsep : char; diff --git a/compiler/systems/t_wasm.pas b/compiler/systems/t_wasm.pas index 47ddfa9679..4bfcc2cec6 100644 --- a/compiler/systems/t_wasm.pas +++ b/compiler/systems/t_wasm.pas @@ -1,5 +1,7 @@ unit t_wasm; +{$i fpcdefs.inc} + interface uses diff --git a/compiler/utils/mkwasmreg.pp b/compiler/utils/mkwasmreg.pp index f7600429db..9e98c8f6ab 100644 --- a/compiler/utils/mkwasmreg.pp +++ b/compiler/utils/mkwasmreg.pp @@ -12,7 +12,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. **********************************************************************} -program mkspreg; +program mkwasmreg; const Version = '1.00'; max_regcount = 200; diff --git a/compiler/wasm/agbinaryen.pas b/compiler/wasm/agbinaryen.pas index a8c06c2cf1..6e31146195 100644 --- a/compiler/wasm/agbinaryen.pas +++ b/compiler/wasm/agbinaryen.pas @@ -55,7 +55,6 @@ interface function CreateNewAsmWriter: TExternalAssemblerOutputFile; override; public constructor CreateWithWriter(info: pasminfo; wr: TExternalAssemblerOutputFile; freewriter, smart: boolean); override; - function MakeCmdLine: TCmdStr;override; procedure WriteTree(p:TAsmList);override; procedure WriteAsmList;override; destructor destroy; override; @@ -471,14 +470,6 @@ implementation end; - function TBinaryenAssembler.MakeCmdLine: TCmdStr; - begin - Replace(result,'$EXTRAOPT',asmextraopt); - end; - - - - function TBinaryenAssembler.CreateNewAsmWriter: TExternalAssemblerOutputFile; begin Result:=TBinaryenAssemblerOutputFile.Create(self); diff --git a/compiler/wasm/agwat.pas b/compiler/wasm/agwat.pas index f78f7f3d87..0f84914dc9 100644 --- a/compiler/wasm/agwat.pas +++ b/compiler/wasm/agwat.pas @@ -23,6 +23,9 @@ } unit agwat; + +{$i fpcdefs.inc} + interface uses diff --git a/compiler/wasm/nwasmflw.pas b/compiler/wasm/nwasmflw.pas index 780a68ba65..6d36be0c89 100644 --- a/compiler/wasm/nwasmflw.pas +++ b/compiler/wasm/nwasmflw.pas @@ -21,6 +21,8 @@ } unit nwasmflw; +{$i fpcdefs.inc} + interface uses diff --git a/compiler/wasm/wasmdef.pas b/compiler/wasm/wasmdef.pas index 23d1f0c458..be8f6a4afd 100644 --- a/compiler/wasm/wasmdef.pas +++ b/compiler/wasm/wasmdef.pas @@ -1,5 +1,7 @@ unit wasmdef; +{$i fpcdefs.inc} + interface uses |