Explorar o código

* synchronized with trunk

git-svn-id: branches/wasm@48949 -
nickysn %!s(int64=4) %!d(string=hai) anos
pai
achega
e42330a7ad
Modificáronse 100 ficheiros con 909 adicións e 334 borrados
  1. 1 2
      .gitattributes
  2. 9 1
      Makefile
  3. 10 2
      compiler/Makefile
  4. 7 0
      compiler/cfidwarf.pas
  5. 3 1
      compiler/cgbase.pas
  6. 119 8
      compiler/options.pas
  7. 9 0
      compiler/riscv/aasmcpu.pas
  8. 5 6
      compiler/riscv/agrvgas.pas
  9. 46 18
      compiler/riscv/cgrv.pas
  10. 1 1
      compiler/riscv64/cpubase.pas
  11. 1 1
      compiler/riscv64/itcpugas.pas
  12. 4 4
      compiler/systems/i_linux.pas
  13. 14 2
      compiler/systems/t_linux.pas
  14. 8 0
      compiler/utils/Makefile
  15. 8 0
      installer/Makefile
  16. 8 0
      packages/Makefile
  17. 8 0
      packages/a52/Makefile
  18. 8 0
      packages/ami-extra/Makefile
  19. 8 0
      packages/amunits/Makefile
  20. 0 5
      packages/amunits/src/otherlibs/ahi_sub.pas
  21. 0 4
      packages/amunits/src/otherlibs/amarquee.pas
  22. 4 4
      packages/amunits/src/otherlibs/cybergraphics.pas
  23. 0 40
      packages/amunits/src/useamigasmartlink.inc
  24. 0 87
      packages/amunits/src/useautoopenlib.inc
  25. 0 5
      packages/amunits/src/utilunits/amigautils.pas
  26. 0 5
      packages/amunits/src/utilunits/consoleio.pas
  27. 0 5
      packages/amunits/src/utilunits/doublebuffer.pas
  28. 0 5
      packages/amunits/src/utilunits/easyasl.pas
  29. 0 5
      packages/amunits/src/utilunits/hisoft.pas
  30. 0 4
      packages/amunits/src/utilunits/linklist.pas
  31. 2 7
      packages/amunits/src/utilunits/pastoc.pas
  32. 0 5
      packages/amunits/src/utilunits/timerutils.pas
  33. 0 4
      packages/amunits/src/utilunits/vartags.pas
  34. 0 5
      packages/amunits/src/utilunits/wbargs.pas
  35. 8 0
      packages/arosunits/Makefile
  36. 5 17
      packages/arosunits/src/agraphics.pas
  37. 100 63
      packages/arosunits/src/layers.pas
  38. 8 0
      packages/aspell/Makefile
  39. 8 0
      packages/bfd/Makefile
  40. 8 0
      packages/bzip2/Makefile
  41. 8 0
      packages/cairo/Makefile
  42. 8 0
      packages/cdrom/Makefile
  43. 8 0
      packages/chm/Makefile
  44. 8 0
      packages/cocoaint/Makefile
  45. 8 0
      packages/dblib/Makefile
  46. 8 0
      packages/dbus/Makefile
  47. 8 0
      packages/dts/Makefile
  48. 8 0
      packages/fastcgi/Makefile
  49. 8 0
      packages/fcl-async/Makefile
  50. 8 0
      packages/fcl-base/Makefile
  51. 8 0
      packages/fcl-db/Makefile
  52. 17 14
      packages/fcl-db/src/sdf/sdfdata.pp
  53. 8 0
      packages/fcl-extra/Makefile
  54. 8 0
      packages/fcl-fpcunit/Makefile
  55. 8 0
      packages/fcl-image/Makefile
  56. 8 0
      packages/fcl-js/Makefile
  57. 8 0
      packages/fcl-json/Makefile
  58. 1 1
      packages/fcl-json/src/jsonconf.pp
  59. 17 1
      packages/fcl-json/src/jsonscanner.pp
  60. 8 0
      packages/fcl-net/Makefile
  61. 8 0
      packages/fcl-passrc/Makefile
  62. 6 2
      packages/fcl-passrc/src/pparser.pp
  63. 8 0
      packages/fcl-pdf/Makefile
  64. 8 0
      packages/fcl-process/Makefile
  65. 8 0
      packages/fcl-registry/Makefile
  66. 8 0
      packages/fcl-report/Makefile
  67. 8 0
      packages/fcl-res/Makefile
  68. 8 0
      packages/fcl-sdo/Makefile
  69. 8 0
      packages/fcl-sound/Makefile
  70. 8 0
      packages/fcl-stl/Makefile
  71. 8 0
      packages/fcl-web/Makefile
  72. 8 0
      packages/fcl-xml/Makefile
  73. 8 0
      packages/fftw/Makefile
  74. 8 0
      packages/fpgtk/Makefile
  75. 8 0
      packages/fpindexer/Makefile
  76. 8 0
      packages/fpmkunit/Makefile
  77. 8 0
      packages/fppkg/Makefile
  78. 8 0
      packages/fuse/Makefile
  79. 8 0
      packages/fv/Makefile
  80. 8 0
      packages/gdbint/Makefile
  81. 8 0
      packages/gdbm/Makefile
  82. 8 0
      packages/ggi/Makefile
  83. 8 0
      packages/gmp/Makefile
  84. 8 0
      packages/gnome1/Makefile
  85. 8 0
      packages/gnutls/Makefile
  86. 8 0
      packages/googleapi/Makefile
  87. 8 0
      packages/graph/Makefile
  88. 8 0
      packages/gtk1/Makefile
  89. 8 0
      packages/gtk2/Makefile
  90. 8 0
      packages/hash/Makefile
  91. 8 0
      packages/hermes/Makefile
  92. 8 0
      packages/httpd13/Makefile
  93. 8 0
      packages/httpd20/Makefile
  94. 8 0
      packages/httpd22/Makefile
  95. 8 0
      packages/httpd24/Makefile
  96. 8 0
      packages/ibase/Makefile
  97. 8 0
      packages/iconvenc/Makefile
  98. 8 0
      packages/ide/Makefile
  99. 8 0
      packages/imagemagick/Makefile
  100. 8 0
      packages/imlib/Makefile

+ 1 - 2
.gitattributes

@@ -1330,8 +1330,6 @@ packages/amunits/src/otherlibs/tritonmacros.pas svneol=native#text/plain
 packages/amunits/src/otherlibs/ttengine.pas svneol=native#text/plain
 packages/amunits/src/otherlibs/xadmaster.pas svneol=native#text/plain
 packages/amunits/src/otherlibs/zlib.pas svneol=native#text/plain
-packages/amunits/src/useamigasmartlink.inc svneol=native#text/plain
-packages/amunits/src/useautoopenlib.inc svneol=native#text/plain
 packages/amunits/src/utilunits/amigautils.pas svneol=native#text/plain
 packages/amunits/src/utilunits/consoleio.pas svneol=native#text/plain
 packages/amunits/src/utilunits/deadkeys.pas svneol=native#text/plain
@@ -11335,6 +11333,7 @@ rtl/linux/riscv32/sysnr.inc svneol=native#text/plain
 rtl/linux/riscv64/bsyscall.inc svneol=native#text/plain
 rtl/linux/riscv64/si_c.inc svneol=native#text/plain
 rtl/linux/riscv64/si_dll.inc svneol=native#text/plain
+rtl/linux/riscv64/si_g.inc svneol=native#text/plain
 rtl/linux/riscv64/si_prc.inc svneol=native#text/plain
 rtl/linux/riscv64/sighnd.inc svneol=native#text/plain
 rtl/linux/riscv64/sighndh.inc svneol=native#text/plain

+ 9 - 1
Makefile

@@ -1079,10 +1079,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif
@@ -1690,7 +1698,7 @@ ifdef CREATESHARED
 override FPCOPT+=-Cg
 endif
 ifneq ($(findstring $(OS_TARGET),dragonfly freebsd openbsd netbsd linux solaris),)
-ifneq ($(findstring $(CPU_TARGET),x86_64 mips mipsel),)
+ifneq ($(findstring $(CPU_TARGET),x86_64 mips mipsel riscv64),)
 override FPCOPT+=-Cg
 endif
 endif

+ 10 - 2
compiler/Makefile

@@ -2789,10 +2789,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif
@@ -5085,9 +5093,9 @@ endif
 cycledep:
 	$(MAKE) cycle USEDEPEND=1
 extcycle:
-	$(MAKE) cycle OPT="$(OPT) -n -glttt -CRriot -dEXTDEBUG" ALLOW_WARNINGS=1
+	$(MAKE) cycle RTLOPT="$(RTLOPT) -n -glttt -CRriot -dEXTDEBUG" LOCALOPT="$(LOCALOPT) -n -glttt -CRriot -dEXTDEBUG" ALLOW_WARNINGS=1
 extoptcycle:
-	$(MAKE) cycle OPT="$(OPT) -n -glttt -CRriot -dEXTDEBUG -dDEBUG_ALL_OPT" ALLOW_WARNINGS=1
+	$(MAKE) cycle RTLOPT="$(RTLOPT) -n -glttt -CRriot -dEXTDEBUG -dDEBUG_ALL_OPT" LOCALOPT="$(LOCALOPT) -n -glttt -CRriot -dEXTDEBUG -dDEBUG_ALL_OPT" ALLOW_WARNINGS=1
 cvstest:
 	$(MAKE) cycle 'LOCALOPT=-n -Se' 'RTLOPT=-n -Se'
 ifeq ($(findstring -dFPC_SOFT_FPUX80,$(LOCALOPT)),)

+ 7 - 0
compiler/cfidwarf.pas

@@ -301,6 +301,13 @@ implementation
         list.concat(tai_const.create_uleb128bit(dwarf_reg(NR_STACK_POINTER_REG)));
         list.concat(tai_const.create_uleb128bit(0));
       end;
+{$elseif defined(riscv)}
+    procedure TDwarfAsmCFILowLevel.generate_initial_instructions(list:TAsmList);
+      begin
+        list.concat(tai_const.create_8bit(DW_CFA_def_cfa));
+        list.concat(tai_const.create_uleb128bit(dwarf_reg(NR_STACK_POINTER_REG)));
+        list.concat(tai_const.create_uleb128bit(0));
+      end;
 {$else}
     { if more cpu dependend stuff is implemented, this needs more refactoring }
     procedure TDwarfAsmCFILowLevel.generate_initial_instructions(list:TAsmList);

+ 3 - 1
compiler/cgbase.pas

@@ -99,7 +99,9 @@ interface
          addr_lo12,
          addr_pcrel_hi20,
          addr_pcrel_lo12,
-         addr_pcrel
+         addr_pcrel,
+         addr_got_pcrel_hi,
+         addr_plt
          {$endif RISCV}
          {$IFDEF AVR}
          ,addr_lo8

+ 119 - 8
compiler/options.pas

@@ -283,6 +283,22 @@ const
      end;
   end;
 
+  procedure ListOSTargetsXML;
+  var
+    target : tsystem;
+  begin
+    WriteLn(xmloutput,'    <ostargets>');
+    for target:=low(tsystem) to high(tsystem) do
+    if assigned(targetinfos[target]) then
+      begin
+        Write(xmloutput,'      <ostarget shortname="',targetinfos[target]^.shortname,'" name="',targetinfos[target]^.name,'"');
+        if tf_under_development in targetinfos[target]^.flags then
+          Write(' experimental="1"');
+        WriteLn('/>');
+      end;
+    WriteLn(xmloutput,'    </ostargets>');
+  end;
+
   procedure ListCPUInstructionSets (OrigString: TCmdStr);
   var
     cpu : tcputype;
@@ -321,6 +337,17 @@ const
      end;
   end;
 
+  procedure ListCPUInstructionSetsXML;
+  var
+    cpu : tcputype;
+  begin
+    WriteLn(xmloutput,'    <cpuinstructionsets>');
+    for cpu:=low(tcputype) to high(tcputype) do
+      if CPUTypeStr [CPU] <> '' then
+        WriteLn(xmloutput,'      <cpuinstructionset name="',CPUTypeStr [CPU], '"/>');
+    WriteLn(xmloutput,'    </cpuinstructionsets>');
+  end;
+
   procedure ListFPUInstructionSets (OrigString: TCmdStr);
   var
     fpu : tfputype;
@@ -359,6 +386,17 @@ const
      end;
   end;
 
+  procedure ListFPUInstructionSetsXML;
+  var
+    fpu : tfputype;
+  begin
+    WriteLn(xmloutput,'    <fpuinstructionsets>');
+    for fpu:=low(tfputype) to high(tfputype) do
+      if FPUTypeStr [fpu] <> '' then
+        WriteLn(xmloutput,'      <cpuinstructionset name="',FPUTypeStr [fpu], '"/>');
+    WriteLn(xmloutput,'    </fpuinstructionsets>');
+  end;
+
   procedure ListABITargets (OrigString: TCmdStr);
   var
     abi : tabi;
@@ -383,6 +421,21 @@ const
      end;
   end;
 
+  procedure ListABITargetsXML;
+  var
+    abi : tabi;
+  begin
+    WriteLn(xmloutput,'    <abis>');
+    for abi:=low(abi) to high(abi) do
+     begin
+      if not abiinfo[abi].supported then
+        continue;
+      if abiinfo[abi].name<>'' then;
+        WriteLn(xmloutput,'      <abi name="',abiinfo[abi].name, '"/>');
+     end;
+    WriteLn(xmloutput,'    </abis>');
+  end;
+
   procedure ListOptimizations (OrigString: TCmdStr);
   var
     opt : toptimizerswitch;
@@ -412,11 +465,11 @@ const
   var
     opt: toptimizerswitch;
   begin
-    WriteLn(xmloutput,'<optimizations>');
+    WriteLn(xmloutput,'    <optimizations>');
     for opt:=low(toptimizerswitch) to high(toptimizerswitch) do
       if OptimizerSwitchStr[opt]<>'' then
-        WriteLn(xmloutput,'<optimization name="',OptimizerSwitchStr[opt],'"/>');
-    WriteLn(xmloutput,'</optimizations>');
+        WriteLn(xmloutput,'      <optimization name="',OptimizerSwitchStr[opt],'"/>');
+    WriteLn(xmloutput,'    </optimizations>');
   end;
 
   procedure ListWPOptimizations (OrigString: TCmdStr);
@@ -446,6 +499,17 @@ const
      end;
   end;
 
+  procedure ListWPOptimizationsXML;
+  var
+    wpopt: twpoptimizerswitch;
+  begin
+    WriteLn(xmloutput,'    <wpoptimizations>');
+    for wpopt:=low(twpoptimizerswitch) to high(twpoptimizerswitch) do
+      if WPOptimizerSwitchStr[wpopt]<>'' then
+        WriteLn(xmloutput,'      <wpoptimization name="',WPOptimizerSwitchStr[wpopt],'"/>');
+    WriteLn(xmloutput,'    </wpoptimizations>');
+  end;
+
   procedure ListAsmModes (OrigString: TCmdStr);
   var
     asmmode : tasmmode;
@@ -469,6 +533,17 @@ const
      end;
   end;
 
+  procedure ListAsmModesXML;
+  var
+    asmmode : tasmmode;
+  begin
+    WriteLn(xmloutput,'    <asmmodes>');
+    for asmmode:=low(tasmmode) to high(tasmmode) do
+      if assigned(asmmodeinfos[asmmode]) then
+        WriteLn(xmloutput,'        <asmmode name="',asmmodeinfos[asmmode]^.idtxt,'"/>');
+    WriteLn(xmloutput,'    </asmmodes>');
+  end;
+
   procedure ListControllerTypes (OrigString: TCmdStr);
   var
     controllertype : tcontrollertype;
@@ -522,11 +597,11 @@ const
  {$WARN 6018 OFF} (* Unreachable code due to compile time evaluation *)
     if (ControllerSupport) then
      begin
-      WriteLn(xmloutput,'<controllertypes>');
+      WriteLn(xmloutput,'    <controllertypes>');
       for controllertype:=low(tcontrollertype) to high(tcontrollertype) do
         if embedded_controllers[controllertype].ControllerTypeStr<>'' then
-          WriteLn(xmloutput,'<controllertype name="',embedded_controllers[controllertype].ControllerTypeStr,'"/>');
-      WriteLn(xmloutput,'</controllertypes>');
+          WriteLn(xmloutput,'      <controllertype name="',embedded_controllers[controllertype].ControllerTypeStr,'"/>');
+      WriteLn(xmloutput,'    </controllertypes>');
      end;
 {$POP}
   end;
@@ -569,6 +644,17 @@ const
      end;
   end;
 
+  procedure ListFeaturesXML;
+  var
+    Feature: TFeature;
+  begin
+    WriteLn(xmloutput,'    <features>');
+    for Feature := Low (TFeature) to High (TFeature) do
+      if FeatureStr [Feature] <> '' then
+         WriteLn(xmloutput,'      <feature name="',FeatureStr [Feature],'"/>');
+    WriteLn(xmloutput,'    </features>');
+  end;
+
   procedure ListModeswitches (OrigString: TCmdStr);
   var
     Modeswitch: TModeswitch;
@@ -607,6 +693,17 @@ const
      end;
   end;
 
+  procedure ListModeswitchesXML;
+  var
+    Modeswitch: TModeswitch;
+  begin
+    WriteLn(xmloutput,'    <modeswitches>');
+    for Modeswitch:=Low(TModeswitch) to High(TModeswitch) do
+      if ModeswitchStr [Modeswitch]<>'' then
+        WriteLn(xmloutput,'      <modeswitch name="',ModeswitchStr [Modeswitch],'"/>');
+    WriteLn(xmloutput,'    </modeswitches>');
+  end;
+
   procedure ListCodeGenerationBackend (OrigString: TCmdStr);
     begin
       SplitLine (OrigString, CodeGenerationBackendPlaceholder, HS3);
@@ -621,6 +718,11 @@ const
         end;
     end;
 
+  procedure ListCodeGenerationBackendXML;
+    begin
+      WriteLn(xmloutput,'    <codegeneratorbackend>',cgbackend2str[cgbackend],'</codegeneratorbackend>');
+    end;
+
 begin
   if More = '' then
    begin
@@ -662,10 +764,19 @@ begin
       Rewrite(xmloutput);
       WriteLn(xmloutput,'<?xml version="1.0" encoding="utf-8"?>');
       WriteLn(xmloutput,'<fpcoutput>');
-      WriteLn(xmloutput,'<info>');
+      WriteLn(xmloutput,'  <info>');
+      ListOSTargetsXML;
+      ListCPUInstructionSetsXML;
+      ListFPUInstructionSetsXML;
+      ListABITargetsXML;
       ListOptimizationsXML;
+      ListWPOptimizationsXML;
+      ListModeswitchesXML;
+      ListAsmModesXML;
       ListControllerTypesXML;
-      WriteLn(xmloutput,'</info>');
+      ListFeaturesXML;
+      ListCodeGenerationBackendXML;
+      WriteLn(xmloutput,'  </info>');
       WriteLn(xmloutput,'</fpcoutput>');
       Close(xmloutput);
    end

+ 9 - 0
compiler/riscv/aasmcpu.pas

@@ -47,6 +47,7 @@ uses
 
          constructor op_reg(op : tasmop;_op1 : tregister);
          constructor op_const(op : tasmop;_op1 : aint);
+         constructor op_ref(op : tasmop;_op1 : treference);
 
          constructor op_reg_reg(op : tasmop;_op1,_op2 : tregister);
          constructor op_reg_ref(op : tasmop;_op1 : tregister;const _op2 : treference);
@@ -144,6 +145,14 @@ uses cutils, cclasses;
       end;
 
 
+    constructor taicpu.op_ref(op : tasmop;_op1 : treference);
+      begin
+         inherited create(op);
+         ops:=1;
+         loadref(0,_op1);
+      end;
+
+
     constructor taicpu.op_const(op : tasmop;_op1 : aint);
       begin
          inherited create(op);

+ 5 - 6
compiler/riscv/agrvgas.pas

@@ -74,7 +74,8 @@ unit agrvgas;
             else
               begin
                 s :='';
-                s := s+'(';
+                if not(refaddr in [addr_no,addr_pic_no_got,addr_plt]) then
+                  s := s+'(';
                 if assigned(symbol) then
                   begin
                     if asminfo^.dollarsign<>'$' then
@@ -103,14 +104,10 @@ unit agrvgas;
                 s:=s+tostr(offset);
             end;
 
-           if not(refaddr in [addr_no,addr_pic_no_got]) then
+           if not(refaddr in [addr_no,addr_pic_no_got,addr_plt]) then
              begin
                s := s+')';
              end;
-{$ifdef cpu64bitaddr}
-           if (refaddr=addr_pic) then
-             s := s + '@got';
-{$endif cpu64bitaddr}
 
            if (index=NR_NO) then
              begin
@@ -139,6 +136,8 @@ unit agrvgas;
              addr_hi20: s:='%hi'+s;
              addr_pcrel_lo12: s:='%pcrel_lo'+s;
              addr_pcrel_hi20: s:='%pcrel_hi'+s;
+             addr_got_pcrel_hi: s:='%got_pcrel_hi'+s;
+             addr_plt: s:=s+'@plt';
              else
                ;
            end;

+ 46 - 18
compiler/riscv/cgrv.pas

@@ -133,16 +133,24 @@ unit cgrv;
         else
           reference_reset_symbol(href,current_asmdata.WeakRefAsmSymbol(s,AT_FUNCTION),0,0,[]);
 
-        current_asmdata.getjumplabel(l);
+        if cs_create_pic in current_settings.moduleswitches then
+          begin
+            href.refaddr:=addr_plt;
+            list.concat(taicpu.op_ref(A_CALL,href));
+          end
+        else
+          begin
+            current_asmdata.getjumplabel(l);
 
-        a_label(list,l);
+            a_label(list,l);
 
-        href.refaddr:=addr_pcrel_hi20;
-        list.concat(taicpu.op_reg_ref(A_AUIPC,NR_RETURN_ADDRESS_REG,href));
+            href.refaddr:=addr_pcrel_hi20;
+            list.concat(taicpu.op_reg_ref(A_AUIPC,NR_RETURN_ADDRESS_REG,href));
 
-        reference_reset_symbol(href,l,0,0,[]);
-        href.refaddr:=addr_pcrel_lo12;
-        list.concat(taicpu.op_reg_reg_ref(A_JALR,NR_RETURN_ADDRESS_REG,NR_RETURN_ADDRESS_REG,href));
+            reference_reset_symbol(href,l,0,0,[]);
+            href.refaddr:=addr_pcrel_lo12;
+            list.concat(taicpu.op_reg_reg_ref(A_JALR,NR_RETURN_ADDRESS_REG,NR_RETURN_ADDRESS_REG,href));
+          end;
 
         { not assigned while generating external wrappers }
         if assigned(current_procinfo) then
@@ -721,20 +729,40 @@ unit cgrv;
 
         if assigned(ref.symbol) then
           begin
-            reference_reset_symbol(href,ref.symbol,ref.offset,ref.alignment,ref.volatility);
-            ref.symbol:=nil;
-            ref.offset:=0;
+            if cs_create_pic in current_settings.moduleswitches then
+              begin
+                reference_reset_symbol(href,ref.symbol,0,0,[]);
+                ref.symbol:=nil;
 
-            tmpreg:=getintregister(list,OS_INT);
+                tmpreg:=getintregister(list,OS_INT);
 
-            current_asmdata.getaddrlabel(l);
-            a_label(list,l);
+                current_asmdata.getaddrlabel(l);
+                a_label(list,l);
 
-            href.refaddr:=addr_pcrel_hi20;
-            list.concat(taicpu.op_reg_ref(A_AUIPC,tmpreg,href));
-            reference_reset_symbol(href,l,0,0,ref.volatility);
-            href.refaddr:=addr_pcrel_lo12;
-            list.concat(taicpu.op_reg_reg_ref(A_ADDI,tmpreg,tmpreg,href));
+                href.refaddr:=addr_got_pcrel_hi;
+                list.concat(taicpu.op_reg_ref(A_AUIPC,tmpreg,href));
+                reference_reset_symbol(href,l,0,0,[]);
+                href.refaddr:=addr_pcrel_lo12;
+                href.base:=tmpreg;
+                list.concat(taicpu.op_reg_ref(A_LD,tmpreg,href));
+              end
+            else
+              begin
+                reference_reset_symbol(href,ref.symbol,ref.offset,ref.alignment,ref.volatility);
+                ref.symbol:=nil;
+                ref.offset:=0;
+
+                tmpreg:=getintregister(list,OS_INT);
+
+                current_asmdata.getaddrlabel(l);
+                a_label(list,l);
+
+                href.refaddr:=addr_pcrel_hi20;
+                list.concat(taicpu.op_reg_ref(A_AUIPC,tmpreg,href));
+                reference_reset_symbol(href,l,0,0,ref.volatility);
+                href.refaddr:=addr_pcrel_lo12;
+                list.concat(taicpu.op_reg_reg_ref(A_ADDI,tmpreg,tmpreg,href));
+              end;
 
             if (ref.index<>NR_NO) and
                (ref.base<>NR_NO) then

+ 1 - 1
compiler/riscv64/cpubase.pas

@@ -38,7 +38,7 @@ uses
 type
       TAsmOp=(A_None,
         { Pseudo instructions }
-        A_NOP,
+        A_NOP,A_CALL,
         { normal opcodes }
         A_LUI,A_AUIPC,A_JAL,A_JALR,
         A_Bxx,A_LB,A_LH,A_LW,A_LBU,A_LHU,

+ 1 - 1
compiler/riscv64/itcpugas.pas

@@ -30,7 +30,7 @@ unit itcpugas;
 
     const
       gas_op2str: array[tasmop] of string[14] = ('<none>',
-        'nop',
+        'nop','call',
         'lui','auipc','jal','jalr',
         'b','lb','lh','lw','lbu','lhu',
         'sb','sh','sw',

+ 4 - 4
compiler/systems/i_linux.pas

@@ -1107,7 +1107,7 @@ unit i_linux;
             system       : system_riscv32_linux;
             name         : 'Linux for RISC-V 32';
             shortname    : 'Linux';
-            flags        : [tf_needs_symbol_size,tf_smartlink_sections,
+            flags        : [tf_needs_symbol_size,tf_smartlink_sections,tf_needs_dwarf_cfi,
                             tf_needs_symbol_type,tf_files_case_sensitive,
                             tf_requires_proper_alignment,tf_has_winlike_resources,
                             tf_supports_hidden_symbols];
@@ -1144,7 +1144,7 @@ unit i_linux;
             linkextern   : ld_linux;
             ar           : ar_gnu_ar;
             res          : res_elf;
-            dbg          : dbg_dwarf2;
+            dbg          : dbg_dwarf3;
             script       : script_unix;
             endian       : endian_little;
             alignment    :
@@ -1177,7 +1177,7 @@ unit i_linux;
             system       : system_riscv64_linux;
             name         : 'Linux for RISC-V 64';
             shortname    : 'Linux';
-            flags        : [tf_needs_symbol_size,tf_smartlink_sections,
+            flags        : [tf_needs_symbol_size,tf_library_needs_pic,tf_smartlink_sections,tf_needs_dwarf_cfi,
                             tf_needs_symbol_type,tf_files_case_sensitive,
                             tf_requires_proper_alignment,tf_has_winlike_resources,
                             tf_supports_hidden_symbols
@@ -1215,7 +1215,7 @@ unit i_linux;
             linkextern   : ld_linux;
             ar           : ar_gnu_ar;
             res          : res_elf;
-            dbg          : dbg_dwarf2;
+            dbg          : dbg_dwarf3;
             script       : script_unix;
             endian       : endian_little;
             alignment    :

+ 14 - 2
compiler/systems/t_linux.pas

@@ -538,7 +538,13 @@ begin
            Message1(exec_w_init_file_not_found,'crti.o');
 
          { then the crtbegin* }
-         if cs_create_pic in current_settings.moduleswitches then
+         if (cs_create_pic in current_settings.moduleswitches)
+{$ifdef RISCV}
+         { on RISC-V we need to use always the *S.o variants
+           if shared libraries are involved }
+         or (not SharedLibFiles.Empty)
+{$endif RISCV}
+         then
            begin
              if librarysearchpath.FindFile('crtbeginS.o',false,s) then
                AddFileName(s)
@@ -649,7 +655,13 @@ begin
       { objects which must be at the end }
       if linklibc and (libctype<>uclibc) then
        begin
-         if cs_create_pic in current_settings.moduleswitches then
+         if (cs_create_pic in current_settings.moduleswitches)
+{$ifdef RISCV}
+         { on RISC-V we need to use always the *S.o variants
+           if shared libraries are involved }
+         or linksToSharedLibFiles
+{$endif RISCV}
+         then
            begin
              found1:=librarysearchpath.FindFile('crtendS.o',false,s1);
              if not(found1) then

+ 8 - 0
compiler/utils/Makefile

@@ -1862,10 +1862,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 8 - 0
installer/Makefile

@@ -1031,10 +1031,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 8 - 0
packages/Makefile

@@ -631,10 +631,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 8 - 0
packages/a52/Makefile

@@ -607,10 +607,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 8 - 0
packages/ami-extra/Makefile

@@ -607,10 +607,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 8 - 0
packages/amunits/Makefile

@@ -607,10 +607,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 0 - 5
packages/amunits/src/otherlibs/ahi_sub.pas

@@ -30,11 +30,6 @@
 }
 {$PACKRECORDS 2}
 
-{$I useamigasmartlink.inc}
-{$ifdef use_amiga_smartlink}
-   {$smartlink on}
-{$endif use_amiga_smartlink}
-
 UNIT AHI_SUB;
 
 INTERFACE

+ 0 - 4
packages/amunits/src/otherlibs/amarquee.pas

@@ -37,10 +37,6 @@
 
 }
 
-{$I useamigasmartlink.inc}
-{$ifdef use_amiga_smartlink}
-    {$smartlink on}
-{$endif use_amiga_smartlink}
 unit amarquee;
 
 

+ 4 - 4
packages/amunits/src/otherlibs/cybergraphics.pas

@@ -218,14 +218,14 @@ const
      BMB_SPECIALFMT = 7;
      BMF_SPECIALFMT = 1 shl BMB_SPECIALFMT;
 
-FUNCTION AllocCModeListTagList(ModeListTags : pTagItem location 'a1') : pList; syscall CyberGfxBase 072;
+FUNCTION AllocCModeListTagList(ModeListTags : pTagItem location 'a1') : PCyberModeNode; syscall CyberGfxBase 072;
 FUNCTION BestCModeIDTagList(BestModeIDTags : pTagItem location 'a0') : longword; syscall CyberGfxBase 060;
 FUNCTION CModeRequestTagList(ModeRequest : POINTER location 'a0'; ModeRequestTags : pTagItem location 'a1') : longword; syscall CyberGfxBase 066;
 PROCEDURE CVideoCtrlTagList(ViewPort : pViewPort location 'a0'; TagList : pTagItem location 'a1'); syscall CyberGfxBase 162;
 PROCEDURE DoCDrawMethodTagList(Hook : pHook location 'a0'; a1arg : pRastPort location 'a1'; TagList : pTagItem location 'a2'); syscall CyberGfxBase 156;
 FUNCTION ExtractColor(a0arg : pRastPort location 'a0'; BitMap : pBitMap location 'a1'; Colour : longword location 'd0'; SrcX : longword location 'd1'; SrcY : longword location 'd2'; Width : longword location 'd3'; Height : longword location 'd4') : longword; syscall CyberGfxBase 186;
 FUNCTION FillPixelArray(a1arg : pRastPort location 'a1'; DestX : WORD location 'd0'; DestY : WORD location 'd1'; SizeX : WORD location 'd2'; SizeY : WORD location 'd3'; ARGB : longword location 'd4') : longword; syscall CyberGfxBase 150;
-PROCEDURE FreeCModeList(ModeList : pList location 'a0'); syscall CyberGfxBase 078;
+PROCEDURE FreeCModeList(ModeList : PCyberModeNode location 'a0'); syscall CyberGfxBase 078;
 FUNCTION GetCyberIDAttr(CyberIDAttr : longword location 'd0'; CyberDisplayModeID : longword location 'd1') : longword; syscall CyberGfxBase 102;
 FUNCTION GetCyberMapAttr(CyberGfxBitmap : pBitMap location 'a0'; CyberAttrTag : longword location 'd0') : longword; syscall CyberGfxBase 096;
 FUNCTION InvertPixelArray(a1arg : pRastPort location 'a1'; DestX : WORD location 'd0'; DestY : WORD location 'd1'; SizeX : WORD location 'd2'; SizeY : WORD location 'd3') : longword; syscall CyberGfxBase 144;
@@ -243,7 +243,7 @@ FUNCTION WriteRGBPixel(a1arg : pRastPort location 'a1'; x : WORD location 'd0';
 {
  Functions and procedures with array of PtrUInt go here
 }
-FUNCTION AllocCModeListTags(const ModeListTags : array of PtrUInt) : pList;
+FUNCTION AllocCModeListTags(const ModeListTags : array of PtrUInt) : PCyberModeNode;
 FUNCTION BestCModeIDTags(const BestModeIDTags : array of PtrUInt) : longword;
 FUNCTION CModeRequestTags(ModeRequest : POINTER; const ModeRequestTags : array of PtrUInt) : longword;
 PROCEDURE CVideoCtrlTags(ViewPort : pViewPort; const TagList : array of PtrUInt);
@@ -258,7 +258,7 @@ IMPLEMENTATION
 {
  Functions and procedures with array of PtrUInt go here
 }
-FUNCTION AllocCModeListTags(const ModeListTags : array of PtrUInt) : pList;
+FUNCTION AllocCModeListTags(const ModeListTags : array of PtrUInt) : PCyberModeNode;
 begin
     AllocCModeListTags := AllocCModeListTagList(@ModeListTags);
 end;

+ 0 - 40
packages/amunits/src/useamigasmartlink.inc

@@ -1,40 +0,0 @@
-
-{  useamigasmartlink.inc }
-
-{
-    This file is part of the Free Pascal run time library.
-
-    A file in Amiga system run time library.
-    Copyright (c) 2003 by Nils Sjoholm
-    member of the Amiga RTL 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.
-
- **********************************************************************}
-
-{
-   This includefile sets the define use_amiga_smartlink.
-
-   This way I can be sure that all units that reads
-   this includefile is compiled with smartlink.
-
-   If you don't want smartlink just put a space before
-   $define use_amiga_smartlink.
-
-   11 Jan 2003.
-
-   [email protected]
-
-}
-
-{$ifndef use_amiga_smartlink}
-   {$define use_amiga_smartlink}
-{$endif}
-
-
-

+ 0 - 87
packages/amunits/src/useautoopenlib.inc

@@ -1,87 +0,0 @@
-
-{  useautoopenlib.inc }
-
-{
-    This file is part of the Free Pascal run time library.
-
-    A file in Amiga system run time library.
-    Copyright (c) 2003 by Nils Sjoholm
-    member of the Amiga RTL 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.
-
- **********************************************************************}
-
-{
-   In this includefile you can set some defines on how
-   to compile amiga units.
-
-   use_auto_openlib.
-   If you use use_auto_openlib the unit will compile
-   with autoopening of the unit at startup. You don't
-   have to think about open and close the library, all
-   is done in the unit. One problem is that the library
-   will be loaded at startup so there can be a memory-
-   problem. As default I have compiled all amiga system
-   units as autoopened. Exec, intuition, amigados and
-   utility is all opened on startup by sysamiga.
-
-
-   use_init_openlib.
-   If you compile with this define you get a procedure
-   in every unit as an example for asl.library you
-   have "procedure InitAslLibrary;". All you have to
-   do is
-   InitAslLibrary in the beginning of your program.
-   You don't have to close the library the unit will
-   handle that.
-
-   dont_use_openlib.
-   This is the standard amiga way. You have to open
-   the library yourself and at the end close it.
-
-   When you compile a unit you will get warnings or
-   info on how the defines are set.
-
-   First version of this include.
-   11 Jan 2003.
-
-   Added use_init_openlib and dont_use_openlib.
-   21 Jan 2003.
-
-   [email protected]
-
-}
-
-{
-   Make sure that there is only one define set.
-   Just put a space before the define to undef
-}
-
-{$define use_auto_openlib}
-{ $define use_init_openlib}
-{ $define dont_use_openlib}
-
-{$ifdef use_auto_openlib}
-   {$undef use_init_openlib}
-   {$undef use_init_openlib}
-{$endif use_auto_openlib}
-
-{$ifdef use_init_openlib}
-   {$undef use_auto_openlib}
-   {$undef dont_use_openlib}
-{$endif use_init_openlib}
-
-{$ifdef dont_use_openlib}
-   {$undef use_auto_openlib}
-   {$undef use_init_openlib}
-{$endif dont_use_openlib}
-
-
-
-

+ 0 - 5
packages/amunits/src/utilunits/amigautils.pas

@@ -24,11 +24,6 @@
    [email protected]
 }
 
-{$I useamigasmartlink.inc}
-{$ifdef use_amiga_smartlink}
-    {$smartlink on}
-{$endif use_amiga_smartlink}
-
 unit amigautils;
 
 interface

+ 0 - 5
packages/amunits/src/utilunits/consoleio.pas

@@ -34,11 +34,6 @@ unit consoleio;
 
 }
 
-{$I useamigasmartlink.inc}
-{$ifdef use_amiga_smartlink}
-    {$smartlink on}
-{$endif use_amiga_smartlink}
-
 interface
 
 uses exec, intuition, console, amigalib, conunit;

+ 0 - 5
packages/amunits/src/utilunits/doublebuffer.pas

@@ -14,11 +14,6 @@
 
  **********************************************************************}
 
-{$I useamigasmartlink.inc}
-{$ifdef use_amiga_smartlink}
-    {$smartlink on}
-{$endif use_amiga_smartlink}
-
 unit doublebuffer;
 
 

+ 0 - 5
packages/amunits/src/utilunits/easyasl.pas

@@ -33,11 +33,6 @@
     [email protected]
 }
 
-{$I useamigasmartlink.inc}
-{$ifdef use_amiga_smartlink}
-    {$smartlink on}
-{$endif use_amiga_smartlink}
-
 unit easyasl;
 
 

+ 0 - 5
packages/amunits/src/utilunits/hisoft.pas

@@ -26,11 +26,6 @@
         [email protected] Nils Sjoholm
 }
 
-{$I useamigasmartlink.inc}
-{$ifdef use_amiga_smartlink}
-    {$smartlink on}
-{$endif use_amiga_smartlink}
-
 unit hisoft;
 
 interface

+ 0 - 4
packages/amunits/src/utilunits/linklist.pas

@@ -14,10 +14,6 @@
 
  **********************************************************************}
 
-{$I useamigasmartlink.inc}
-{$ifdef use_amiga_smartlink}
-    {$smartlink on}
-{$endif use_amiga_smartlink}
 
 unit linklist;
 

+ 2 - 7
packages/amunits/src/utilunits/pastoc.pas

@@ -22,11 +22,6 @@
     [email protected] Nils Sjoholm
 }
 
-{$I useamigasmartlink.inc}
-{$ifdef use_amiga_smartlink}
-    {$smartlink on}
-{$endif use_amiga_smartlink}
-
 {
   This unit must be deprecated because at least:
   - It is leaking memory. It allocates a new buffer for each string which won't
@@ -34,9 +29,9 @@
   - The unit doesn't provide any way to free allocated string buffers manually.
     (Because ReleasePas2C is not a public function.)
   - It does allocations outside the Pascal heap, which the compiler has no control
-    over, and makes it very hard to track these allocations, because the heaptrc 
+    over, and makes it very hard to track these allocations, because the heaptrc
     unit doesn't work.
-  - The intuition.library documentation states that AllocRemember() is a quite 
+  - The intuition.library documentation states that AllocRemember() is a quite
     ineffective function, because it does two memory allocations and because it
     doesn't use memory pools it has a terrible effect on memory fragmentation.
   - It uses a for loop byte to copy the string contents, which is very slow.

+ 0 - 5
packages/amunits/src/utilunits/timerutils.pas

@@ -14,11 +14,6 @@
 
  **********************************************************************}
 
-{$I useamigasmartlink.inc}
-{$ifdef use_amiga_smartlink}
-    {$smartlink on}
-{$endif use_amiga_smartlink}
-
 unit timerutils;
 
 {

+ 0 - 4
packages/amunits/src/utilunits/vartags.pas

@@ -13,10 +13,6 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
  **********************************************************************}
-{$I useamigasmartlink.inc}
-{$ifdef use_amiga_smartlink}
-    {$smartlink on}
-{$endif use_amiga_smartlink}
 
 unit vartags;
 

+ 0 - 5
packages/amunits/src/utilunits/wbargs.pas

@@ -29,11 +29,6 @@
      [email protected] Nils Sjoholm
 }
 
-{$I useamigasmartlink.inc}
-{$ifdef use_amiga_smartlink}
-    {$smartlink on}
-{$endif use_amiga_smartlink}
-
 unit WBArgs;
 
 interface

+ 8 - 0
packages/arosunits/Makefile

@@ -607,10 +607,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 5 - 17
packages/arosunits/src/agraphics.pas

@@ -495,16 +495,11 @@ type
     LayerInfo: PLayer_Info;        // points to head of the list
     Lock: TSignalSemaphore;
     BackFill: PHook;
-{$ifdef aros}
     VisibleRegion: PRegion;        // Private!
-{$else}
-    Reserved1: ULONG;
-{$endif}
     ClipRegion: PRegion;
     SaveClipRects: PRegion;        // used to back out when in trouble
     Width,
     Height: SmallInt;
-{$ifdef aros}
     Shape: PRegion;              // Private!
     ShapeRegion: PRegion;        // Private!
     VisibleShape: PRegion;       // Private!
@@ -512,9 +507,6 @@ type
     SuperSaveClipRectCounter: Byte; // Private!
     Visible: Byte;               // Private!
     Reserved2: array[0..1] of Byte;
-{$else}
-    Reserved2: array[0..17] of Byte;
-{$endif}
     { this must stay here }
     DamageList: PRegion;   // list of rectangles to refreshthrough
   end;
@@ -997,12 +989,12 @@ type
       );
     1:(
       DestAddr: SmallInt; // destination Pointer
-      DestData: SmallInt; // data to send      
+      DestData: SmallInt; // data to send
       );
     2:(
       VWaitPos: SmallInt; // vertical wait position
-      HWaitPos: SmallInt; // horizontal wait position      
-      );  
+      HWaitPos: SmallInt; // horizontal wait position
+      );
   end;
 
   TCopList = record
@@ -1678,7 +1670,6 @@ type
     Reserved: array[0..1] of IPTR;
   end;
 // AROS-specifics.
-{$ifdef aros}
 const
 // Tags for AddDisplayDriverA()
   DDRV_BootMode     = TAG_USER + $01; // (LongBool) Boot mode driver which will be
@@ -1702,7 +1693,6 @@ type
     mask: ULONG;
     gfxhidd: APTR;
   end;
-{$endif}
 
 const
   VTAG_END_CM            = $00000000;
@@ -1807,9 +1797,7 @@ type
     es_SimpleSprite: TSimpleSprite;         { conventional simple sprite structure }
     es_WordWidth: Word;                 { graphics use only, subject to change }
     es_Flags: Word;                 { graphics use only, subject to change }
-{$ifdef aros} // New in AROS
     es_Bitmap: PBitmap;  // Actual image data.
-{$endif}
   end;
 
 const
@@ -1860,14 +1848,14 @@ const
   RPTAG_PenMode    = $80000080;
   RPTAG_FgColor    = $80000081;
   RPTAG_BgColor    = $80000082;
-{$ifdef aros}
+
 // Extensions invented by AROS
   RPTAG_PatternOriginX     = $800000C0; // SmallInt
   RPTAG_PatternOriginY     = $800000C1; // SmallInt
   RPTAG_ClipRectangle      = $800000C2; // PRectangle Clones PRectangle.
   RPTAG_ClipRectangleFlags = $800000C3; // LongWord
   RPTAG_RemapColorFonts    = $800000C4; // LongBool
-{$endif}
+
 
 // Flags for ClipRectangleFlags
   RPCRF_RELRIGHT  = $01; // ClipRectangle.MaxX is relative to right of layer/bitmap

+ 100 - 63
packages/arosunits/src/layers.pas

@@ -21,85 +21,122 @@ uses
 
 const
 
-    LAYERSIMPLE         = 1;
-    LAYERSMART          = 2;
-    LAYERSUPER          = 4;
-    LAYERUPDATING       = $10;
-    LAYERBACKDROP       = $40;
-    LAYERREFRESH        = $80;
-    LAYER_CLIPRECTS_LOST = $100;        { during BeginUpdate }
-                                        { or during layerop }
-                                        { this happens if out of memory }
-    LMN_REGION          = -1;
+  LAYERSIMPLE          = 1 shl 0;
+  LAYERSMART           = 1 shl 1;
+  LAYERSUPER           = 1 shl 2;
+  LAYERUPDATING        = 1 shl 4;
+  LAYERBACKDROP        = 1 shl 6;
+  LAYERREFRESH         = 1 shl 7;
+  LAYER_CLIPRECTS_LOST = 1 shl 8;  // during BeginUpdate or during layerop this happens if out of memory
+  LAYERIREFRESH        = 1 shl 9;
+  LAYERIREFRESH2       = 1 shl 10;
+
+  LMN_REGION           = -1;
 
 type
- PLayer_Info = ^TLayer_Info;
- TLayer_Info = record
-    top_layer           : PLayer;
-    check_lp            : PLayer;              { !! Private !! }
-    obs                 : PClipRect;
-    FreeClipRects       : PClipRect;              { !! Private !! }
-    PrivateReserve1,                            { !! Private !! }
-    PrivateReserve2     : LongInt;              { !! Private !! }
-    Lock                : TSignalSemaphore;      { !! Private !! }
-    gs_Head             : TMinList;              { !! Private !! }
-    PrivateReserve3     : SmallInt;                 { !! Private !! }
-    PrivateReserve4     : Pointer;              { !! Private !! }
-    Flags               : WORD;
-    fatten_count        : Shortint;                 { !! Private !! }
-    LockLayersCount     : Shortint;                 { !! Private !! }
-    PrivateReserve5     : SmallInt;                 { !! Private !! }
-    BlankHook,                                  { !! Private !! }
-    LayerInfo_extra     : Pointer;              { !! Private !! }
- end;
+  PLayer_Info = ^TLayer_Info;
+  TLayer_Info = record
+    top_layer      : PLayer;
+    check_lp       : PLayer;               // Private
+    obs            : PClipRect;
+    FreeClipRects  : PClipRect;            // Private
+    PrivateReserve1,                       // Private
+    PrivateReserve2: LongInt;              // Private
+    Lock           : TSignalSemaphore;     // Private
+    gs_Head        : TMinList;             // Private
+    PrivateReserve3: SmallInt;             // Private
+    PrivateReserve4: Pointer;              // Private
+    Flags          : Word;
+    fatten_count   : Shortint;             // Private
+    LockLayersCount: Shortint;             // Private
+    PrivateReserve5: SmallInt;             // Private
+    BlankHook,                             // Private
+    LayerInfo_extra: Pointer;              // Private
+  end;
+
+  // Backfill hook message
+  TBackFillMessage = record
+    Layer: PLayer;
+    Bounds: TRectangle;
+    OffsetX: LongInt;
+    OffsetY: LongInt;
+  end;
+  PBackFillMessage = ^TBackFillMessage;
 
 const
-    NEWLAYERINFO_CALLED = 1;
-
-{
- * LAYERS_NOBACKFILL is the value needed to get no backfill hook
- * LAYERS_BACKFILL is the value needed to get the default backfill hook
- }
- LAYERS_NOBACKFILL      = 1;
- LAYERS_BACKFILL        = 0;
-
- LAYERSNAME : PChar = 'layers.library';
+  NEWLAYERINFO_CALLED = 1;
+
+  LAYERS_NOBACKFILL      = 1; // is the value needed to get no backfill hook
+  LAYERS_BACKFILL        = 0; // is the value needed to get the default backfill hook
+
+  // LayerInfo Flag
+  LIFLG_SUPPORTS_OFFSCREEN_LAYERS = 1 shl 8; // Same flag as AmigaOS hack PowerWindowsNG
+
+  // Tags for CreateLayerTagList
+
+  // AmigaOS4-compatible
+  LA_ShapeRegion = TAG_USER + 99 + 105; // ABI_V0 compatibility
+  LA_ShapeHook   = TAG_USER + 35;       // PRegion. Default is nil (rectangular shape)
+  LA_InFrontOf   = TAG_USER + 99 + 102; // ABI_V0 compatibility
+  LA_Hidden      = TAG_USER + 41;       // LongBool. Default is False
+  // MorphOS-compatible
+  LA_Dummy        = TAG_USER + 1024;
+  LA_BackfillHook = LA_Dummy + 1;       // PHook. Default is LAYERS_BACKFILL
+  LA_TransRegion  = LA_Dummy + 2;       // PRegion. Default is nil (rectangular shape)
+  LA_TransHook    = LA_Dummy + 3;
+  LA_WindowPtr    = LA_Dummy + 4;
+  LA_SuperBitMap  = TAG_USER + 99 + 14; // PBitMap. Default is nil (none) ABI_V0 compatibility
+  // AROS-specific
+  LA_AROS    = TAG_USER + 1234;
+  LA_Behind  = TAG_USER + 99 + 103; // ABI_V0 compatibility
+  LA_ChildOf = TAG_USER + 99 + 101; // ABI_V0 compatibility
+
+  LAYERSNAME : PChar = 'layers.library';
 
 var
   LayersBase : PLibrary;
 
-function BeginUpdate(Layer: PLayer): LongInt; syscall LayersBase 13; 
-function BehindLayer(dummy: LongInt; Layer: PLayer): LongInt; syscall LayersBase 9;
-function CreateBehindHookLayer(LayerInfo: PLayer_Info; Bitmap1: PBitMap; x0: LongInt; y0: LongInt; x1: LongInt; y1: LongInt; Flags: LongInt; Hook: PHook; SuperBitmap2: PBitMap): PLayer; syscall LayersBase 32;
-function CreateBehindLayer(LayerInfo: PLayer_Info; Bitmap1: PBitMap; x0: LongInt; y0: LongInt; x1: LongInt; y1: LongInt; Flags: LongInt; SuperBitmap2: PBitMap): PLayer; syscall LayersBase 7;
-function CreateUpfrontHookLayer(LayerInfo: PLayer_Info; Bitmap1: PBitMap; x0: LongInt; y0: LongInt; x1: LongInt; y1: LongInt; Flags: LongInt; Hook: PHook; SuperBitmap2: PBitMap): PLayer; syscall LayersBase 31;
+procedure InitLayers(LayerInfo: PLayer_Info); syscall LayersBase 5;
 function CreateUpfrontLayer(LayerInfo: PLayer_Info; Bitmap1: PBitMap; x0: LongInt; y0: LongInt; x1: LongInt; y1: LongInt; Flags: LongInt; SuperBitmap2: PBitMap): PLayer; syscall LayersBase 6;
+function CreateBehindLayer(LayerInfo: PLayer_Info; Bitmap1: PBitMap; x0: LongInt; y0: LongInt; x1: LongInt; y1: LongInt; Flags: LongInt; SuperBitmap2: PBitMap): PLayer; syscall LayersBase 7;
+function UpfrontLayer(dummy: LongInt; Layer: PLayer): LongInt; syscall LayersBase 8;
+function BehindLayer(dummy: LongInt; Layer: PLayer): LongInt; syscall LayersBase 9;
+function MoveLayer(dummy: LongInt; Layer: PLayer; dx: LongInt; dy: LongInt): LongInt; syscall LayersBase 10;
+function SizeLayer(dummy: LongInt; Layer: PLayer; dx: LongInt; dy: LongInt): LongInt; syscall LayersBase 11;
+procedure ScrollLayer(dummy: LongInt; Layer: PLayer; dx: LongInt; dy: LongInt); syscall LayersBase 12;
+function BeginUpdate(Layer: PLayer): LongInt; syscall LayersBase 13;
+procedure EndUpdate(Layer: PLayer; Flag: LongWord); syscall LayersBase 14;
 function DeleteLayer(dummy: LongInt; Layer: PLayer): LongInt; syscall LayersBase 15;
+procedure LockLayer(dummy: LongInt; Layer: PLayer); syscall LayersBase 16;
+procedure UnlockLayer(Layer: PLayer); syscall LayersBase 17;
+procedure LockLayers(LayerInfo: PLayer_Info); syscall LayersBase 18;
+procedure UnlockLayers(LayerInfo: PLayer_Info); syscall LayersBase 19;
+procedure LockLayerInfo(LayerInfo: PLayer_Info); syscall LayersBase 20;
+procedure SwapBitsRastPortClipRect(rp: PRastPort; cr: PClipRect); syscall LayersBase  21;
+function WhichLayer(LayerInfo: PLayer_Info; x: LongInt; y: LongInt): PLayer; syscall LayersBase 22;
+procedure UnlockLayerInfo(LayerInfo: PLayer_Info); syscall LayersBase 23;
+function NewLayerInfo: PLayer_Info; syscall LayersBase 24;
 procedure DisposeLayerInfo(LayerInfo: PLayer_Info); syscall LayersBase 25;
-procedure DoHookClipRects(Hook: PHook; RPort: PRastPort;const Rect: PRectangle); syscall LayersBase 36;
-procedure EndUpdate(Layer: PLayer; Flag: LongWord); syscall LayersBase 14;
 function FattenLayerInfo(LayerInfo: PLayer_Info): LongInt; syscall LayersBase 26;
-procedure InitLayers(LayerInfo: PLayer_Info); syscall LayersBase 5;
+procedure ThinLayerInfo(LayerInfo: PLayer_Info); syscall LayersBase 27;
+function MoveLayerInFrontOf(layer_to_move: PLayer; other_layer: PLayer): LongInt; syscall LayersBase 28;
 function InstallClipRegion(Layer: PLayer; const Region: PRegion): PRegion;  syscall LayersBase 29;
+function MoveSizeLayer(Layer: PLayer; dx: LongInt; dy: LongInt; dw: LongInt; dh: LongInt): LongInt; syscall LayersBase 30;
+function CreateUpfrontHookLayer(LayerInfo: PLayer_Info; Bitmap1: PBitMap; x0: LongInt; y0: LongInt; x1: LongInt; y1: LongInt; Flags: LongInt; Hook: PHook; SuperBitmap2: PBitMap): PLayer; syscall LayersBase 31;
+function CreateBehindHookLayer(LayerInfo: PLayer_Info; Bitmap1: PBitMap; x0: LongInt; y0: LongInt; x1: LongInt; y1: LongInt; Flags: LongInt; Hook: PHook; SuperBitmap2: PBitMap): PLayer; syscall LayersBase 32;
 function InstallLayerHook(Layer: PLayer; Hook: PHook): PHook;  syscall LayersBase 33;
 function InstallLayerInfoHook(LayerInfo: PLayer_Info; const Hook: PHook): PHook; syscall LayersBase 34;
-procedure LockLayer(dummy: LongInt; Layer: PLayer); syscall LayersBase 16;
-procedure LockLayerInfo(LayerInfo: PLayer_Info); syscall LayersBase 20;
-procedure LockLayers(LayerInfo: PLayer_Info); syscall LayersBase 18;
-function MoveLayer(dummy: LongInt; Layer: PLayer; dx: LongInt; dy: LongInt): LongInt; syscall LayersBase 10;
-function MoveLayerInFrontOf(layer_to_move: PLayer; other_layer: PLayer): LongInt; syscall LayersBase 28;
-function MoveSizeLayer(Layer: PLayer; dx: LongInt; dy: LongInt; dw: LongInt; dh: LongInt): LongInt; syscall LayersBase 30;
-function NewLayerInfo: PLayer_Info; syscall LayersBase 24;
-procedure ScrollLayer(dummy: LongInt; Layer: PLayer; dx: LongInt; dy: LongInt); syscall LayersBase 12;
-function SizeLayer(dummy: LongInt; Layer: PLayer; dx: LongInt; dy: LongInt): LongInt; syscall LayersBase 11; 
 procedure SortLayerCR(Layer: PLayer; dx: LongInt; dy: LongInt); syscall LayersBase 35;
-procedure SwapBitsRastPortClipRect(rp: PRastPort; cr: PClipRect); syscall LayersBase  21;
-procedure ThinLayerInfo(LayerInfo: PLayer_Info); syscall LayersBase 27;
-procedure UnlockLayer(Layer: PLayer); syscall LayersBase 17;
-procedure UnlockLayerInfo(LayerInfo: PLayer_Info); syscall LayersBase 23;
-procedure UnlockLayers(LayerInfo: PLayer_Info); syscall LayersBase 19;
-function UpfrontLayer(dummy: LongInt; Layer: PLayer): LongInt; syscall LayersBase 8;
-function WhichLayer(LayerInfo: PLayer_Info; x: LongInt; y: LongInt): PLayer; syscall LayersBase 22;
+procedure DoHookClipRects(Hook: PHook; RPort: PRastPort;const Rect: PRectangle); syscall LayersBase 36;
+function ChangeLayerVisibility(Layer: PLayer; Visible: LongInt): LongInt; syscall LayersBase 37;
+function ScaleLayer(Layer: PLayer; Taglist: PTagItem): LongWord; syscall LayersBase 38;
+function CreateUpfrontLayerTagList(LayerInfo: PLayer_Info; Bitmap1: PBitMap; x0: LongInt; y0: LongInt; x1: LongInt; y1: LongInt; Flags: LongInt; TagList: PTagItem): PLayer; syscall LayersBase 39;
+function IsLayerVisible(Layer: PLayer): LongInt; syscall LayersBase 40;
+function ChangeLayerShape(Layer: PLayer; NewShape: PRegion; CallBack: PHook): PRegion; syscall LayersBase 41;
+function CreateBehindLayer(LayerInfo: PLayer_Info; Bitmap1: PBitMap; x0: LongInt; y0: LongInt; x1: LongInt; y1: LongInt; Flags: LongInt; TagList: PTagItem): PLayer; syscall LayersBase 43;
+function IsLayerHiddenBySibling(Layer: PLayer; Check_Visible: WordBool): WordBool; syscall LayersBase 44;
+procedure CollectPixelsLayer(Layer: PLayer; Region: PRegion; CallBack: PHook); syscall LayersBase 45;
+
 
 implementation
 

+ 8 - 0
packages/aspell/Makefile

@@ -607,10 +607,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 8 - 0
packages/bfd/Makefile

@@ -607,10 +607,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 8 - 0
packages/bzip2/Makefile

@@ -607,10 +607,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 8 - 0
packages/cairo/Makefile

@@ -607,10 +607,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 8 - 0
packages/cdrom/Makefile

@@ -607,10 +607,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 8 - 0
packages/chm/Makefile

@@ -607,10 +607,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 8 - 0
packages/cocoaint/Makefile

@@ -607,10 +607,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 8 - 0
packages/dblib/Makefile

@@ -607,10 +607,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 8 - 0
packages/dbus/Makefile

@@ -607,10 +607,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 8 - 0
packages/dts/Makefile

@@ -607,10 +607,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 8 - 0
packages/fastcgi/Makefile

@@ -607,10 +607,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 8 - 0
packages/fcl-async/Makefile

@@ -607,10 +607,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 8 - 0
packages/fcl-base/Makefile

@@ -607,10 +607,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 8 - 0
packages/fcl-db/Makefile

@@ -607,10 +607,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 17 - 14
packages/fcl-db/src/sdf/sdfdata.pp

@@ -378,9 +378,14 @@ begin
   FFileName := Value;
 end;
 
+function FieldDefDataSize(fd:TFieldDef):integer;
+begin
+  result:=fd.Size*fd.CharSize+1;
+end;
+
 procedure TFixedFormatDataSet.InternalInitFieldDefs;
 var
-  i, Len, MaxLen :Integer;
+  i, Len, DataLen, MaxLen :Integer;
   LstFields      :TStrings;
   FEnc : TSystemCodePage;
 
@@ -410,12 +415,11 @@ begin
         Fenc:=FEncoding.CodePage
       else
         FEnc:=DefaultSystemCodePage;
-      FieldDefs.Add(Trim(LstFields.Names[i]), ftString, Len, 0, False,False,FieldDefs.Count+1,FEnc);
-      Inc(Len);
+      DataLen:=FieldDefDataSize(FieldDefs.Add(Trim(LstFields.Names[i]), ftString, Len, 0, False,False,FieldDefs.Count+1,FEnc));
 {$IFDEF FPC_REQUIRES_PROPER_ALIGNMENT}
-      Len := Align(Len, SizeOf(PtrInt));
+      DataLen := Align(DataLen, SizeOf(PtrInt));
 {$ENDIF}
-      Inc(FRecordSize, Len);
+      Inc(FRecordSize, DataLen);
     end;
   finally
     LstFields.Free;
@@ -696,7 +700,7 @@ begin
       Result := RecBuf < StrEnd(RecBuf); // just ''=Null
       if Result and Assigned(Buffer) then
       begin
-        StrLCopy(Buffer, RecBuf, Field.Size);
+        StrLCopy(Buffer, RecBuf, Field.DataSize);
         if FTrimSpace then // trim trailing spaces
         begin
           BufEnd := StrEnd(Buffer);
@@ -759,7 +763,7 @@ begin
   i := 1;
   while (i < FieldNo) and (i < FieldDefs.Count) do
   begin
-    Len := FieldDefs.Items[i-1].Size + 1;
+    Len := FieldDefDataSize(FieldDefs[i-1]);
 {$IFDEF FPC_REQUIRES_PROPER_ALIGNMENT}
     Len := Align(Len, SizeOf(PtrInt));
 {$ENDIF}
@@ -912,7 +916,7 @@ begin
   Dest := PChar(Result);
   for i := 0 to FieldDefs.Count - 1 do
   begin
-    Len := FieldDefs[i].Size;
+    Len := FieldDefDataSize(FieldDefs[i])-1;
     Move(Src^, Dest^, Len);
     Inc(Src, Len);
     Inc(Dest, Len);
@@ -928,14 +932,14 @@ begin
   // calculate fixed length record size
   Len := 0;
   for i := 0 to FieldDefs.Count - 1 do
-    Inc(Len, FieldDefs[i].Size);
+    Inc(Len, FieldDefDataSize(FieldDefs[i])-1);
   SetLength(Result, Len);
 
   Src  := PChar(Buffer);
   Dest := PChar(Result);
   for i := 0 to FieldDefs.Count - 1 do
   begin
-    Len := FieldDefs[i].Size;
+    Len := FieldDefDataSize(FieldDefs[i])-1;
     Move(Src^, Dest^, Len);
     // fields in record buffer are null-terminated, but pad them with spaces to fixed length
     SrcLen := StrLen(Src);
@@ -1142,7 +1146,7 @@ begin
 
   for i := 0 to FieldDefs.Count - 1 do
   begin
-    MaxLen := FieldDefs[i].Size;
+    MaxLen := FieldDefDataSize(FieldDefs[i])-1;
     S := ExtractDelimited(Source, Pos);
     Len := Length(S);
 
@@ -1152,8 +1156,7 @@ begin
     if Len = 0 then // bug in StrPLCopy
       Dest^ := #0
     else
-      StrPLCopy(Dest, S, Len); // null-terminate
-
+      StrPLCopy(Dest, S, Len+1); // null-terminate
     Inc(Dest, MaxLen+1);
    end;
 end;
@@ -1173,7 +1176,7 @@ begin
   Src := PChar(Buffer);
   for i := 0 to FieldDefs.Count - 1 do
   begin
-    MaxLen := FieldDefs[i].Size;
+    MaxLen := FieldDefDataSize(FieldDefs[i])-1;
     Len := StrLen(Src); // field values are null-terminated in record buffer
     if Len > MaxLen then
       Len := MaxLen;

+ 8 - 0
packages/fcl-extra/Makefile

@@ -607,10 +607,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 8 - 0
packages/fcl-fpcunit/Makefile

@@ -607,10 +607,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 8 - 0
packages/fcl-image/Makefile

@@ -607,10 +607,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 8 - 0
packages/fcl-js/Makefile

@@ -607,10 +607,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 8 - 0
packages/fcl-json/Makefile

@@ -607,10 +607,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 1 - 1
packages/fcl-json/src/jsonconf.pp

@@ -31,7 +31,7 @@ uses
   SysUtils, Classes, fpjson, jsonscanner, jsonparser;
 
 Const
-  DefaultJSONOptions = [joUTF8,joComments];
+  DefaultJSONOptions = [joUTF8,joComments,joBOMCheck];
 
 type
   EJSONConfigError = class(Exception);

+ 17 - 1
packages/fcl-json/src/jsonscanner.pp

@@ -51,7 +51,7 @@ type
 
   EScannerError = class(EParserError);
 
-  TJSONOption = (joUTF8,joStrict,joComments,joIgnoreTrailingComma,joIgnoreDuplicates);
+  TJSONOption = (joUTF8,joStrict,joComments,joIgnoreTrailingComma,joIgnoreDuplicates,joBOMCheck);
   TJSONOptions = set of TJSONOption;
 
 Const
@@ -141,10 +141,26 @@ end;
 
 constructor TJSONScanner.Create(Source: TStream; AOptions: TJSONOptions);
 
+  procedure SkipStreamBOM;
+  Var
+    OldPos : integer;
+    Header : array[0..3] of byte;
+  begin
+    OldPos := Source.Position;
+    FillChar(Header, SizeOf(Header), 0);
+    if Source.Read(Header, 3) = 3 then
+      if (Header[0]=$EF) and (Header[1]=$BB) and (Header[2]=$BF) then
+        exit;
+    Source.Position := OldPos;
+  end;
+
+
 Var
   S : RawByteString;
 
 begin
+  if (joBOMCheck in aOptions) then
+    SkipStreamBom;
   S:='';
   SetLength(S,Source.Size-Source.Position);
   if Length(S)>0 then

+ 8 - 0
packages/fcl-net/Makefile

@@ -607,10 +607,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 8 - 0
packages/fcl-passrc/Makefile

@@ -607,10 +607,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 6 - 2
packages/fcl-passrc/src/pparser.pp

@@ -5495,8 +5495,12 @@ begin
         else
           // remove legacy or basesysv on MorphOS syscalls
           begin
-          if CurTokenIsIdentifier('legacy') or CurTokenIsIdentifier('consoledevice')
-             or (Curtoken=tkIdentifier) and (Pos('base',LowerCase(CurtokenText))>0) then
+          if (Pos('sysv',LowerCase(CurtokenText))>0) or CurTokenIsIdentifier('legacy') then
+            NextToken; 
+          // remove LibBase (Amiga, AROS, MorphOS)  or Interface (OS4)
+          if CurTokenIsIdentifier('consoledevice') or
+              ((Curtoken=tkIdentifier) and (Pos('base',LowerCase(CurtokenText)) > 0)) or 
+              ((Curtoken=tkIdentifier) and (CurtokenText[1] = 'I')) then
             NextToken;
           end;
       end;

+ 8 - 0
packages/fcl-pdf/Makefile

@@ -631,10 +631,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 8 - 0
packages/fcl-process/Makefile

@@ -631,10 +631,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 8 - 0
packages/fcl-registry/Makefile

@@ -607,10 +607,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 8 - 0
packages/fcl-report/Makefile

@@ -607,10 +607,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 8 - 0
packages/fcl-res/Makefile

@@ -607,10 +607,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 8 - 0
packages/fcl-sdo/Makefile

@@ -607,10 +607,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 8 - 0
packages/fcl-sound/Makefile

@@ -607,10 +607,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 8 - 0
packages/fcl-stl/Makefile

@@ -607,10 +607,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 8 - 0
packages/fcl-web/Makefile

@@ -607,10 +607,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 8 - 0
packages/fcl-xml/Makefile

@@ -607,10 +607,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 8 - 0
packages/fftw/Makefile

@@ -607,10 +607,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 8 - 0
packages/fpgtk/Makefile

@@ -607,10 +607,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 8 - 0
packages/fpindexer/Makefile

@@ -607,10 +607,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 8 - 0
packages/fpmkunit/Makefile

@@ -647,10 +647,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 8 - 0
packages/fppkg/Makefile

@@ -607,10 +607,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 8 - 0
packages/fuse/Makefile

@@ -607,10 +607,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 8 - 0
packages/fv/Makefile

@@ -607,10 +607,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 8 - 0
packages/gdbint/Makefile

@@ -607,10 +607,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 8 - 0
packages/gdbm/Makefile

@@ -607,10 +607,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 8 - 0
packages/ggi/Makefile

@@ -607,10 +607,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 8 - 0
packages/gmp/Makefile

@@ -607,10 +607,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 8 - 0
packages/gnome1/Makefile

@@ -607,10 +607,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 8 - 0
packages/gnutls/Makefile

@@ -607,10 +607,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 8 - 0
packages/googleapi/Makefile

@@ -607,10 +607,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 8 - 0
packages/graph/Makefile

@@ -607,10 +607,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 8 - 0
packages/gtk1/Makefile

@@ -607,10 +607,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 8 - 0
packages/gtk2/Makefile

@@ -607,10 +607,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 8 - 0
packages/hash/Makefile

@@ -631,10 +631,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 8 - 0
packages/hermes/Makefile

@@ -607,10 +607,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 8 - 0
packages/httpd13/Makefile

@@ -607,10 +607,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 8 - 0
packages/httpd20/Makefile

@@ -607,10 +607,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 8 - 0
packages/httpd22/Makefile

@@ -607,10 +607,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 8 - 0
packages/httpd24/Makefile

@@ -607,10 +607,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 8 - 0
packages/ibase/Makefile

@@ -607,10 +607,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 8 - 0
packages/iconvenc/Makefile

@@ -607,10 +607,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 8 - 0
packages/ide/Makefile

@@ -616,10 +616,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 8 - 0
packages/imagemagick/Makefile

@@ -607,10 +607,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

+ 8 - 0
packages/imlib/Makefile

@@ -607,10 +607,18 @@ else
 ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),)
 FPCMAKE_CROSSGCCOPT=-mabi=32
 else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),)
+FPCMAKE_CROSSGCCOPT=-mabi=lp64
+else
+ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),)
+FPCMAKE_CROSSGCCOPT=-mabi=ilp32
+else
 FPCMAKE_CROSSGCCOPT=-m32
 endif
 endif
 endif
+endif
+endif
 FPCMAKEGCCLIBDIR:=$(shell dirname `gcc $(FPCMAKE_CROSSGCCOPT) -print-libgcc-file-name`)
 endif
 endif

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio