Browse Source

* synchronized with trunk

git-svn-id: branches/unicodekvm@49466 -
nickysn 4 years ago
parent
commit
35c1c14772

+ 4 - 0
.gitattributes

@@ -12332,6 +12332,8 @@ rtl/unix/unxovlh.inc svneol=native#text/plain
 rtl/unix/x86.pp svneol=native#text/plain
 rtl/unix/x86.pp svneol=native#text/plain
 rtl/wasi/Makefile svneol=native#text/plain
 rtl/wasi/Makefile svneol=native#text/plain
 rtl/wasi/Makefile.fpc svneol=native#text/plain
 rtl/wasi/Makefile.fpc svneol=native#text/plain
+rtl/wasi/classes.pp svneol=native#text/plain
+rtl/wasi/dos.pp svneol=native#text/plain
 rtl/wasi/rtldefs.inc svneol=native#text/plain
 rtl/wasi/rtldefs.inc svneol=native#text/plain
 rtl/wasi/si_prc.pp svneol=native#text/plain
 rtl/wasi/si_prc.pp svneol=native#text/plain
 rtl/wasi/sysdir.inc svneol=native#text/plain
 rtl/wasi/sysdir.inc svneol=native#text/plain
@@ -12341,6 +12343,7 @@ rtl/wasi/sysos.inc svneol=native#text/plain
 rtl/wasi/sysosh.inc svneol=native#text/plain
 rtl/wasi/sysosh.inc svneol=native#text/plain
 rtl/wasi/system.pp svneol=native#text/plain
 rtl/wasi/system.pp svneol=native#text/plain
 rtl/wasi/sysutils.pp svneol=native#text/plain
 rtl/wasi/sysutils.pp svneol=native#text/plain
+rtl/wasi/tthread.inc svneol=native#text/plain
 rtl/wasi/wasiapi.pp svneol=native#text/plain
 rtl/wasi/wasiapi.pp svneol=native#text/plain
 rtl/wasi/wasiinc/wasiprocs.inc svneol=native#text/plain
 rtl/wasi/wasiinc/wasiprocs.inc svneol=native#text/plain
 rtl/wasi/wasiinc/wasitypes.inc svneol=native#text/plain
 rtl/wasi/wasiinc/wasitypes.inc svneol=native#text/plain
@@ -12349,6 +12352,7 @@ rtl/wasm32/cpuinnr.inc svneol=native#text/plain
 rtl/wasm32/int64p.inc svneol=native#text/plain
 rtl/wasm32/int64p.inc svneol=native#text/plain
 rtl/wasm32/makefile.cpu svneol=native#text/plain
 rtl/wasm32/makefile.cpu svneol=native#text/plain
 rtl/wasm32/math.inc svneol=native#text/plain
 rtl/wasm32/math.inc svneol=native#text/plain
+rtl/wasm32/mathu.inc svneol=native#text/plain
 rtl/wasm32/set.inc svneol=native#text/plain
 rtl/wasm32/set.inc svneol=native#text/plain
 rtl/wasm32/setjump.inc svneol=native#text/plain
 rtl/wasm32/setjump.inc svneol=native#text/plain
 rtl/wasm32/setjumph.inc svneol=native#text/plain
 rtl/wasm32/setjumph.inc svneol=native#text/plain

+ 9 - 2
compiler/fmodule.pas

@@ -299,7 +299,7 @@ implementation
       SysUtils,globals,
       SysUtils,globals,
       verbose,systems,
       verbose,systems,
       scanner,ppu,dbgbase,
       scanner,ppu,dbgbase,
-      procinfo,symdef;
+      procinfo,symdef,symtype;
 
 
 {$ifdef MEMDEBUG}
 {$ifdef MEMDEBUG}
     var
     var
@@ -731,7 +731,14 @@ implementation
         memsymtable.start;
         memsymtable.start;
 {$endif}
 {$endif}
         derefdata.free;
         derefdata.free;
-        deflist.free;
+        if assigned(deflist) then
+          begin
+            for i:=0 to deflist.Count-1 do
+              if assigned(deflist[i]) and
+                 (tdef(deflist[i]).registered_in_module=self) then
+                tdef(deflist[i]).registered_in_module:=nil;
+            deflist.free;
+          end;
         symlist.free;
         symlist.free;
         ptrdefs.free;
         ptrdefs.free;
         arraydefs.free;
         arraydefs.free;

+ 6 - 6
compiler/i386/cpuinfo.pas

@@ -169,13 +169,13 @@ type
        CPUX86_HAS_BMI2,
        CPUX86_HAS_BMI2,
        CPUX86_HAS_POPCNT,
        CPUX86_HAS_POPCNT,
        CPUX86_HAS_LZCNT,
        CPUX86_HAS_LZCNT,
-       CPUX86_HAS_MOVBE,
-       CPUX86_HAS_FMA,
-       CPUX86_HAS_FMA4
+       CPUX86_HAS_MOVBE
       );
       );
 
 
    tfpuflags =
    tfpuflags =
       (FPUX86_HAS_AVXUNIT,
       (FPUX86_HAS_AVXUNIT,
+       FPUX86_HAS_FMA,
+       FPUX86_HAS_FMA4,
        FPUX86_HAS_AVX512F,
        FPUX86_HAS_AVX512F,
        FPUX86_HAS_AVX512VL,
        FPUX86_HAS_AVX512VL,
        FPUX86_HAS_AVX512DQ
        FPUX86_HAS_AVX512DQ
@@ -193,7 +193,7 @@ type
      { cpu_PentiumM  } [CPUX86_HAS_CMOV,CPUX86_HAS_SSEUNIT,CPUX86_HAS_SSE2],
      { cpu_PentiumM  } [CPUX86_HAS_CMOV,CPUX86_HAS_SSEUNIT,CPUX86_HAS_SSE2],
      { cpu_core_i    } [CPUX86_HAS_CMOV,CPUX86_HAS_SSEUNIT,CPUX86_HAS_SSE2,CPUX86_HAS_POPCNT],
      { cpu_core_i    } [CPUX86_HAS_CMOV,CPUX86_HAS_SSEUNIT,CPUX86_HAS_SSE2,CPUX86_HAS_POPCNT],
      { cpu_core_avx  } [CPUX86_HAS_CMOV,CPUX86_HAS_SSEUNIT,CPUX86_HAS_SSE2,CPUX86_HAS_POPCNT],
      { cpu_core_avx  } [CPUX86_HAS_CMOV,CPUX86_HAS_SSEUNIT,CPUX86_HAS_SSE2,CPUX86_HAS_POPCNT],
-     { cpu_core_avx2 } [CPUX86_HAS_CMOV,CPUX86_HAS_SSEUNIT,CPUX86_HAS_SSE2,CPUX86_HAS_POPCNT,CPUX86_HAS_BMI1,CPUX86_HAS_BMI2,CPUX86_HAS_LZCNT,CPUX86_HAS_MOVBE,CPUX86_HAS_FMA]
+     { cpu_core_avx2 } [CPUX86_HAS_CMOV,CPUX86_HAS_SSEUNIT,CPUX86_HAS_SSE2,CPUX86_HAS_POPCNT,CPUX86_HAS_BMI1,CPUX86_HAS_BMI2,CPUX86_HAS_LZCNT,CPUX86_HAS_MOVBE]
    );
    );
 
 
    fpu_capabilities : array[tfputype] of set of tfpuflags = (
    fpu_capabilities : array[tfputype] of set of tfpuflags = (
@@ -206,8 +206,8 @@ type
       { fpu_sse41    } [],
       { fpu_sse41    } [],
       { fpu_sse42    } [],
       { fpu_sse42    } [],
       { fpu_avx      } [FPUX86_HAS_AVXUNIT],
       { fpu_avx      } [FPUX86_HAS_AVXUNIT],
-      { fpu_avx2     } [FPUX86_HAS_AVXUNIT],
-      { fpu_avx512   } [FPUX86_HAS_AVXUNIT,FPUX86_HAS_AVX512F,FPUX86_HAS_AVX512VL,FPUX86_HAS_AVX512DQ]
+      { fpu_avx2     } [FPUX86_HAS_AVXUNIT,FPUX86_HAS_FMA],
+      { fpu_avx512   } [FPUX86_HAS_AVXUNIT,FPUX86_HAS_FMA,FPUX86_HAS_AVX512F,FPUX86_HAS_AVX512VL,FPUX86_HAS_AVX512DQ]
    );
    );
 
 
 Implementation
 Implementation

+ 1 - 1
compiler/options.pas

@@ -4884,7 +4884,7 @@ begin
 
 
 { hardware FMA support }
 { hardware FMA support }
 {$if defined(i386) or defined(x86_64)}
 {$if defined(i386) or defined(x86_64)}
-  if (cpu_capabilities[current_settings.cputype]*[CPUX86_HAS_FMA,CPUX86_HAS_FMA4])<>[] then
+  if (fpu_capabilities[current_settings.fputype]*[FPUX86_HAS_FMA,FPUX86_HAS_FMA4])<>[] then
     begin
     begin
       def_system_macro('FPC_HAS_FAST_FMA_SINGLE');
       def_system_macro('FPC_HAS_FAST_FMA_SINGLE');
       def_system_macro('FPC_HAS_FAST_FMA_DOUBLE');
       def_system_macro('FPC_HAS_FAST_FMA_DOUBLE');

+ 0 - 5
compiler/pdecvar.pas

@@ -1651,7 +1651,6 @@ implementation
          is_first_type: boolean;
          is_first_type: boolean;
 {$endif powerpc or powerpc64}
 {$endif powerpc or powerpc64}
          old_block_type: tblock_type;
          old_block_type: tblock_type;
-         tmpidx: Integer;
       begin
       begin
          old_block_type:=block_type;
          old_block_type:=block_type;
          block_type:=bt_var;
          block_type:=bt_var;
@@ -2022,10 +2021,6 @@ implementation
 
 
               trecordsymtable(recst).insertunionst(Unionsymtable,offset);
               trecordsymtable(recst).insertunionst(Unionsymtable,offset);
               uniondef.owner.deletedef(uniondef);
               uniondef.owner.deletedef(uniondef);
-              { this prevents a dangling pointer and use after free }
-              tmpidx:=current_module.deflist.IndexOfItem(uniondef,FromEnd);
-              if tmpidx<>-1 then
-                current_module.deflist[tmpidx]:=nil;
            end;
            end;
          { free the list }
          { free the list }
          sc.free;
          sc.free;

+ 0 - 5
compiler/pmodules.pas

@@ -614,7 +614,6 @@ implementation
         i: longint;
         i: longint;
         def: tdef;
         def: tdef;
         sym: tsym;
         sym: tsym;
-        tmpidx: Integer;
       begin
       begin
         for i:=current_module.localsymtable.deflist.count-1 downto 0 do
         for i:=current_module.localsymtable.deflist.count-1 downto 0 do
           begin
           begin
@@ -634,10 +633,6 @@ implementation
                    tprocdef(def).procsym.is_registered then
                    tprocdef(def).procsym.is_registered then
                  tprocsym(tprocdef(def).procsym).ProcdefList.Remove(def);
                  tprocsym(tprocdef(def).procsym).ProcdefList.Remove(def);
                 current_module.localsymtable.deletedef(def);
                 current_module.localsymtable.deletedef(def);
-                { this prevents a dangling pointer and use after free }
-                tmpidx:=current_module.deflist.IndexOfItem(def,FromEnd);
-                if tmpidx<>-1 then
-                  current_module.deflist[tmpidx]:=nil;
               end;
               end;
           end;
           end;
         { from high to low so we hopefully have moves of less data }
         { from high to low so we hopefully have moves of less data }

+ 0 - 5
compiler/pparautl.pas

@@ -780,7 +780,6 @@ implementation
         forwardfound : boolean;
         forwardfound : boolean;
         symentry: TSymEntry;
         symentry: TSymEntry;
         item : tlinkedlistitem;
         item : tlinkedlistitem;
-        tmpidx: Integer;
       begin
       begin
         forwardfound:=false;
         forwardfound:=false;
 
 
@@ -1093,10 +1092,6 @@ implementation
 
 
                    { Release current procdef }
                    { Release current procdef }
                    currpd.owner.deletedef(currpd);
                    currpd.owner.deletedef(currpd);
-                   { this prevents a dangling pointer and use after free }
-                   tmpidx:=current_module.deflist.IndexOfItem(currpd,FromEnd);
-                   if tmpidx<>-1 then
-                     current_module.deflist[tmpidx]:=nil;
                    currpd:=fwpd;
                    currpd:=fwpd;
                  end
                  end
                else
                else

+ 1 - 0
compiler/symdef.pas

@@ -2531,6 +2531,7 @@ implementation
              begin
              begin
                current_module.deflist.Add(self);
                current_module.deflist.Add(self);
                defid:=current_module.deflist.Count-1;
                defid:=current_module.deflist.Count-1;
+               registered_in_module:=current_module;
              end;
              end;
            maybe_put_in_symtable_stack;
            maybe_put_in_symtable_stack;
          end
          end

+ 22 - 1
compiler/symtype.pas

@@ -33,7 +33,8 @@ interface
       { symtable }
       { symtable }
       symconst,symbase,
       symconst,symbase,
       { aasm }
       { aasm }
-      aasmbase,ppu
+      aasmbase,ppu,
+      finput
       ;
       ;
 
 
     type
     type
@@ -65,6 +66,7 @@ interface
          function XMLPrintType: ansistring; virtual;
          function XMLPrintType: ansistring; virtual;
 {$endif DEBUG_NODE_XML}
 {$endif DEBUG_NODE_XML}
         public
         public
+         registered_in_module : tmodulebase;
          typesym    : tsym;  { which type the definition was generated this def }
          typesym    : tsym;  { which type the definition was generated this def }
          { stabs debugging }
          { stabs debugging }
          stab_number : word;
          stab_number : word;
@@ -72,6 +74,7 @@ interface
          defoptions  : tdefoptions;
          defoptions  : tdefoptions;
          defstates   : tdefstates;
          defstates   : tdefstates;
          constructor create(dt:tdeftyp);
          constructor create(dt:tdeftyp);
+         destructor destroy; override;
          procedure buildderef;virtual;abstract;
          procedure buildderef;virtual;abstract;
          procedure buildderefimpl;virtual;abstract;
          procedure buildderefimpl;virtual;abstract;
          procedure deref;virtual;abstract;
          procedure deref;virtual;abstract;
@@ -383,6 +386,23 @@ implementation
       end;
       end;
 
 
 
 
+    destructor tdef.destroy;
+      begin
+        { set self to nil in registered_in_module's deflist, if the def has been
+          registered, in order to avoid dangling pointers in registered_in_module.deflist }
+        if assigned(registered_in_module) then
+          begin
+           if defid>=0 then
+             tmodule(registered_in_module).deflist[defid]:=nil
+           else if defid<defid_not_registered then
+             tmodule(registered_in_module).deflist[-(defid-defid_not_registered+1)]:=nil
+           else
+             internalerror(2021060101);
+          end;
+        inherited;
+      end;
+
+
     function tdef.typename:string;
     function tdef.typename:string;
       begin
       begin
         result:=OwnerHierarchyName;
         result:=OwnerHierarchyName;
@@ -446,6 +466,7 @@ implementation
             if not assigned(current_module) then
             if not assigned(current_module) then
               internalerror(2015102505);
               internalerror(2015102505);
             current_module.deflist.Add(self);
             current_module.deflist.Add(self);
+            registered_in_module:=current_module;
             { invert the defid to indicate that it was only set because we
             { invert the defid to indicate that it was only set because we
               needed a unique number -- then add defid_not_registered so we
               needed a unique number -- then add defid_not_registered so we
               don't get the values between defid_registered and 0 }
               don't get the values between defid_registered and 0 }

+ 3 - 0
compiler/version.pas

@@ -83,6 +83,9 @@ interface
 {$ifdef cpuxtensa}
 {$ifdef cpuxtensa}
         source_cpu_string = 'xtensa';
         source_cpu_string = 'xtensa';
 {$endif cpuxtensa}
 {$endif cpuxtensa}
+{$ifdef cpuwasm32}
+        source_cpu_string = 'wasm32';
+{$endif cpuwasm32}
 
 
 function version_string:string;
 function version_string:string;
 function full_version_string:string;
 function full_version_string:string;

+ 16 - 0
compiler/wasm32/hlcgcpu.pas

@@ -225,6 +225,8 @@ uses
         twice. Returns how many stack slots have been consumed, disregarding
         twice. Returns how many stack slots have been consumed, disregarding
         the "dup". }
         the "dup". }
       function prepare_stack_for_ref(list: TAsmList; var ref: treference; dup: boolean): longint;
       function prepare_stack_for_ref(list: TAsmList; var ref: treference; dup: boolean): longint;
+
+      procedure gen_load_cgpara_loc(list: TAsmList; vardef: tdef; const para: TCGPara; var destloc: tlocation; reusepara: boolean);override;
      protected
      protected
       { return the load/store opcode to load/store from/to ref; if the result
       { return the load/store opcode to load/store from/to ref; if the result
         has to be and'ed after a load to get the final value, that constant
         has to be and'ed after a load to get the final value, that constant
@@ -1061,6 +1063,20 @@ implementation
         end;
         end;
     end;
     end;
 
 
+  procedure thlcgwasm.gen_load_cgpara_loc(list: TAsmList; vardef: tdef; const para: TCGPara; var destloc: tlocation; reusepara: boolean);
+    begin
+      { support loading a function result (from the evaluation stack), to a register }
+      if assigned(para.location) and (not assigned(para.location^.next)) and
+         (para.location^.loc in [LOC_REFERENCE,LOC_CREFERENCE]) and
+         (para.location^.reference.index=NR_EVAL_STACK_BASE) and
+         (para.location^.reference.offset=0) and
+         (def_cgsize(para.location^.Def)=destloc.size) and
+         (destloc.loc=LOC_REGISTER) then
+        a_load_stack_loc(list,para.location^.Def,destloc)
+      else
+        inherited;
+    end;
+
   procedure thlcgwasm.a_load_const_reg(list: TAsmList; tosize: tdef; a: tcgint; register: tregister);
   procedure thlcgwasm.a_load_const_reg(list: TAsmList; tosize: tdef; a: tcgint; register: tregister);
     begin
     begin
       a_load_const_stack(list,tosize,a,def2regtyp(tosize));
       a_load_const_stack(list,tosize,a,def2regtyp(tosize));

+ 17 - 5
compiler/wasm32/nwasmadd.pas

@@ -44,6 +44,7 @@ interface
           procedure second_cmp64bit;override;
           procedure second_cmp64bit;override;
           procedure second_add64bit; override;
           procedure second_add64bit; override;
           procedure second_cmpordinal;override;
           procedure second_cmpordinal;override;
+          procedure second_cmpsmallset;override;
 
 
           // special treatement for short-boolean expressions
           // special treatement for short-boolean expressions
           // using IF block, instead of direct labels
           // using IF block, instead of direct labels
@@ -260,6 +261,21 @@ interface
         second_generic_compare(not is_signed(left.resultdef));
         second_generic_compare(not is_signed(left.resultdef));
       end;
       end;
 
 
+
+    procedure twasmaddnode.second_cmpsmallset;
+      begin
+        case nodetype of
+          equaln,unequaln:
+            second_generic_compare(true);
+          lten,gten:
+            { not implemented yet }
+            internalerror(2021060104);
+          else
+            internalerror(2021060103);
+        end;
+      end;
+
+
     procedure twasmaddnode.second_addboolean;
     procedure twasmaddnode.second_addboolean;
       begin
       begin
         if (nodetype in [orn,andn]) and
         if (nodetype in [orn,andn]) and
@@ -318,14 +334,10 @@ interface
 
 
     procedure twasmaddnode.second_generic_compare(unsigned: boolean);
     procedure twasmaddnode.second_generic_compare(unsigned: boolean);
       var
       var
-        truelabel,
-        falselabel: tasmlabel;
         cmpop: TOpCmp;
         cmpop: TOpCmp;
       begin
       begin
-        truelabel:=nil;
-        falselabel:=nil;
         pass_left_right;
         pass_left_right;
-        { swap the operands to make it easier for the optimizer to optimize
+        { swap the operands to make it easier for the optimizer to optimize
           the operand stack slot reloading in case both are in a register }
           the operand stack slot reloading in case both are in a register }
         if (left.location.loc in [LOC_REGISTER,LOC_CREGISTER]) and
         if (left.location.loc in [LOC_REGISTER,LOC_CREGISTER]) and
            (right.location.loc in [LOC_REGISTER,LOC_CREGISTER]) then
            (right.location.loc in [LOC_REGISTER,LOC_CREGISTER]) then

+ 68 - 2
compiler/wasm32/nwasmcnv.pas

@@ -37,16 +37,18 @@ interface
          procedure second_int_to_real;override;
          procedure second_int_to_real;override;
          procedure second_int_to_bool;override;
          procedure second_int_to_bool;override;
          procedure second_ansistring_to_pchar;override;
          procedure second_ansistring_to_pchar;override;
+         procedure second_class_to_intf;override;
        end;
        end;
 
 
 implementation
 implementation
 
 
    uses
    uses
       verbose,globals,globtype,aasmdata,
       verbose,globals,globtype,aasmdata,
-      defutil,fmodule,cpubase,
+      defutil,defcmp,fmodule,cpubase,
       cgbase,cgutils,pass_1,pass_2,
       cgbase,cgutils,pass_1,pass_2,
       aasmbase,aasmcpu,
       aasmbase,aasmcpu,
-      symdef,
+      symdef,symconst,
+      tgobj,
       hlcgobj,hlcgcpu;
       hlcgobj,hlcgcpu;
 
 
 
 
@@ -167,6 +169,70 @@ implementation
         thlcgwasm(hlcg).a_load_stack_loc(current_asmdata.CurrAsmList,resultdef,location);
         thlcgwasm(hlcg).a_load_stack_loc(current_asmdata.CurrAsmList,resultdef,location);
       end;
       end;
 
 
+
+    procedure twasmtypeconvnode.second_class_to_intf;
+      var
+        hd : tobjectdef;
+        ImplIntf : TImplementedInterface;
+      begin
+        location_reset(location,LOC_REGISTER,def_cgsize(resultdef));
+        case left.location.loc of
+           LOC_CREFERENCE,
+           LOC_REFERENCE:
+             begin
+                location.register:=hlcg.getaddressregister(current_asmdata.CurrAsmList,resultdef);
+                hlcg.a_load_ref_reg(current_asmdata.CurrAsmList,left.resultdef,resultdef,left.location.reference,location.register);
+                location_freetemp(current_asmdata.CurrAsmList,left.location);
+             end;
+           LOC_CREGISTER:
+             begin
+                location.register:=hlcg.getaddressregister(current_asmdata.CurrAsmList,resultdef);
+                hlcg.a_load_reg_reg(current_asmdata.CurrAsmList,left.resultdef,resultdef,left.location.register,location.register);
+             end;
+           LOC_REGISTER:
+             begin
+               location.register:=left.location.register;
+               hlcg.g_ptrtypecast_reg(current_asmdata.CurrAsmList,left.resultdef,resultdef,location.register);
+             end;
+           LOC_CONSTANT:
+             begin
+                location.register:=hlcg.getaddressregister(current_asmdata.CurrAsmList,resultdef);
+                hlcg.a_load_const_reg(current_asmdata.CurrAsmList,resultdef,left.location.value,location.register);
+             end
+           else
+             internalerror(121120001);
+        end;
+        hd:=tobjectdef(left.resultdef);
+        while assigned(hd) do
+          begin
+            ImplIntf:=find_implemented_interface(hd,tobjectdef(resultdef));
+            if assigned(ImplIntf) then
+              begin
+                case ImplIntf.IType of
+                  etStandard:
+                    begin
+                      thlcgwasm(hlcg).a_cmp_const_reg_stack(current_asmdata.CurrAsmList,resultdef,OC_NE,0,location.register);
+
+                      current_asmdata.CurrAsmList.concat(taicpu.op_none(a_if));
+                      thlcgwasm(hlcg).incblock;
+                      thlcgwasm(hlcg).decstack(current_asmdata.CurrAsmList,1);
+
+                      hlcg.a_op_const_reg(current_asmdata.CurrAsmList,OP_ADD,resultdef,ImplIntf.ioffset,location.register);
+
+                      current_asmdata.CurrAsmList.concat(taicpu.op_none(a_end_if));
+                      thlcgwasm(hlcg).decblock;
+                      break;
+                    end;
+                  else
+                    internalerror(200802163);
+                end;
+              end;
+            hd:=hd.childof;
+          end;
+        if hd=nil then
+          internalerror(2002081301);
+      end;
+
 begin
 begin
   ctypeconvnode:=twasmtypeconvnode;
   ctypeconvnode:=twasmtypeconvnode;
 end.
 end.

+ 34 - 0
compiler/wasm32/nwasminl.pas

@@ -38,11 +38,14 @@ interface
         procedure second_memory_size;
         procedure second_memory_size;
         procedure second_memory_grow;
         procedure second_memory_grow;
         procedure second_unreachable;
         procedure second_unreachable;
+      protected
+        function first_sqr_real: tnode; override;
       public
       public
         function pass_typecheck_cpu: tnode; override;
         function pass_typecheck_cpu: tnode; override;
         function first_cpu: tnode; override;
         function first_cpu: tnode; override;
         procedure pass_generate_code_cpu; override;
         procedure pass_generate_code_cpu; override;
         procedure second_length;override;
         procedure second_length;override;
+        procedure second_sqr_real; override;
       end;
       end;
 
 
 implementation
 implementation
@@ -152,6 +155,13 @@ implementation
       end;
       end;
 
 
 
 
+    function twasminlinenode.first_sqr_real: tnode;
+      begin
+        expectloc:=LOC_FPUREGISTER;
+        first_sqr_real:=nil;
+      end;
+
+
     function twasminlinenode.pass_typecheck_cpu: tnode;
     function twasminlinenode.pass_typecheck_cpu: tnode;
       begin
       begin
         Result:=nil;
         Result:=nil;
@@ -268,6 +278,30 @@ implementation
           end;
           end;
       end;
       end;
 
 
+
+    procedure twasminlinenode.second_sqr_real;
+      begin
+        secondpass(left);
+        hlcg.location_force_fpureg(current_asmdata.CurrAsmList,left.location,left.resultdef,true);
+
+        thlcgwasm(hlcg).a_load_loc_stack(current_asmdata.CurrAsmList,left.resultdef,left.location);
+        thlcgwasm(hlcg).a_load_loc_stack(current_asmdata.CurrAsmList,left.resultdef,left.location);
+
+        case left.location.size of
+          OS_F32:
+            current_asmdata.CurrAsmList.Concat(taicpu.op_none(a_f32_mul));
+          OS_F64:
+            current_asmdata.CurrAsmList.Concat(taicpu.op_none(a_f64_mul));
+          else
+            internalerror(2021060102);
+        end;
+        thlcgwasm(hlcg).decstack(current_asmdata.CurrAsmList,1);
+
+        location_reset(location,LOC_FPUREGISTER,def_cgsize(resultdef));
+        location.register:=hlcg.getregisterfordef(current_asmdata.CurrAsmList,resultdef);
+        thlcgwasm(hlcg).a_load_stack_loc(current_asmdata.CurrAsmList,resultdef,location);
+      end;
+
 begin
 begin
   cinlinenode:=twasminlinenode;
   cinlinenode:=twasminlinenode;
 end.
 end.

+ 1 - 1
compiler/x86/nx86add.pas

@@ -1169,7 +1169,7 @@ unit nx86add;
 {$ifndef i8086}
 {$ifndef i8086}
         { test if the result stays in an xmm register, fiddeling with fpu registers and fma makes no sense }
         { test if the result stays in an xmm register, fiddeling with fpu registers and fma makes no sense }
         Result:=use_vectorfpu(resultdef) and
         Result:=use_vectorfpu(resultdef) and
-          ((cpu_capabilities[current_settings.cputype]*[CPUX86_HAS_FMA,CPUX86_HAS_FMA4])<>[]);
+          ((fpu_capabilities[current_settings.fputype]*[FPUX86_HAS_FMA,FPUX86_HAS_FMA4])<>[]);
 {$else i8086}
 {$else i8086}
         Result:=inherited use_fma;
         Result:=inherited use_fma;
 {$endif i8086}
 {$endif i8086}

+ 2 - 2
compiler/x86/nx86inl.pas

@@ -352,7 +352,7 @@ implementation
      function tx86inlinenode.first_fma : tnode;
      function tx86inlinenode.first_fma : tnode;
        begin
        begin
 {$ifndef i8086}
 {$ifndef i8086}
-         if ((cpu_capabilities[current_settings.cputype]*[CPUX86_HAS_FMA,CPUX86_HAS_FMA4])<>[]) and
+         if ((fpu_capabilities[current_settings.fputype]*[FPUX86_HAS_FMA,FPUX86_HAS_FMA4])<>[]) and
            ((is_double(resultdef)) or (is_single(resultdef))) then
            ((is_double(resultdef)) or (is_single(resultdef))) then
            begin
            begin
              expectloc:=LOC_MMREGISTER;
              expectloc:=LOC_MMREGISTER;
@@ -1183,7 +1183,7 @@ implementation
 {$endif i8086}
 {$endif i8086}
       begin
       begin
 {$ifndef i8086}
 {$ifndef i8086}
-         if (cpu_capabilities[current_settings.cputype]*[CPUX86_HAS_FMA,CPUX86_HAS_FMA4])<>[] then
+         if (fpu_capabilities[current_settings.fputype]*[FPUX86_HAS_FMA,FPUX86_HAS_FMA4])<>[] then
            begin
            begin
              negop3:=false;
              negop3:=false;
              negproduct:=false;
              negproduct:=false;

+ 6 - 6
compiler/x86_64/cpuinfo.pas

@@ -174,13 +174,13 @@ type
        CPUX86_HAS_BMI2,
        CPUX86_HAS_BMI2,
        CPUX86_HAS_POPCNT,
        CPUX86_HAS_POPCNT,
        CPUX86_HAS_LZCNT,
        CPUX86_HAS_LZCNT,
-       CPUX86_HAS_MOVBE,
-       CPUX86_HAS_FMA,
-       CPUX86_HAS_FMA4
+       CPUX86_HAS_MOVBE
       );
       );
 
 
    tfpuflags =
    tfpuflags =
       (FPUX86_HAS_AVXUNIT,
       (FPUX86_HAS_AVXUNIT,
+       FPUX86_HAS_FMA,
+       FPUX86_HAS_FMA4,
        FPUX86_HAS_32MMREGS,
        FPUX86_HAS_32MMREGS,
        FPUX86_HAS_AVX512F,
        FPUX86_HAS_AVX512F,
        FPUX86_HAS_AVX512VL,
        FPUX86_HAS_AVX512VL,
@@ -193,7 +193,7 @@ type
      { Athlon64      } [CPUX86_HAS_CMOV,CPUX86_HAS_SSEUNIT,CPUX86_HAS_SSE2],
      { Athlon64      } [CPUX86_HAS_CMOV,CPUX86_HAS_SSEUNIT,CPUX86_HAS_SSE2],
      { cpu_core_i    } [CPUX86_HAS_CMOV,CPUX86_HAS_SSEUNIT,CPUX86_HAS_SSE2,CPUX86_HAS_POPCNT],
      { cpu_core_i    } [CPUX86_HAS_CMOV,CPUX86_HAS_SSEUNIT,CPUX86_HAS_SSE2,CPUX86_HAS_POPCNT],
      { cpu_core_avx  } [CPUX86_HAS_CMOV,CPUX86_HAS_SSEUNIT,CPUX86_HAS_SSE2,CPUX86_HAS_POPCNT],
      { cpu_core_avx  } [CPUX86_HAS_CMOV,CPUX86_HAS_SSEUNIT,CPUX86_HAS_SSE2,CPUX86_HAS_POPCNT],
-     { cpu_core_avx2 } [CPUX86_HAS_CMOV,CPUX86_HAS_SSEUNIT,CPUX86_HAS_SSE2,CPUX86_HAS_POPCNT,CPUX86_HAS_BMI1,CPUX86_HAS_BMI2,CPUX86_HAS_LZCNT,CPUX86_HAS_MOVBE,CPUX86_HAS_FMA]
+     { cpu_core_avx2 } [CPUX86_HAS_CMOV,CPUX86_HAS_SSEUNIT,CPUX86_HAS_SSE2,CPUX86_HAS_POPCNT,CPUX86_HAS_BMI1,CPUX86_HAS_BMI2,CPUX86_HAS_LZCNT,CPUX86_HAS_MOVBE]
    );
    );
 
 
    fpu_capabilities : array[tfputype] of set of tfpuflags = (
    fpu_capabilities : array[tfputype] of set of tfpuflags = (
@@ -204,8 +204,8 @@ type
       { fpu_sse41    } [],
       { fpu_sse41    } [],
       { fpu_sse42    } [],
       { fpu_sse42    } [],
       { fpu_avx      } [FPUX86_HAS_AVXUNIT],
       { fpu_avx      } [FPUX86_HAS_AVXUNIT],
-      { fpu_avx2     } [FPUX86_HAS_AVXUNIT],
-      { fpu_avx512   } [FPUX86_HAS_AVXUNIT,FPUX86_HAS_32MMREGS,FPUX86_HAS_AVX512F,FPUX86_HAS_AVX512VL,FPUX86_HAS_AVX512DQ]
+      { fpu_avx2     } [FPUX86_HAS_AVXUNIT,FPUX86_HAS_FMA],
+      { fpu_avx512   } [FPUX86_HAS_AVXUNIT,FPUX86_HAS_FMA,FPUX86_HAS_32MMREGS,FPUX86_HAS_AVX512F,FPUX86_HAS_AVX512VL,FPUX86_HAS_AVX512DQ]
    );
    );
 
 
 Implementation
 Implementation

+ 1 - 1
packages/fcl-base/fpmake.pp

@@ -26,7 +26,7 @@ begin
     P.Email := '';
     P.Email := '';
     P.Description := 'Base library of Free Component Libraries (FCL), FPC''s OOP library.';
     P.Description := 'Base library of Free Component Libraries (FCL), FPC''s OOP library.';
     P.NeedLibC:= false;
     P.NeedLibC:= false;
-    P.OSes:=AllOSes-[embedded,msdos,win16,macosclassic,palmos,zxspectrum,msxdos,amstradcpc,sinclairql,wasi];
+    P.OSes:=AllOSes-[embedded,msdos,win16,macosclassic,palmos,zxspectrum,msxdos,amstradcpc,sinclairql];
     if Defaults.CPU=jvm then
     if Defaults.CPU=jvm then
       P.OSes := P.OSes - [java,android];
       P.OSes := P.OSes - [java,android];
 
 

+ 1 - 1
packages/fcl-registry/fpmake.pp

@@ -27,7 +27,7 @@ begin
     P.Email := '';
     P.Email := '';
     P.Description := 'Windows registry + emulation parts of Free Component Libraries (FCL), FPC''s OOP library.';
     P.Description := 'Windows registry + emulation parts of Free Component Libraries (FCL), FPC''s OOP library.';
     P.NeedLibC:= false;
     P.NeedLibC:= false;
-    P.OSes:=AllOSes-[embedded,msdos,win16,macosclassic,palmos,zxspectrum,msxdos,amstradcpc,sinclairql,wasi];
+    P.OSes:=AllOSes-[embedded,msdos,win16,macosclassic,palmos,zxspectrum,msxdos,amstradcpc,sinclairql];
     if Defaults.CPU=jvm then
     if Defaults.CPU=jvm then
       P.OSes := P.OSes - [java,android];
       P.OSes := P.OSes - [java,android];
 
 

+ 1 - 1
packages/fcl-sound/fpmake.pp

@@ -26,7 +26,7 @@ begin
     P.Email := '';
     P.Email := '';
     P.Description := 'Sound loading, storing and conversion parts for the Free Component Libraries (FCL), FPC''s OOP library.';
     P.Description := 'Sound loading, storing and conversion parts for the Free Component Libraries (FCL), FPC''s OOP library.';
     P.NeedLibC:= false;
     P.NeedLibC:= false;
-    P.OSes:=AllOSes-[embedded,msdos,win16,macosclassic,palmos,zxspectrum,msxdos,amstradcpc,sinclairql,wasi];
+    P.OSes:=AllOSes-[embedded,msdos,win16,macosclassic,palmos,zxspectrum,msxdos,amstradcpc,sinclairql];
     if Defaults.CPU=jvm then
     if Defaults.CPU=jvm then
       P.OSes := P.OSes - [java,android];
       P.OSes := P.OSes - [java,android];
 
 

+ 1 - 1
packages/fcl-stl/fpmake.pp

@@ -25,7 +25,7 @@ begin
     P.Email := '';
     P.Email := '';
     P.Description := 'Generic container library of Free Component Libraries (FCL), FPC''s OOP library.';
     P.Description := 'Generic container library of Free Component Libraries (FCL), FPC''s OOP library.';
     P.NeedLibC:= false;
     P.NeedLibC:= false;
-    P.OSes:=AllOSes-[embedded,zxspectrum,msxdos,amstradcpc,sinclairql,wasi];
+    P.OSes:=AllOSes-[embedded,zxspectrum,msxdos,amstradcpc,sinclairql];
     if Defaults.CPU=jvm then
     if Defaults.CPU=jvm then
       P.OSes := P.OSes - [java,android];
       P.OSes := P.OSes - [java,android];
 
 

+ 1 - 1
packages/fcl-xml/fpmake.pp

@@ -29,7 +29,7 @@ begin
     P.Email := '';
     P.Email := '';
     P.Description := 'XML and DOM parts of Free Component Libraries (FCL), FPC''s OOP library.';
     P.Description := 'XML and DOM parts of Free Component Libraries (FCL), FPC''s OOP library.';
     P.NeedLibC:= false;
     P.NeedLibC:= false;
-    P.OSes:=AllOSes-[embedded,msdos,win16,macosclassic,palmos,zxspectrum,msxdos,amstradcpc,sinclairql,wasi];
+    P.OSes:=AllOSes-[embedded,msdos,win16,macosclassic,palmos,zxspectrum,msxdos,amstradcpc,sinclairql];
     if Defaults.CPU=jvm then
     if Defaults.CPU=jvm then
       P.OSes := P.OSes - [java,android];
       P.OSes := P.OSes - [java,android];
 
 

+ 1 - 1
packages/hash/fpmake.pp

@@ -23,7 +23,7 @@ begin
     P.Email := '';
     P.Email := '';
     P.Description := 'Several hash and cryptography algorithms (MD5,CRC,Linux crypt and NTLM1).';
     P.Description := 'Several hash and cryptography algorithms (MD5,CRC,Linux crypt and NTLM1).';
     P.NeedLibC:= false;
     P.NeedLibC:= false;
-    P.OSes:=P.OSes-[embedded,win16,macosclassic,palmos,zxspectrum,msxdos,amstradcpc,sinclairql,wasi];
+    P.OSes:=P.OSes-[embedded,win16,macosclassic,palmos,zxspectrum,msxdos,amstradcpc,sinclairql];
     if Defaults.CPU=jvm then
     if Defaults.CPU=jvm then
       P.OSes := P.OSes - [java,android];
       P.OSes := P.OSes - [java,android];
 
 

+ 5 - 2
packages/paszlib/src/gzio.pas

@@ -88,6 +88,7 @@ type gz_stream = record
   transparent : boolean;  { true if input file is not a .gz file }
   transparent : boolean;  { true if input file is not a .gz file }
   mode        : char;     { 'w' or 'r' }
   mode        : char;     { 'w' or 'r' }
   startpos    : longint;     { start of compressed data in file (header skipped) }
   startpos    : longint;     { start of compressed data in file (header skipped) }
+  total_out : cardinal;  { Total read, over blocks }
 end;
 end;
 
 
 type gz_streamp = ^gz_stream;
 type gz_streamp = ^gz_stream;
@@ -164,6 +165,7 @@ begin
   s^.crc := crc32(0, nil, 0);
   s^.crc := crc32(0, nil, 0);
   s^.msg := '';
   s^.msg := '';
   s^.transparent := false;
   s^.transparent := false;
+  s^.total_out:=0;
 
 
   s^.path := path; { limit to 255 chars }
   s^.path := path; { limit to 255 chars }
 
 
@@ -563,7 +565,7 @@ var
 {$endif}
 {$endif}
 
 
 begin
 begin
-
+  filelen := 0;
   s := gz_streamp(f);
   s := gz_streamp(f);
   start := Pbyte(buf); { starting point for crc computation }
   start := Pbyte(buf); { starting point for crc computation }
 
 
@@ -643,7 +645,7 @@ begin
       filecrc := getLong (s);
       filecrc := getLong (s);
       filelen := getLong (s);
       filelen := getLong (s);
 
 
-      if (s^.crc <> filecrc) or (s^.stream.total_out <> filelen)
+      if (s^.crc <> filecrc) or (s^.stream.total_out-s^.total_out <> filelen)
         then s^.z_err := Z_DATA_ERROR
         then s^.z_err := Z_DATA_ERROR
 	else begin
 	else begin
 	  { Check for concatenated .gz files: }
 	  { Check for concatenated .gz files: }
@@ -651,6 +653,7 @@ begin
 	  if (s^.z_err = Z_OK) then begin
 	  if (s^.z_err = Z_OK) then begin
             total_in := s^.stream.total_in;
             total_in := s^.stream.total_in;
             total_out := s^.stream.total_out;
             total_out := s^.stream.total_out;
+            s^.total_out:=total_out;
 
 
 	    inflateReset (s^.stream);
 	    inflateReset (s^.stream);
 	    s^.stream.total_in := total_in;
 	    s^.stream.total_in := total_in;

+ 1 - 1
packages/regexpr/fpmake.pp

@@ -19,7 +19,7 @@ begin
     P.Directory:=ADirectory;
     P.Directory:=ADirectory;
 {$endif ALLPACKAGES}
 {$endif ALLPACKAGES}
     P.Version:='3.3.1';
     P.Version:='3.3.1';
-    P.OSes:=P.OSes-[embedded,win16,macosclassic,palmos,zxspectrum,msxdos,amstradcpc,sinclairql,wasi];
+    P.OSes:=P.OSes-[embedded,win16,macosclassic,palmos,zxspectrum,msxdos,amstradcpc,sinclairql];
     if Defaults.CPU=jvm then
     if Defaults.CPU=jvm then
       P.OSes := P.OSes - [java,android];
       P.OSes := P.OSes - [java,android];
 
 

+ 6 - 4
packages/rtl-extra/fpmake.pp

@@ -21,9 +21,9 @@ Const
 
 
   PrinterOSes   = [go32v2,msdos,os2,win32,win64]+unixlikes-[beos,haiku,morphos];
   PrinterOSes   = [go32v2,msdos,os2,win32,win64]+unixlikes-[beos,haiku,morphos];
   SerialOSes    = [android,linux,netbsd,openbsd,win32,win64];
   SerialOSes    = [android,linux,netbsd,openbsd,win32,win64];
-  UComplexOSes  = [atari,embedded,emx,gba,go32v2,msdos,nativent,nds,netware,netwlibc,os2,sinclairql,symbian,watcom,wii,wince,win32,win64,freertos]+UnixLikes+AllAmigaLikeOSes;
-  MatrixOSes    = [atari,embedded,emx,gba,go32v2,msdos,nativent,nds,netware,netwlibc,os2,sinclairql,symbian,watcom,wii,win32,win64,wince,freertos]+UnixLikes+AllAmigaLikeOSes;
-  ObjectsOSes   = [atari,embedded,emx,gba,go32v2,macosclassic,msdos,nds,netware,netwlibc,os2,sinclairql,symbian,watcom,wii,win16,win32,win64,wince,freertos]+UnixLikes+AllAmigaLikeOSes;
+  UComplexOSes  = [atari,embedded,emx,gba,go32v2,msdos,nativent,nds,netware,netwlibc,os2,sinclairql,symbian,watcom,wii,wince,win32,win64,freertos,wasi]+UnixLikes+AllAmigaLikeOSes;
+  MatrixOSes    = [atari,embedded,emx,gba,go32v2,msdos,nativent,nds,netware,netwlibc,os2,sinclairql,symbian,watcom,wii,win32,win64,wince,freertos,wasi]+UnixLikes+AllAmigaLikeOSes;
+  ObjectsOSes   = [atari,embedded,emx,gba,go32v2,macosclassic,msdos,nds,netware,netwlibc,os2,sinclairql,symbian,watcom,wii,win16,win32,win64,wince,freertos,wasi]+UnixLikes+AllAmigaLikeOSes;
   WinsockOSes   = [win32,win64,wince,os2,emx,netware,netwlibc];
   WinsockOSes   = [win32,win64,wince,os2,emx,netware,netwlibc];
   WinSock2OSes  = [win32,win64,wince];
   WinSock2OSes  = [win32,win64,wince];
   SocketsOSes   = UnixLikes+AllAmigaLikeOSes+[netware,netwlibc,os2,emx,wince,win32,win64];
   SocketsOSes   = UnixLikes+AllAmigaLikeOSes+[netware,netwlibc,os2,emx,wince,win32,win64];
@@ -95,6 +95,7 @@ begin
     // Add clocale for Android first in order to compile the source file
     // Add clocale for Android first in order to compile the source file
     // from the 'android' dir, not the 'unix' dir.
     // from the 'android' dir, not the 'unix' dir.
     T:=P.Targets.AddUnit('real48utils.pp',AllTargetsextra-[msdos,win16]  { msdos,win16 excluded temporarily, until bitpacked records containing longints on 16-bit targets are fixed }
     T:=P.Targets.AddUnit('real48utils.pp',AllTargetsextra-[msdos,win16]  { msdos,win16 excluded temporarily, until bitpacked records containing longints on 16-bit targets are fixed }
+                                                         -[wasi]         { internal error on the WebAssembly target }
                                                          -[embedded]);   { at least avr has no floats }
                                                          -[embedded]);   { at least avr has no floats }
     if Defaults.CPU<>jvm then
     if Defaults.CPU<>jvm then
       T:=P.Targets.AddUnit('clocale.pp',[android]);
       T:=P.Targets.AddUnit('clocale.pp',[android]);
@@ -158,7 +159,8 @@ begin
      begin
      begin
        addinclude('clocale.inc',clocaleincOSes);
        addinclude('clocale.inc',clocaleincOSes);
      end;
      end;
-    T:=P.Targets.AddUnit('sortalgs.pp');
+    T:=P.Targets.AddUnit('sortalgs.pp',AllTargetsextra
+                                       -[wasi]);  { uses goto, which is not supported on the WebAssembly target }
   end
   end
 end;
 end;
 
 

+ 7 - 7
packages/rtl-objpas/fpmake.pp

@@ -15,22 +15,22 @@ Const
 //  AllUnixOSes  = [Linux,FreeBSD,NetBSD,OpenBSD,Darwin,QNX,BeOS,Solaris,Haiku,iphonesim,ios,aix,Android];
 //  AllUnixOSes  = [Linux,FreeBSD,NetBSD,OpenBSD,Darwin,QNX,BeOS,Solaris,Haiku,iphonesim,ios,aix,Android];
 //    unixlikes-[beos];
 //    unixlikes-[beos];
 //
 //
-  StrUtilsOSes  = [atari,emx,gba,go32v2,msdos,nds,netware,wince,nativent,os2,netwlibc,sinclairql,symbian,watcom,wii,win32,win64,freertos]+UnixLikes+AllAmigaLikeOSes;
-  VarUtilsOSes  = [atari,emx,gba,go32v2,msdos,nds,netware,wince,nativent,os2,netwlibc,sinclairql,symbian,watcom,wii,win32,win64,freertos]+UnixLikes+AllAmigaLikeOSes;
-  ConvUtilsOSes = [nativent,netware,netwlibc,sinclairql,win32,win64,wince]+AllAmigaLikeOSes+UnixLikes-[BeOS];
+  StrUtilsOSes  = [atari,emx,gba,go32v2,msdos,nds,netware,wince,nativent,os2,netwlibc,sinclairql,symbian,watcom,wii,win32,win64,freertos,wasi]+UnixLikes+AllAmigaLikeOSes;
+  VarUtilsOSes  = [atari,emx,gba,go32v2,msdos,nds,netware,wince,nativent,os2,netwlibc,sinclairql,symbian,watcom,wii,win32,win64,freertos,wasi]+UnixLikes+AllAmigaLikeOSes;
+  ConvUtilsOSes = [nativent,netware,netwlibc,sinclairql,win32,win64,wince,wasi]+AllAmigaLikeOSes+UnixLikes-[BeOS];
   ConvUtilOSes  = [atari,Go32v2,msdos,os2,emx,freertos,watcom];
   ConvUtilOSes  = [atari,Go32v2,msdos,os2,emx,freertos,watcom];
-  DateUtilsOSes = [gba,nativent,nds,netware,netwlibc,sinclairql,symbian,wii,win32,win64,wince,freertos]+UnixLikes+AllAmigaLikeOSes;
+  DateUtilsOSes = [gba,nativent,nds,netware,netwlibc,sinclairql,symbian,wii,win32,win64,wince,freertos,wasi]+UnixLikes+AllAmigaLikeOSes;
   DateUtilOSes  = [atari,Go32v2,msdos,os2,emx,freertos,watcom];
   DateUtilOSes  = [atari,Go32v2,msdos,os2,emx,freertos,watcom];
-  StdConvsOSes  = [NativeNT,Win32,win64,os2,msdos,go32v2,freertos]+UnixLikes-[BeOS];
+  StdConvsOSes  = [NativeNT,Win32,win64,os2,msdos,go32v2,freertos,wasi]+UnixLikes-[BeOS];
   FmtBCDOSes    = [atari,emx,gba,go32v2,msdos,nativent,nds,netware,netwlibc,os2,sinclairql,symbian,watcom,wii,win32,win64,wince,freertos]+UnixLikes+AllAmigaLikeOSes;
   FmtBCDOSes    = [atari,emx,gba,go32v2,msdos,nativent,nds,netware,netwlibc,os2,sinclairql,symbian,watcom,wii,win32,win64,wince,freertos]+UnixLikes+AllAmigaLikeOSes;
   VariantsOSes  = [atari,emx,gba,go32v2,msdos,nativent,nds,netware,netwlibc,os2,sinclairql,symbian,watcom,wii,win32,win64,wince,freertos]+UnixLikes+AllAmigaLikeOSes;
   VariantsOSes  = [atari,emx,gba,go32v2,msdos,nativent,nds,netware,netwlibc,os2,sinclairql,symbian,watcom,wii,win32,win64,wince,freertos]+UnixLikes+AllAmigaLikeOSes;
   RttiOSes      = [atari,emx,gba,go32v2,msdos,nativent,nds,netware,netwlibc,os2,sinclairql,watcom,wii,win32,win64,wince,freertos]+UnixLikes+AllAmigaLikeOSes;
   RttiOSes      = [atari,emx,gba,go32v2,msdos,nativent,nds,netware,netwlibc,os2,sinclairql,watcom,wii,win32,win64,wince,freertos]+UnixLikes+AllAmigaLikeOSes;
-  UItypesOSes   = [atari,emx,gba,go32v2,msdos,nativent,nds,netware,netwlibc,os2,sinclairql,watcom,wii,win32,win64,wince,freertos]+UnixLikes+AllAmigaLikeOSes-ConvUtilOSes;
+  UItypesOSes   = [atari,emx,gba,go32v2,msdos,nativent,nds,netware,netwlibc,os2,sinclairql,watcom,wii,win32,win64,wince,freertos,wasi]+UnixLikes+AllAmigaLikeOSes-ConvUtilOSes;
   AllTargetsObjPas = DateUtilsOses +DateUtilOSes+
   AllTargetsObjPas = DateUtilsOses +DateUtilOSes+
                   VarutilsOses + ConvutilsOSes + ConvutilOSes + StdConvsOSes+
                   VarutilsOses + ConvutilsOSes + ConvutilOSes + StdConvsOSes+
                   FmtBCDOSes + StrUtilsOSes + UITypesOSes;
                   FmtBCDOSes + StrUtilsOSes + UITypesOSes;
 
 
-  CommonSrcOSes = [atari,emx,gba,go32v2,msdos,nds,netware,wince,nativent,os2,netwlibc,sinclairql,symbian,watcom,wii,freertos]+UnixLikes+AllAmigaLikeOSes;
+  CommonSrcOSes = [atari,emx,gba,go32v2,msdos,nds,netware,wince,nativent,os2,netwlibc,sinclairql,symbian,watcom,wii,freertos,wasi]+UnixLikes+AllAmigaLikeOSes;
 
 
 Var
 Var
   P : TPackage;
   P : TPackage;

+ 2 - 2
packages/rtl-unicode/fpmake.pp

@@ -12,8 +12,8 @@ Const
   // in workable state atm.
   // in workable state atm.
   UnixLikes = AllUnixOSes -[QNX];
   UnixLikes = AllUnixOSes -[QNX];
 
 
-  CollationOSes = [aix,android,darwin,emx,freebsd,go32v2,linux,netbsd,openbsd,os2,solaris,win32,win64,dragonfly,haiku,freertos,watcom];
-  CPUnits       = [aix,amiga,aros,android,beos,darwin,iphonesim,ios,emx,gba,nds,freebsd,go32v2,haiku,linux,morphos,netbsd,netware,netwlibc,openbsd,os2,solaris,watcom,wii,win32,win64,wince,dragonfly,freertos];
+  CollationOSes = [aix,android,darwin,emx,freebsd,go32v2,linux,netbsd,openbsd,os2,solaris,win32,win64,dragonfly,haiku,freertos,watcom,wasi];
+  CPUnits       = [aix,amiga,aros,android,beos,darwin,iphonesim,ios,emx,gba,nds,freebsd,go32v2,haiku,linux,morphos,netbsd,netware,netwlibc,openbsd,os2,solaris,watcom,wii,win32,win64,wince,dragonfly,freertos,wasi];
   utf8bidiOSes  = [netware,netwlibc];
   utf8bidiOSes  = [netware,netwlibc];
   freebidiOSes  = [netware,netwlibc];
   freebidiOSes  = [netware,netwlibc];
   GraphemeBreakPropertyOSes = AllOSes-[embedded,zxspectrum,msxdos,amstradcpc];
   GraphemeBreakPropertyOSes = AllOSes-[embedded,zxspectrum,msxdos,amstradcpc];

+ 149 - 106
rtl/wasi/Makefile

@@ -366,322 +366,322 @@ ifdef NO_EXCEPTIONS_IN_SYSTEM
 override FPCOPT+=-dNO_EXCEPTIONS_IN_SYSTEM
 override FPCOPT+=-dNO_EXCEPTIONS_IN_SYSTEM
 endif
 endif
 ifeq ($(FULL_TARGET),i386-linux)
 ifeq ($(FULL_TARGET),i386-linux)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),i386-go32v2)
 ifeq ($(FULL_TARGET),i386-go32v2)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),i386-win32)
 ifeq ($(FULL_TARGET),i386-win32)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),i386-os2)
 ifeq ($(FULL_TARGET),i386-os2)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),i386-freebsd)
 ifeq ($(FULL_TARGET),i386-freebsd)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),i386-beos)
 ifeq ($(FULL_TARGET),i386-beos)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),i386-haiku)
 ifeq ($(FULL_TARGET),i386-haiku)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),i386-netbsd)
 ifeq ($(FULL_TARGET),i386-netbsd)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),i386-solaris)
 ifeq ($(FULL_TARGET),i386-solaris)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),i386-netware)
 ifeq ($(FULL_TARGET),i386-netware)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),i386-openbsd)
 ifeq ($(FULL_TARGET),i386-openbsd)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),i386-wdosx)
 ifeq ($(FULL_TARGET),i386-wdosx)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),i386-darwin)
 ifeq ($(FULL_TARGET),i386-darwin)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),i386-emx)
 ifeq ($(FULL_TARGET),i386-emx)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),i386-watcom)
 ifeq ($(FULL_TARGET),i386-watcom)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),i386-netwlibc)
 ifeq ($(FULL_TARGET),i386-netwlibc)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),i386-wince)
 ifeq ($(FULL_TARGET),i386-wince)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),i386-embedded)
 ifeq ($(FULL_TARGET),i386-embedded)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),i386-symbian)
 ifeq ($(FULL_TARGET),i386-symbian)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),i386-nativent)
 ifeq ($(FULL_TARGET),i386-nativent)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),i386-iphonesim)
 ifeq ($(FULL_TARGET),i386-iphonesim)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),i386-android)
 ifeq ($(FULL_TARGET),i386-android)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),i386-aros)
 ifeq ($(FULL_TARGET),i386-aros)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-linux)
 ifeq ($(FULL_TARGET),m68k-linux)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-netbsd)
 ifeq ($(FULL_TARGET),m68k-netbsd)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-amiga)
 ifeq ($(FULL_TARGET),m68k-amiga)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-atari)
 ifeq ($(FULL_TARGET),m68k-atari)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-palmos)
 ifeq ($(FULL_TARGET),m68k-palmos)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-macosclassic)
 ifeq ($(FULL_TARGET),m68k-macosclassic)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-embedded)
 ifeq ($(FULL_TARGET),m68k-embedded)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-sinclairql)
 ifeq ($(FULL_TARGET),m68k-sinclairql)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-linux)
 ifeq ($(FULL_TARGET),powerpc-linux)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-netbsd)
 ifeq ($(FULL_TARGET),powerpc-netbsd)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-amiga)
 ifeq ($(FULL_TARGET),powerpc-amiga)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-macosclassic)
 ifeq ($(FULL_TARGET),powerpc-macosclassic)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-darwin)
 ifeq ($(FULL_TARGET),powerpc-darwin)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-morphos)
 ifeq ($(FULL_TARGET),powerpc-morphos)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-embedded)
 ifeq ($(FULL_TARGET),powerpc-embedded)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-wii)
 ifeq ($(FULL_TARGET),powerpc-wii)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-aix)
 ifeq ($(FULL_TARGET),powerpc-aix)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),sparc-linux)
 ifeq ($(FULL_TARGET),sparc-linux)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
 ifeq ($(FULL_TARGET),sparc-netbsd)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),sparc-solaris)
 ifeq ($(FULL_TARGET),sparc-solaris)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),sparc-embedded)
 ifeq ($(FULL_TARGET),sparc-embedded)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
 ifeq ($(FULL_TARGET),x86_64-linux)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-freebsd)
 ifeq ($(FULL_TARGET),x86_64-freebsd)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-haiku)
 ifeq ($(FULL_TARGET),x86_64-haiku)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-netbsd)
 ifeq ($(FULL_TARGET),x86_64-netbsd)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-solaris)
 ifeq ($(FULL_TARGET),x86_64-solaris)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-openbsd)
 ifeq ($(FULL_TARGET),x86_64-openbsd)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-darwin)
 ifeq ($(FULL_TARGET),x86_64-darwin)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-win64)
 ifeq ($(FULL_TARGET),x86_64-win64)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-embedded)
 ifeq ($(FULL_TARGET),x86_64-embedded)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-iphonesim)
 ifeq ($(FULL_TARGET),x86_64-iphonesim)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-android)
 ifeq ($(FULL_TARGET),x86_64-android)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-aros)
 ifeq ($(FULL_TARGET),x86_64-aros)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-dragonfly)
 ifeq ($(FULL_TARGET),x86_64-dragonfly)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),arm-linux)
 ifeq ($(FULL_TARGET),arm-linux)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),arm-netbsd)
 ifeq ($(FULL_TARGET),arm-netbsd)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),arm-palmos)
 ifeq ($(FULL_TARGET),arm-palmos)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),arm-wince)
 ifeq ($(FULL_TARGET),arm-wince)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),arm-gba)
 ifeq ($(FULL_TARGET),arm-gba)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),arm-nds)
 ifeq ($(FULL_TARGET),arm-nds)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),arm-embedded)
 ifeq ($(FULL_TARGET),arm-embedded)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),arm-symbian)
 ifeq ($(FULL_TARGET),arm-symbian)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),arm-android)
 ifeq ($(FULL_TARGET),arm-android)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),arm-aros)
 ifeq ($(FULL_TARGET),arm-aros)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),arm-freertos)
 ifeq ($(FULL_TARGET),arm-freertos)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),arm-ios)
 ifeq ($(FULL_TARGET),arm-ios)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
 ifeq ($(FULL_TARGET),powerpc64-linux)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc64-darwin)
 ifeq ($(FULL_TARGET),powerpc64-darwin)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc64-embedded)
 ifeq ($(FULL_TARGET),powerpc64-embedded)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc64-aix)
 ifeq ($(FULL_TARGET),powerpc64-aix)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),avr-embedded)
 ifeq ($(FULL_TARGET),avr-embedded)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),armeb-linux)
 ifeq ($(FULL_TARGET),armeb-linux)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),armeb-embedded)
 ifeq ($(FULL_TARGET),armeb-embedded)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),mips-linux)
 ifeq ($(FULL_TARGET),mips-linux)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),mipsel-linux)
 ifeq ($(FULL_TARGET),mipsel-linux)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),mipsel-embedded)
 ifeq ($(FULL_TARGET),mipsel-embedded)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),mipsel-android)
 ifeq ($(FULL_TARGET),mipsel-android)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),mips64el-linux)
 ifeq ($(FULL_TARGET),mips64el-linux)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),jvm-java)
 ifeq ($(FULL_TARGET),jvm-java)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),jvm-android)
 ifeq ($(FULL_TARGET),jvm-android)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),i8086-embedded)
 ifeq ($(FULL_TARGET),i8086-embedded)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),i8086-msdos)
 ifeq ($(FULL_TARGET),i8086-msdos)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),i8086-win16)
 ifeq ($(FULL_TARGET),i8086-win16)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),aarch64-linux)
 ifeq ($(FULL_TARGET),aarch64-linux)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),aarch64-freebsd)
 ifeq ($(FULL_TARGET),aarch64-freebsd)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),aarch64-darwin)
 ifeq ($(FULL_TARGET),aarch64-darwin)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),aarch64-win64)
 ifeq ($(FULL_TARGET),aarch64-win64)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),aarch64-android)
 ifeq ($(FULL_TARGET),aarch64-android)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),aarch64-ios)
 ifeq ($(FULL_TARGET),aarch64-ios)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),wasm32-embedded)
 ifeq ($(FULL_TARGET),wasm32-embedded)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),wasm32-wasi)
 ifeq ($(FULL_TARGET),wasm32-wasi)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),sparc64-linux)
 ifeq ($(FULL_TARGET),sparc64-linux)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),riscv32-linux)
 ifeq ($(FULL_TARGET),riscv32-linux)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),riscv32-embedded)
 ifeq ($(FULL_TARGET),riscv32-embedded)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),riscv64-linux)
 ifeq ($(FULL_TARGET),riscv64-linux)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),riscv64-embedded)
 ifeq ($(FULL_TARGET),riscv64-embedded)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),xtensa-linux)
 ifeq ($(FULL_TARGET),xtensa-linux)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),xtensa-embedded)
 ifeq ($(FULL_TARGET),xtensa-embedded)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),xtensa-freertos)
 ifeq ($(FULL_TARGET),xtensa-freertos)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),z80-embedded)
 ifeq ($(FULL_TARGET),z80-embedded)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),z80-zxspectrum)
 ifeq ($(FULL_TARGET),z80-zxspectrum)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),z80-msxdos)
 ifeq ($(FULL_TARGET),z80-msxdos)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 ifeq ($(FULL_TARGET),z80-amstradcpc)
 ifeq ($(FULL_TARGET),z80-amstradcpc)
-override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+override TARGET_UNITS+=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts charset cpall character unicodedata unicodenumtable fpwidestring classes uuchar dos extpas
 endif
 endif
 override INSTALL_FPCPACKAGE=y
 override INSTALL_FPCPACKAGE=y
 ifeq ($(FULL_TARGET),i386-linux)
 ifeq ($(FULL_TARGET),i386-linux)
@@ -2646,17 +2646,60 @@ SYSCPUDEPS=$(addprefix $(PROCINC)/,$(CPUINCNAMES))
 SYSDEPS=$(SYSINCDEPS) $(SYSCPUDEPS)
 SYSDEPS=$(SYSINCDEPS) $(SYSCPUDEPS)
 system$(PPUEXT) : system.pp $(SYSDEPS) wasiinc/wasitypes.inc wasiinc/wasiprocs.inc
 system$(PPUEXT) : system.pp $(SYSDEPS) wasiinc/wasitypes.inc wasiinc/wasiprocs.inc
 	$(COMPILER) $(FPC_SYSTEM_OPT) -Us -Sg system.pp -Fiwasiinc
 	$(COMPILER) $(FPC_SYSTEM_OPT) -Us -Sg system.pp -Fiwasiinc
+uuchar$(PPUEXT): $(INC)/uuchar.pp $(SYSTEMUNIT)$(PPUEXT)
+	$(COMPILER) $<
 objpas$(PPUEXT): $(OBJPASDIR)/objpas.pp $(INC)/except.inc system$(PPUEXT)
 objpas$(PPUEXT): $(OBJPASDIR)/objpas.pp $(INC)/except.inc system$(PPUEXT)
 	$(COMPILER) -Fi$(OBJPASDIR) $(OBJPASDIR)/objpas.pp
 	$(COMPILER) -Fi$(OBJPASDIR) $(OBJPASDIR)/objpas.pp
 strings$(PPUEXT) : $(INC)/strings.pp $(INC)/stringsi.inc\
 strings$(PPUEXT) : $(INC)/strings.pp $(INC)/stringsi.inc\
 		   $(PROCINC)/strings.inc $(PROCINC)/stringss.inc\
 		   $(PROCINC)/strings.inc $(PROCINC)/stringss.inc\
 		   $(SYSTEMUNIT)$(PPUEXT)
 		   $(SYSTEMUNIT)$(PPUEXT)
 	$(COMPILER) $<
 	$(COMPILER) $<
+iso7185$(PPUEXT) : $(INC)/iso7185.pp $(SYSTEMUNIT)$(PPUEXT)
+	$(COMPILER) $<
+extpas$(PPUEXT) : $(INC)/extpas.pp dos$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
+	$(COMPILER) $<
 si_prc$(PPUEXT) : si_prc.pp $(SYSTEMUNIT)$(PPUEXT)
 si_prc$(PPUEXT) : si_prc.pp $(SYSTEMUNIT)$(PPUEXT)
 	$(COMPILER) $<
 	$(COMPILER) $<
 wasiapi$(PPUEXT) : wasiapi.pp wasiinc/wasitypes.inc wasiinc/wasiprocs.inc $(SYSTEMUNIT)$(PPUEXT)
 wasiapi$(PPUEXT) : wasiapi.pp wasiinc/wasitypes.inc wasiinc/wasiprocs.inc $(SYSTEMUNIT)$(PPUEXT)
 	$(COMPILER) $< -Fiwasiinc
 	$(COMPILER) $< -Fiwasiinc
 ctypes$(PPUEXT) :  $(INC)/ctypes.pp $(SYSTEMUNIT)$(PPUEXT)
 ctypes$(PPUEXT) :  $(INC)/ctypes.pp $(SYSTEMUNIT)$(PPUEXT)
 	$(COMPILER) $<
 	$(COMPILER) $<
+dos$(PPUEXT) : dos.pp $(INC)/filerec.inc $(INC)/textrec.inc system$(PPUEXT)
+	$(COMPILER) $<
+sysutils$(PPUEXT) : sysutils.pp $(wildcard $(OBJPASDIR)/sysutils/*.inc) \
+		    objpas$(PPUEXT) wasiapi$(PPUEXT) sysconst$(PPUEXT) system$(PPUEXT)
+	$(COMPILER) $< -Fi$(OBJPASDIR)/sysutils
+classes$(PPUEXT) : classes.pp $(wildcard $(OBJPASDIR)/classes/*.inc) \
+		   sysutils$(PPUEXT) typinfo$(PPUEXT) rtlconsts$(PPUEXT) types$(PPUEXT) fgl$(PPUEXT) \
+		   sortbase$(PPUEXT)
+	$(COMPILER) $< -Fi$(OBJPASDIR)/classes
+fgl$(PPUEXT) : $(OBJPASDIR)/fgl.pp objpas$(PPUEXT) types$(PPUEXT) system$(PPUEXT) sysutils$(PPUEXT) sortbase$(PPUEXT)
+	$(COMPILER) $<
+math$(PPUEXT): $(OBJPASDIR)/math.pp objpas$(PPUEXT) sysutils$(PPUEXT)
+	$(COMPILER) $<
+typinfo$(PPUEXT): $(OBJPASDIR)/typinfo.pp objpas$(PPUEXT) sysutils$(PPUEXT) rtlconsts$(PPUEXT)
+	$(COMPILER) $< -Sg
+types$(PPUEXT) : $(OBJPASDIR)/types.pp math$(PPUEXT) objpas$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
+	$(COMPILER) $<
+rtlconsts$(PPUEXT) : $(OBJPASDIR)/rtlconsts.pp objpas$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
+	$(COMPILER) $<
 sysconst$(PPUEXT) : $(OBJPASDIR)/sysconst.pp objpas$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
 sysconst$(PPUEXT) : $(OBJPASDIR)/sysconst.pp objpas$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
 	$(COMPILER) $<
 	$(COMPILER) $<
+macpas$(PPUEXT) : $(INC)/macpas.pp objpas$(PPUEXT) math$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
+	$(COMPILER) $< $(REDIR)
+getopts$(PPUEXT) : $(INC)/getopts.pp $(SYSTEMUNIT)$(PPUEXT)
+	$(COMPILER) $<
+charset$(PPUEXT) : $(INC)/charset.pp $(SYSTEMUNIT)$(PPUEXT) objpas$(PPUEXT)
+	$(COMPILER) $<
+cpall$(PPUEXT): $(RTL)/charmaps/cpall.pas $(SYSTEMUNIT)$(PPUEXT) charset$(PPUEXT)
+	$(COMPILER) $< -Fu$(INC) -Fi$(RTL)/charmaps
+fpwidestring$(PPUEXT): $(OBJPASDIR)/fpwidestring.pp unicodedata$(PPUEXT) charset$(PPUEXT) objpas$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
+	$(COMPILER) $<
+character$(PPUEXT): $(OBJPASDIR)/character.pas sysutils$(PPUEXT) objpas$(PPUEXT) rtlconsts$(PPUEXT) unicodedata$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
+	$(COMPILER) $<
+unicodenumtable$(PPUEXT) : $(OBJPASDIR)/unicodenumtable.pas $(SYSTEMUNIT)$(PPUEXT)
+	$(COMPILER) $< -Fi$(OBJPASDIR)
+unicodedata$(PPUEXT) : $(OBJPASDIR)/unicodedata.pas unicodenumtable$(PPUEXT) objpas$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
+	$(COMPILER) $< -Fi$(OBJPASDIR)
+sortbase$(PPUEXT) : $(INC)/sortbase.pp objpas$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
+	$(COMPILER) $<

+ 76 - 1
rtl/wasi/Makefile.fpc

@@ -5,7 +5,10 @@
 main=rtl
 main=rtl
 [target]
 [target]
 loaders=
 loaders=
-units=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst
+units=system $(SYSINIT_UNITS) objpas wasiapi ctypes strings sysconst sysutils \
+      sortbase math rtlconsts types typinfo fgl macpas iso7185 getopts \
+      charset cpall character unicodedata unicodenumtable fpwidestring \
+      classes uuchar dos extpas
 
 
 [require]
 [require]
 nortl=y
 nortl=y
@@ -57,6 +60,9 @@ SYSDEPS=$(SYSINCDEPS) $(SYSCPUDEPS)
 system$(PPUEXT) : system.pp $(SYSDEPS) wasiinc/wasitypes.inc wasiinc/wasiprocs.inc
 system$(PPUEXT) : system.pp $(SYSDEPS) wasiinc/wasitypes.inc wasiinc/wasiprocs.inc
         $(COMPILER) $(FPC_SYSTEM_OPT) -Us -Sg system.pp -Fiwasiinc
         $(COMPILER) $(FPC_SYSTEM_OPT) -Us -Sg system.pp -Fiwasiinc
 
 
+uuchar$(PPUEXT): $(INC)/uuchar.pp $(SYSTEMUNIT)$(PPUEXT)
+        $(COMPILER) $<
+
 objpas$(PPUEXT): $(OBJPASDIR)/objpas.pp $(INC)/except.inc system$(PPUEXT)
 objpas$(PPUEXT): $(OBJPASDIR)/objpas.pp $(INC)/except.inc system$(PPUEXT)
         $(COMPILER) -Fi$(OBJPASDIR) $(OBJPASDIR)/objpas.pp
         $(COMPILER) -Fi$(OBJPASDIR) $(OBJPASDIR)/objpas.pp
 
 
@@ -65,6 +71,12 @@ strings$(PPUEXT) : $(INC)/strings.pp $(INC)/stringsi.inc\
                    $(SYSTEMUNIT)$(PPUEXT)
                    $(SYSTEMUNIT)$(PPUEXT)
         $(COMPILER) $<
         $(COMPILER) $<
 
 
+iso7185$(PPUEXT) : $(INC)/iso7185.pp $(SYSTEMUNIT)$(PPUEXT)
+        $(COMPILER) $<
+
+extpas$(PPUEXT) : $(INC)/extpas.pp dos$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
+        $(COMPILER) $<
+
 #
 #
 # $(SYSINIT_UNITS) Units
 # $(SYSINIT_UNITS) Units
 #
 #
@@ -81,8 +93,71 @@ wasiapi$(PPUEXT) : wasiapi.pp wasiinc/wasitypes.inc wasiinc/wasiprocs.inc $(SYST
 ctypes$(PPUEXT) :  $(INC)/ctypes.pp $(SYSTEMUNIT)$(PPUEXT)
 ctypes$(PPUEXT) :  $(INC)/ctypes.pp $(SYSTEMUNIT)$(PPUEXT)
         $(COMPILER) $<
         $(COMPILER) $<
 
 
+#
+# TP7 Compatible RTL Units
+#
+dos$(PPUEXT) : dos.pp $(INC)/filerec.inc $(INC)/textrec.inc system$(PPUEXT)
+        $(COMPILER) $<
+
 #
 #
 # Delphi Compatible Units
 # Delphi Compatible Units
 #
 #
+sysutils$(PPUEXT) : sysutils.pp $(wildcard $(OBJPASDIR)/sysutils/*.inc) \
+                    objpas$(PPUEXT) wasiapi$(PPUEXT) sysconst$(PPUEXT) system$(PPUEXT)
+        $(COMPILER) $< -Fi$(OBJPASDIR)/sysutils
+
+classes$(PPUEXT) : classes.pp $(wildcard $(OBJPASDIR)/classes/*.inc) \
+                   sysutils$(PPUEXT) typinfo$(PPUEXT) rtlconsts$(PPUEXT) types$(PPUEXT) fgl$(PPUEXT) \
+                   sortbase$(PPUEXT)
+        $(COMPILER) $< -Fi$(OBJPASDIR)/classes
+
+fgl$(PPUEXT) : $(OBJPASDIR)/fgl.pp objpas$(PPUEXT) types$(PPUEXT) system$(PPUEXT) sysutils$(PPUEXT) sortbase$(PPUEXT)
+        $(COMPILER) $<
+
+math$(PPUEXT): $(OBJPASDIR)/math.pp objpas$(PPUEXT) sysutils$(PPUEXT)
+        $(COMPILER) $<
+
+typinfo$(PPUEXT): $(OBJPASDIR)/typinfo.pp objpas$(PPUEXT) sysutils$(PPUEXT) rtlconsts$(PPUEXT)
+        $(COMPILER) $< -Sg
+
+types$(PPUEXT) : $(OBJPASDIR)/types.pp math$(PPUEXT) objpas$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
+        $(COMPILER) $<
+
+rtlconsts$(PPUEXT) : $(OBJPASDIR)/rtlconsts.pp objpas$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
+        $(COMPILER) $<
+
 sysconst$(PPUEXT) : $(OBJPASDIR)/sysconst.pp objpas$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
 sysconst$(PPUEXT) : $(OBJPASDIR)/sysconst.pp objpas$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
         $(COMPILER) $<
         $(COMPILER) $<
+
+#
+# Mac Pascal Model
+#
+macpas$(PPUEXT) : $(INC)/macpas.pp objpas$(PPUEXT) math$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
+        $(COMPILER) $< $(REDIR)
+
+#
+# Other system-independent RTL Units
+#
+getopts$(PPUEXT) : $(INC)/getopts.pp $(SYSTEMUNIT)$(PPUEXT)
+        $(COMPILER) $<
+
+charset$(PPUEXT) : $(INC)/charset.pp $(SYSTEMUNIT)$(PPUEXT) objpas$(PPUEXT)
+        $(COMPILER) $<
+
+cpall$(PPUEXT): $(RTL)/charmaps/cpall.pas $(SYSTEMUNIT)$(PPUEXT) charset$(PPUEXT)
+        $(COMPILER) $< -Fu$(INC) -Fi$(RTL)/charmaps
+
+fpwidestring$(PPUEXT): $(OBJPASDIR)/fpwidestring.pp unicodedata$(PPUEXT) charset$(PPUEXT) objpas$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
+        $(COMPILER) $<
+
+character$(PPUEXT): $(OBJPASDIR)/character.pas sysutils$(PPUEXT) objpas$(PPUEXT) rtlconsts$(PPUEXT) unicodedata$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
+        $(COMPILER) $<
+
+unicodenumtable$(PPUEXT) : $(OBJPASDIR)/unicodenumtable.pas $(SYSTEMUNIT)$(PPUEXT)
+        $(COMPILER) $< -Fi$(OBJPASDIR)
+
+unicodedata$(PPUEXT) : $(OBJPASDIR)/unicodedata.pas unicodenumtable$(PPUEXT) objpas$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
+        $(COMPILER) $< -Fi$(OBJPASDIR)
+
+sortbase$(PPUEXT) : $(INC)/sortbase.pp objpas$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
+        $(COMPILER) $<

+ 48 - 0
rtl/wasi/classes.pp

@@ -0,0 +1,48 @@
+{
+    This file is part of the Free Component Library (FCL)
+    Copyright (c) 1999-2000 by Michael Van Canneyt and Florian Klaempfl
+
+    Classes unit for The WebAssembly System Interface (WASI)
+
+    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.
+
+ **********************************************************************}
+
+{$mode objfpc}
+
+{ determine the type of the resource/form file }
+{$define Win16Res}
+
+unit Classes;
+
+interface
+
+uses
+  typinfo,
+  rtlconsts,
+  types,
+  sortbase,
+{$ifdef FPC_TESTGENERICS}
+  fgl,
+{$endif}
+  sysutils;
+
+{$i classesh.inc}
+
+implementation
+
+{ OS - independent class implementations are in /inc directory. }
+{$i classes.inc}
+
+initialization
+  CommonInit;
+
+finalization
+  CommonCleanup;
+
+end.

+ 749 - 0
rtl/wasi/dos.pp

@@ -0,0 +1,749 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 1999-2000 by Michael Van Canneyt and Peter Vreman,
+    members of the Free Pascal development team
+
+    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 Dos;
+Interface
+
+Const
+  FileNameLen = 255;
+
+Type
+  SearchRec =
+{$ifndef FPC_REQUIRES_PROPER_ALIGNMENT}
+    packed
+{$endif FPC_REQUIRES_PROPER_ALIGNMENT}
+    Record
+  {Fill : array[1..21] of byte;  Fill replaced with below}
+//    SearchPos  : TOff;        {directory position}
+    SearchNum  : LongInt;     {to track which search this is}
+    DirPtr     : Pointer;     {directory pointer for reading directory}
+    SearchType : Byte;        {0=normal, 1=open will close, 2=only 1 file}
+    SearchAttr : Byte;        {attribute we are searching for}
+    Mode       : Word;
+    Fill       : Array[1..1] of Byte; {future use}
+  {End of fill}
+    Attr       : Byte;        {attribute of found file}
+    Time       : LongInt;     {last modify date of found file}
+    Size       : LongInt;     {file size of found file}
+    Reserved   : Word;        {future use}
+    Name       : String[FileNameLen]; {name of found file}
+    SearchSpec : String[FileNameLen]; {search pattern}
+    NamePos    : Word;        {end of path, start of name position}
+  End;
+
+{$DEFINE HAS_FILENAMELEN}
+{$i dosh.inc}
+
+{Extra Utils}
+//function weekday(y,m,d : longint) : longint; platform;
+//Procedure UnixDateToDt(SecsPast: LongInt; Var Dt: DateTime); platform;
+//Function  DTToUnixDate(DT: DateTime): LongInt; platform;
+
+{Disk}
+//Function AddDisk(const path:string) : byte; platform;
+
+Implementation
+
+//Uses
+//  UnixUtil,
+//  Strings,
+//  Unix,
+//  {$ifdef FPC_USE_LIBC}initc{$ELSE}Syscall{$ENDIF};
+
+{$DEFINE HAS_GETMSCOUNT}
+
+{$DEFINE FPC_FEXPAND_TILDE} { Tilde is expanded to home }
+{$DEFINE FPC_FEXPAND_GETENVPCHAR} { GetEnv result is a PChar }
+
+{$I dos.inc}
+
+
+{******************************************************************************
+                           --- Link C Lib if set ---
+******************************************************************************}
+
+{type
+  RtlInfoType = Record
+    FMode,
+    FInode,
+    FUid,
+    FGid,
+    FSize,
+    FMTime : LongInt;
+  End;}
+
+
+{******************************************************************************
+                        --- Info / Date / Time ---
+******************************************************************************}
+
+Function DosVersion:Word;
+Begin
+End;
+
+(*function WeekDay (y,m,d:longint):longint;
+{
+  Calculates th day of the week. returns -1 on error
+}
+var
+  u,v : longint;
+begin
+  if (m<1) or (m>12) or (y<1600) or (y>4000) or
+     (d<1) or (d>30+((m+ord(m>7)) and 1)-ord(m=2)) or
+     ((m*d=58) and (((y mod 4>0) or (y mod 100=0)) and (y mod 400>0))) then
+   WeekDay:=-1
+  else
+   begin
+     u:=m;
+     v:=y;
+     if m<3 then
+      begin
+        inc(u,12);
+        dec(v);
+      end;
+     WeekDay:=(d+2*u+((3*(u+1)) div 5)+v+(v div 4)-(v div 100)+(v div 400)+1) mod 7;
+   end;
+end;*)
+
+
+Procedure GetDate(Var Year, Month, MDay, WDay: Word);
+begin
+end;
+
+
+procedure  SetTime(Hour,Minute,Second,sec100:word);
+begin
+end;
+
+procedure SetDate(Year,Month,Day:Word);
+begin
+end;
+
+
+Function SetDateTime(Year,Month,Day,hour,minute,second:Word) : Boolean;
+begin
+end;
+
+
+Procedure GetTime(Var Hour, Minute, Second, Sec100: Word);
+begin
+end;
+
+
+Procedure UnixDateToDt(SecsPast: LongInt; Var Dt: DateTime);
+Begin
+End;
+
+
+Function DTToUnixDate(DT: DateTime): LongInt;
+Begin
+End;
+
+
+function GetMsCount: int64;
+begin
+end;
+
+
+{******************************************************************************
+                               --- Exec ---
+******************************************************************************}
+
+Procedure Exec (Const Path: PathStr; Const ComLine: ComStr);
+Begin
+End;
+
+
+{******************************************************************************
+                               --- Disk ---
+******************************************************************************}
+
+{
+  The Diskfree and Disksize functions need a file on the specified drive, since this
+  is required for the fpstatfs system call.
+  These filenames are set in drivestr[0..26], and have been preset to :
+   0 - '.'      (default drive - hence current dir is ok.)
+   1 - '/fd0/.'  (floppy drive 1 - should be adapted to local system )
+   2 - '/fd1/.'  (floppy drive 2 - should be adapted to local system )
+   3 - '/'       (C: equivalent of dos is the root partition)
+   4..26          (can be set by you're own applications)
+  ! Use AddDisk() to Add new drives !
+  They both return -1 when a failure occurs.
+}
+Const
+  FixDriveStr : array[0..3] of pchar=(
+    '.',
+    '/fd0/.',
+    '/fd1/.',
+    '/.'
+    );
+const
+  Drives   : byte = 4;
+var
+  DriveStr : array[4..26] of pchar;
+
+Function AddDisk(const path:string) : byte;
+begin
+{  if not (DriveStr[Drives]=nil) then
+   FreeMem(DriveStr[Drives]);
+  GetMem(DriveStr[Drives],length(Path)+1);
+  StrPCopy(DriveStr[Drives],path);
+  AddDisk:=Drives;
+  inc(Drives);
+  if Drives>26 then
+    Drives:=4;}
+end;
+
+
+
+Function DiskFree(Drive: Byte): int64;
+{var
+  fs : tstatfs;}
+Begin
+{  if ((Drive<4) and (not (fixdrivestr[Drive]=nil)) and (fpStatFS(fixdrivestr[drive],@fs)<>-1)) or
+     ((not (drivestr[Drive]=nil)) and (fpStatFS(drivestr[drive],@fs)<>-1)) then
+   Diskfree:=int64(fs.bavail)*int64(fs.bsize)
+  else
+   Diskfree:=-1;}
+End;
+
+
+
+Function DiskSize(Drive: Byte): int64;
+{var
+  fs : tstatfs;}
+Begin
+{  if ((Drive<4) and (not (fixdrivestr[Drive]=nil)) and (fpStatFS(fixdrivestr[drive],@fs)<>-1)) or
+     ((not (drivestr[Drive]=nil)) and (fpStatFS(drivestr[drive],@fs)<>-1)) then
+   DiskSize:=int64(fs.blocks)*int64(fs.bsize)
+  else
+   DiskSize:=-1;}
+End;
+
+
+
+Procedure FreeDriveStr;
+{var
+  i: longint;}
+begin
+{  for i:=low(drivestr) to high(drivestr) do
+    if assigned(drivestr[i]) then
+      begin
+        freemem(drivestr[i]);
+        drivestr[i]:=nil;
+      end;}
+end;
+
+{******************************************************************************
+                       --- Findfirst FindNext ---
+******************************************************************************}
+
+
+(*Function FNMatch(const Pattern,Name:string):Boolean;
+Var
+  LenPat,LenName : longint;
+
+  Function DoFNMatch(i,j:longint):Boolean;
+  Var
+    Found : boolean;
+  Begin
+  Found:=true;
+  While Found and (i<=LenPat) Do
+   Begin
+     Case Pattern[i] of
+      '?' : Found:=(j<=LenName);
+      '*' : Begin
+            {find the next character in pattern, different of ? and *}
+              while Found do
+                begin
+                inc(i);
+                if i>LenPat then Break;
+                case Pattern[i] of
+                  '*' : ;
+                  '?' : begin
+                          if j>LenName then begin DoFNMatch:=false; Exit; end;
+                          inc(j);
+                        end;
+                else
+                  Found:=false;
+                end;
+               end;
+              Assert((i>LenPat) or ( (Pattern[i]<>'*') and (Pattern[i]<>'?') ));
+            {Now, find in name the character which i points to, if the * or ?
+             wasn't the last character in the pattern, else, use up all the
+             chars in name}
+              Found:=false;
+              if (i<=LenPat) then
+              begin
+                repeat
+                  {find a letter (not only first !) which maches pattern[i]}
+                  while (j<=LenName) and (name[j]<>pattern[i]) do
+                    inc (j);
+                  if (j<LenName) then
+                  begin
+                    if DoFnMatch(i+1,j+1) then
+                    begin
+                      i:=LenPat;
+                      j:=LenName;{we can stop}
+                      Found:=true;
+                      Break;
+                    end else
+                      inc(j);{We didn't find one, need to look further}
+                  end else
+                  if j=LenName then
+                  begin
+                    Found:=true;
+                    Break;
+                  end;
+                  { This 'until' condition must be j>LenName, not j>=LenName.
+                    That's because when we 'need to look further' and
+                    j = LenName then loop must not terminate. }
+                until (j>LenName);
+              end else
+              begin
+                j:=LenName;{we can stop}
+                Found:=true;
+              end;
+            end;
+     else {not a wildcard character in pattern}
+       Found:=(j<=LenName) and (pattern[i]=name[j]);
+     end;
+     inc(i);
+     inc(j);
+   end;
+  DoFnMatch:=Found and (j>LenName);
+  end;
+
+Begin {start FNMatch}
+  LenPat:=Length(Pattern);
+  LenName:=Length(Name);
+  FNMatch:=DoFNMatch(1,1);
+End;*)
+
+
+Const
+  RtlFindSize = 15;
+Type
+  RtlFindRecType = Record
+    DirPtr   : Pointer;
+    SearchNum,
+    LastUsed : LongInt;
+  End;
+Var
+  RtlFindRecs   : Array[1..RtlFindSize] of RtlFindRecType;
+  CurrSearchNum : LongInt;
+
+
+Procedure FindClose(Var f: SearchRec);
+{
+  Closes dirptr if it is open
+}
+{Var
+  i : longint;}
+Begin
+{  if f.SearchType=0 then
+   begin
+     i:=1;
+     repeat
+       if (RtlFindRecs[i].SearchNum=f.SearchNum) then
+        break;
+       inc(i);
+     until (i>RtlFindSize);
+     If i<=RtlFindSize Then
+      Begin
+        RtlFindRecs[i].SearchNum:=0;
+        if f.dirptr<>nil then
+         fpclosedir(pdir(f.dirptr)^);
+      End;
+   end;
+  f.dirptr:=nil;}
+End;
+
+
+Function FindGetFileInfo(const s:string;var f:SearchRec):boolean;
+{var
+  DT   : DateTime;
+  Info : RtlInfoType;
+  st   : baseunix.stat;}
+begin
+{  FindGetFileInfo:=false;
+  if not fpstat(s,st)>=0 then
+   exit;
+  info.FSize:=st.st_Size;
+  info.FMTime:=st.st_mtime;
+  if (st.st_mode and STAT_IFMT)=STAT_IFDIR then
+   info.fmode:=$10
+  else
+   info.fmode:=$0;
+  if (st.st_mode and STAT_IWUSR)=0 then
+   info.fmode:=info.fmode or 1;
+  if s[f.NamePos+1]='.' then
+   info.fmode:=info.fmode or $2;
+
+  If ((Info.FMode and Not(f.searchattr))=0) Then
+   Begin
+     f.Name:=Copy(s,f.NamePos+1,255);
+     f.Attr:=Info.FMode;
+     f.Size:=Info.FSize;
+     f.mode:=st.st_mode;
+     UnixDateToDT(Info.FMTime, DT);
+     PackTime(DT,f.Time);
+     FindGetFileInfo:=true;
+   End;}
+end;
+
+
+Function  FindLastUsed: Longint;
+{
+  Find unused or least recently used dirpointer slot in findrecs array
+}
+{Var
+  BestMatch,i : Longint;
+  Found       : Boolean;}
+Begin
+{  BestMatch:=1;
+  i:=1;
+  Found:=False;
+  While (i <= RtlFindSize) And (Not Found) Do
+   Begin
+     If (RtlFindRecs[i].SearchNum = 0) Then
+      Begin
+        BestMatch := i;
+        Found := True;
+      End
+     Else
+      Begin
+        If RtlFindRecs[i].LastUsed > RtlFindRecs[BestMatch].LastUsed Then
+         BestMatch := i;
+      End;
+     Inc(i);
+   End;
+  FindLastUsed := BestMatch;}
+End;
+
+
+
+Procedure FindNext(Var f: SearchRec);
+{
+  re-opens dir if not already in array and calls FindWorkProc
+}
+{Var
+
+  DirName  : Array[0..256] of Char;
+  i,
+  ArrayPos : Longint;
+  FName,
+  SName    : string;
+  Found,
+  Finished : boolean;
+  p        : pdirent;}
+Begin
+(*  If f.SearchType=0 Then
+   Begin
+     ArrayPos:=0;
+     For i:=1 to RtlFindSize Do
+      Begin
+        If RtlFindRecs[i].SearchNum = f.SearchNum Then
+         ArrayPos:=i;
+        Inc(RtlFindRecs[i].LastUsed);
+      End;
+     If ArrayPos=0 Then
+      Begin
+        If f.NamePos = 0 Then
+         Begin
+           DirName[0] := '.';
+           DirName[1] := '/';
+           DirName[2] := #0;
+         End
+        Else
+         Begin
+           Move(f.SearchSpec[1], DirName[0], f.NamePos);
+           DirName[f.NamePos] := #0;
+         End;
+        f.DirPtr := fpopendir(@DirName[0]);
+        If f.DirPtr <> nil Then
+         begin
+           ArrayPos:=FindLastUsed;
+           If RtlFindRecs[ArrayPos].SearchNum > 0 Then
+            FpCloseDir((pdir(rtlfindrecs[arraypos].dirptr)^));
+           RtlFindRecs[ArrayPos].SearchNum := f.SearchNum;
+           RtlFindRecs[ArrayPos].DirPtr := f.DirPtr;
+           if f.searchpos>0 then
+            seekdir(pdir(f.dirptr), f.searchpos);
+         end;
+      End;
+     if ArrayPos>0 then
+       RtlFindRecs[ArrayPos].LastUsed:=0;
+   end;
+{Main loop}
+  SName:=Copy(f.SearchSpec,f.NamePos+1,255);
+  Found:=False;
+  Finished:=(f.dirptr=nil);
+  While Not Finished Do
+   Begin
+     p:=fpreaddir(pdir(f.dirptr)^);
+     if p=nil then
+      FName:=''
+     else
+      FName:=Strpas(@p^.d_name[0]);
+     If FName='' Then
+      Finished:=True
+     Else
+      Begin
+        If FNMatch(SName,FName) Then
+         Begin
+           Found:=FindGetFileInfo(Copy(f.SearchSpec,1,f.NamePos)+FName,f);
+           if Found then
+            Finished:=true;
+         End;
+      End;
+   End;
+{Shutdown}
+  If Found Then
+   Begin
+     f.searchpos:=telldir(pdir(f.dirptr));
+     DosError:=0;
+   End
+  Else
+   Begin
+     FindClose(f);
+     DosError:=18;
+   End;*)
+End;
+
+
+Procedure FindFirst(Const Path: PathStr; Attr: Word; Var f: SearchRec);
+{
+  opens dir and calls FindWorkProc
+}
+Begin
+(*  fillchar(f,sizeof(f),0);
+  if Path='' then
+   begin
+     DosError:=3;
+     exit;
+   end;
+{Create Info}
+  f.SearchSpec := Path;
+  {We always also search for readonly and archive, regardless of Attr:}
+  f.SearchAttr := Attr or archive or readonly;
+  f.SearchPos  := 0;
+  f.NamePos := Length(f.SearchSpec);
+  while (f.NamePos>0) and (f.SearchSpec[f.NamePos]<>'/') do
+   dec(f.NamePos);
+{Wildcards?}
+  if (Pos('?',Path)=0)  and (Pos('*',Path)=0) then
+   begin
+     if FindGetFileInfo(Path,f) then
+      DosError:=0
+     else
+      begin
+        { According to tdos2 test it should return 18
+        if ErrNo=Sys_ENOENT then
+         DosError:=3
+        else }
+         DosError:=18;
+      end;
+     f.DirPtr:=nil;
+     f.SearchType:=1;
+     f.searchnum:=-1;
+   end
+  else
+{Find Entry}
+   begin
+     Inc(CurrSearchNum);
+     f.SearchNum:=CurrSearchNum;
+     f.SearchType:=0;
+     FindNext(f);
+   end;*)
+End;
+
+
+{******************************************************************************
+                               --- File ---
+******************************************************************************}
+
+Function FSearch(path : pathstr;dirlist : string) : pathstr;
+{Var
+  info : BaseUnix.stat;}
+Begin
+{  if (length(Path)>0) and (path[1]='/') and (fpStat(path,info)>=0) and (not fpS_ISDIR(Info.st_Mode)) then
+    FSearch:=path
+  else
+    FSearch:=Unix.FSearch(path,dirlist);}
+End;
+
+Procedure GetFAttr(var f; var attr : word);
+(*Var
+  info    : baseunix.stat;
+  LinAttr : longint;
+  p       : pchar;
+{$ifndef FPC_ANSI_TEXTFILEREC}
+  r       : RawByteString;
+{$endif not FPC_ANSI_TEXTFILEREC}*)
+Begin
+(*  DosError:=0;
+{$ifdef FPC_ANSI_TEXTFILEREC}
+  { encoding is already correct }
+  p:=@textrec(f).name;
+{$else}
+  r:=ToSingleByteFileSystemEncodedFileName(textrec(f).name);
+  p:=pchar(r);
+{$endif}
+  { use the pchar rather than the rawbytestring version so that we don't check
+    a second time whether the string needs to be converted to the right code
+    page
+  }
+  if FPStat(p,info)<0 then
+   begin
+     Attr:=0;
+     DosError:=3;
+     exit;
+   end
+  else
+   LinAttr:=Info.st_Mode;
+  if fpS_ISDIR(LinAttr) then
+   Attr:=$10
+  else
+   Attr:=$0;
+  if fpAccess(p,W_OK)<0 then
+   Attr:=Attr or $1;
+  if filerec(f).name[0]='.' then
+   Attr:=Attr or $2;*)
+end;
+
+Procedure getftime (var f; var time : longint);
+{Var
+  Info: baseunix.stat;
+  DT: DateTime;}
+Begin
+{  doserror:=0;
+  if fpfstat(filerec(f).handle,info)<0 then
+   begin
+     Time:=0;
+     doserror:=6;
+     exit
+   end
+  else
+   UnixDateToDT(Info.st_mTime,DT);
+  PackTime(DT,Time);}
+End;
+
+Procedure setftime(var f; time : longint);
+(*
+Var
+  utim: utimbuf;
+  DT: DateTime;
+  p : pchar;
+{$ifndef FPC_ANSI_TEXTFILEREC}
+  r : Rawbytestring;
+{$endif not FPC_ANSI_TEXTFILEREC}*)
+Begin
+(*  doserror:=0;
+  with utim do
+    begin
+      actime:=fptime;
+      UnPackTime(Time,DT);
+      modtime:=DTToUnixDate(DT);
+    end;
+{$ifdef FPC_ANSI_TEXTFILEREC}
+  { encoding is already correct }
+  p:=@textrec(f).name;
+{$else}
+  r:=ToSingleByteFileSystemEncodedFileName(textrec(f).name);
+  p:=pchar(r);
+{$endif}
+  { use the pchar rather than the rawbytestring version so that we don't check
+    a second time whether the string needs to be converted to the right code
+    page
+  }
+  if fputime(p,@utim)<0 then
+    begin
+      Time:=0;
+      doserror:=3;
+    end;*)
+End;
+
+{******************************************************************************
+                             --- Environment ---
+******************************************************************************}
+
+Function EnvCount: Longint;
+{var
+  envcnt : longint;
+  p      : ppchar;}
+Begin
+(*  envcnt:=0;
+  p:=envp;      {defined in syslinux}
+  while (p^<>nil) do
+   begin
+     inc(envcnt);
+     inc(p);
+   end;
+  EnvCount := envcnt*)
+End;
+
+
+Function EnvStr (Index: longint): String;
+{Var
+  i : longint;
+  p : ppchar;}
+Begin
+(*  if Index <= 0 then
+    envstr:=''
+  else
+    begin
+      p:=envp;      {defined in syslinux}
+      i:=1;
+      while (i<Index) and (p^<>nil) do
+        begin
+          inc(i);
+          inc(p);
+        end;
+      if p=nil then
+        envstr:=''
+      else
+        envstr:=strpas(p^)
+    end;*)
+end;
+
+
+Function GetEnv(EnvVar: String): String;
+{var
+  p     : pchar;}
+Begin
+{  p:=BaseUnix.fpGetEnv(EnvVar);
+  if p=nil then
+   GetEnv:=''
+  else
+   GetEnv:=StrPas(p);}
+End;
+
+
+Procedure setfattr (var f;attr : word);
+Begin
+(*  {! No Unix equivalent !}
+  { Fail for setting VolumeId }
+  if (attr and VolumeID)<>0 then
+   doserror:=5;*)
+End;
+
+
+
+{******************************************************************************
+                            --- Initialization ---
+******************************************************************************}
+
+//Finalization
+//  FreeDriveStr;
+End.

+ 80 - 0
rtl/wasi/tthread.inc

@@ -0,0 +1,80 @@
+{
+    This file is part of the Free Component Library (FCL)
+    Copyright (c) 1999-2000 by the Free Pascal development team
+
+    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.
+
+ **********************************************************************}
+{****************************************************************************}
+{*                             TThread                                      *}
+{****************************************************************************}
+
+
+procedure TThread.CallOnTerminate;
+
+begin
+end;
+
+
+function TThread.GetPriority: TThreadPriority;
+
+begin
+  GetPriority:=tpNormal;
+end;
+
+
+procedure TThread.SetPriority(Value: TThreadPriority);
+
+begin
+end;
+
+
+procedure TThread.SetSuspended(Value: Boolean);
+
+begin
+end;
+
+
+procedure TThread.DoTerminate;
+
+begin
+end;
+
+
+procedure TThread.SysCreate(CreateSuspended: Boolean; const StackSize: SizeUInt);
+
+begin
+ {IsMultiThread := TRUE; }
+end;
+
+
+procedure TThread.SysDestroy;
+
+begin
+end;
+
+
+procedure TThread.Resume;
+
+begin
+end;
+
+
+procedure TThread.Suspend;
+
+begin
+end;
+
+
+function TThread.WaitFor: Integer;
+
+begin
+  WaitFor:=0;
+end;
+
+

+ 47 - 0
rtl/wasm32/mathu.inc

@@ -0,0 +1,47 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 1999-2003 by Florian Klaempfl
+    member of the Free Pascal development team
+
+    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.
+
+**********************************************************************}
+
+function GetRoundMode: TFPURoundingMode;
+begin
+  GetRoundMode:=rmNearest;
+end;
+
+function SetRoundMode(const RoundMode: TFPURoundingMode): TFPURoundingMode;
+begin
+  SetRoundMode:=rmNearest;
+end;
+
+function GetPrecisionMode: TFPUPrecisionMode;
+begin
+  GetPrecisionMode:=pmDouble;
+end;
+
+function SetPrecisionMode(const Precision: TFPUPrecisionMode): TFPUPrecisionMode;
+begin
+  SetPrecisionMode:=pmDouble;
+end;
+
+function GetExceptionMask: TFPUExceptionMask;
+begin
+  GetExceptionMask:=[exDenormalized,exOverflow,exPrecision];
+end;
+
+function SetExceptionMask(const Mask: TFPUExceptionMask): TFPUExceptionMask;
+begin
+  SetExceptionMask:=[exDenormalized,exOverflow,exPrecision];
+end;
+
+procedure ClearExceptions(RaisePending: Boolean);
+begin
+end;