Przeglądaj źródła

Update FreeBSD/PowerPC64 context mappings.

Curtis Hamilton 1 miesiąc temu
rodzic
commit
dd5c25c2bc
85 zmienionych plików z 1274 dodań i 111 usunięć
  1. 9 8
      compiler/arm/cpuinfo.pas
  2. 59 31
      compiler/loongarch64/cgcpu.pas
  3. 2 2
      packages/fcl-base/src/fpexprpars.pp
  4. 155 0
      packages/fcl-base/src/syncobjs.pp
  5. 10 0
      rtl/aix/Makefile
  6. 10 0
      rtl/amiga/Makefile
  7. 23 2
      rtl/android/Makefile
  8. 6 0
      rtl/android/Makefile.fpc
  9. 13 0
      rtl/aros/Makefile
  10. 4 0
      rtl/aros/Makefile.fpc
  11. 10 0
      rtl/atari/Makefile
  12. 10 0
      rtl/beos/Makefile
  13. 0 0
      rtl/bsd/powerpc64/.gitkeep
  14. 3 0
      rtl/darwin/Makefile
  15. 10 0
      rtl/dragonfly/Makefile
  16. 14 4
      rtl/embedded/Makefile
  17. 4 5
      rtl/embedded/Makefile.fpc
  18. 10 0
      rtl/emx/Makefile
  19. 12 0
      rtl/freebsd/Makefile
  20. 3 0
      rtl/freebsd/Makefile.fpc
  21. 2 3
      rtl/freebsd/powerpc64/sighnd.inc
  22. 65 0
      rtl/freebsd/powerpc64/sighndh.inc
  23. 3 3
      rtl/freebsd/signal.inc
  24. 24 24
      rtl/freebsd/ucontexth.inc
  25. 11 1
      rtl/freertos/Makefile
  26. 1 1
      rtl/freertos/Makefile.fpc
  27. 13 0
      rtl/gba/Makefile
  28. 4 0
      rtl/gba/Makefile.fpc
  29. 10 0
      rtl/go32v2/Makefile
  30. 10 0
      rtl/haiku/Makefile
  31. 10 0
      rtl/human68k/Makefile
  32. 6 1
      rtl/inc/Makefile.rtl
  33. 11 0
      rtl/inc/generic.inc
  34. 23 2
      rtl/inc/objpas.inc
  35. 7 1
      rtl/inc/objpash.inc
  36. 10 0
      rtl/java/Makefile
  37. 3 0
      rtl/linux/Makefile
  38. 10 0
      rtl/macos/Makefile
  39. 10 0
      rtl/morphos/Makefile
  40. 10 0
      rtl/msdos/Makefile
  41. 10 0
      rtl/msxdos/Makefile
  42. 10 0
      rtl/nativent/Makefile
  43. 13 0
      rtl/nds/Makefile
  44. 4 0
      rtl/nds/Makefile.fpc
  45. 13 0
      rtl/netbsd/Makefile
  46. 3 1
      rtl/netbsd/Makefile.fpc
  47. 10 0
      rtl/netware/Makefile
  48. 10 0
      rtl/netwlibc/Makefile
  49. 1 1
      rtl/objpas/classes/compon.inc
  50. 10 0
      rtl/openbsd/Makefile
  51. 10 0
      rtl/os2/Makefile
  52. 13 0
      rtl/palmos/Makefile
  53. 5 1
      rtl/palmos/Makefile.fpc
  54. 1 1
      rtl/powerpc64/math.inc
  55. 10 0
      rtl/ps1/Makefile
  56. 10 0
      rtl/sinclairql/Makefile
  57. 10 0
      rtl/solaris/Makefile
  58. 11 1
      rtl/symbian/Makefile
  59. 1 1
      rtl/symbian/Makefile.fpc
  60. 3 0
      rtl/unix/classes.pp
  61. 10 0
      rtl/wasip1/Makefile
  62. 10 0
      rtl/wasip1threads/Makefile
  63. 10 0
      rtl/wasip2/Makefile
  64. 10 0
      rtl/watcom/Makefile
  65. 10 0
      rtl/wii/Makefile
  66. 1 1
      rtl/win/sysutils.pp
  67. 10 0
      rtl/win16/Makefile
  68. 10 0
      rtl/win32/Makefile
  69. 3 0
      rtl/win32/classes.pp
  70. 13 0
      rtl/win64/Makefile
  71. 3 0
      rtl/win64/Makefile.fpc
  72. 3 0
      rtl/win64/classes.pp
  73. 13 0
      rtl/wince/Makefile
  74. 3 0
      rtl/wince/Makefile.fpc
  75. 3 0
      rtl/wince/classes.pp
  76. 10 0
      rtl/zxspectrum/Makefile
  77. 16 0
      tests/tppu/changeinlinebody/changed/testcib_bird.pas
  78. 1 0
      tests/tppu/changeinlinebody/lib/.gitignore
  79. 16 0
      tests/tppu/changeinlinebody/original/testcib_bird.pas
  80. 1 0
      tests/tppu/changeinlinebody/pkg/lib/readme.txt
  81. 11 0
      tests/tppu/changeinlinebody/pkg/testcib_ant.pas
  82. 19 0
      tests/tppu/changeinlinebody/testcib_elk.pas
  83. 6 0
      tests/tppu/changeinlinebody/testcib_prog.pas
  84. 107 16
      tests/tppu/tcrecompile.pas
  85. 207 0
      utils/fpdoc/newcss.inc

+ 9 - 8
compiler/arm/cpuinfo.pas

@@ -1102,7 +1102,8 @@ Const
        CPUARM_HAS_THUMB_IDIV,
        CPUARM_HAS_THUMB2,
        CPUARM_HAS_UMULL,
-       CPUARM_HAS_EXTENDED_CONSTANTS  { has MOVW and MOVT instructions                    }
+       CPUARM_HAS_EXTENDED_CONSTANTS,  { has MOVW and MOVT instructions                    }
+       CPUARM_HAS_MP_INSTRUCTIONS { architecture has yield, sev, wfi, wfe }
       );
 
    tfpuflags =
@@ -1129,16 +1130,16 @@ Const
        { cpu_armv5te  } [CPUARM_HAS_THUMB,CPUARM_HAS_ALL_MEM,CPUARM_HAS_BX,CPUARM_HAS_BLX,CPUARM_HAS_BLX_LABEL,CPUARM_HAS_CLZ,CPUARM_HAS_EDSP,CPUARM_HAS_UMULL],
        { cpu_armv5tej } [CPUARM_HAS_THUMB,CPUARM_HAS_ALL_MEM,CPUARM_HAS_BX,CPUARM_HAS_BLX,CPUARM_HAS_BLX_LABEL,CPUARM_HAS_CLZ,CPUARM_HAS_EDSP,CPUARM_HAS_UMULL],
        { cpu_armv6    } [CPUARM_HAS_ALL_MEM,CPUARM_HAS_BX,CPUARM_HAS_BLX,CPUARM_HAS_BLX_LABEL,CPUARM_HAS_CLZ,CPUARM_HAS_EDSP,CPUARM_HAS_REV,CPUARM_HAS_LDREX,CPUARM_HAS_UMULL],
-       { cpu_armv6k   } [CPUARM_HAS_ALL_MEM,CPUARM_HAS_BX,CPUARM_HAS_BLX,CPUARM_HAS_BLX_LABEL,CPUARM_HAS_CLZ,CPUARM_HAS_EDSP,CPUARM_HAS_REV,CPUARM_HAS_LDREX,CPUARM_HAS_UMULL],
-       { cpu_armv6t2  } [CPUARM_HAS_THUMB,CPUARM_HAS_ALL_MEM,CPUARM_HAS_BX,CPUARM_HAS_BLX,CPUARM_HAS_BLX_LABEL,CPUARM_HAS_CLZ,CPUARM_HAS_EDSP,CPUARM_HAS_REV,CPUARM_HAS_RBIT,CPUARM_HAS_LDREX,CPUARM_HAS_THUMB2,CPUARM_HAS_UMULL],
+       { cpu_armv6k   } [CPUARM_HAS_ALL_MEM,CPUARM_HAS_BX,CPUARM_HAS_BLX,CPUARM_HAS_BLX_LABEL,CPUARM_HAS_CLZ,CPUARM_HAS_EDSP,CPUARM_HAS_REV,CPUARM_HAS_LDREX,CPUARM_HAS_UMULL,CPUARM_HAS_MP_INSTRUCTIONS],
+       { cpu_armv6t2  } [CPUARM_HAS_THUMB,CPUARM_HAS_ALL_MEM,CPUARM_HAS_BX,CPUARM_HAS_BLX,CPUARM_HAS_BLX_LABEL,CPUARM_HAS_CLZ,CPUARM_HAS_EDSP,CPUARM_HAS_REV,CPUARM_HAS_RBIT,CPUARM_HAS_LDREX,CPUARM_HAS_THUMB2,CPUARM_HAS_UMULL,CPUARM_HAS_MP_INSTRUCTIONS],
        { cpu_armv6z   } [CPUARM_HAS_THUMB,CPUARM_HAS_ALL_MEM,CPUARM_HAS_BX,CPUARM_HAS_BLX,CPUARM_HAS_BLX_LABEL,CPUARM_HAS_CLZ,CPUARM_HAS_EDSP,CPUARM_HAS_REV,CPUARM_HAS_LDREX,CPUARM_HAS_UMULL],
        { cpu_armv6m   } [CPUARM_HAS_THUMB,CPUARM_HAS_ALL_MEM,CPUARM_HAS_BX,CPUARM_HAS_BLX,CPUARM_HAS_REV],
        { the identifier armv7 should not be used; it is considered equal to armv7a }
-       { cpu_armv7    } [CPUARM_HAS_THUMB,CPUARM_HAS_ALL_MEM,CPUARM_HAS_BX,CPUARM_HAS_BLX,CPUARM_HAS_BLX_LABEL,CPUARM_HAS_CLZ,CPUARM_HAS_EDSP,CPUARM_HAS_REV,CPUARM_HAS_RBIT,CPUARM_HAS_LDREX,CPUARM_HAS_DMB,CPUARM_HAS_THUMB2,CPUARM_HAS_UMULL,CPUARM_HAS_EXTENDED_CONSTANTS],
-       { cpu_armv7a   } [CPUARM_HAS_THUMB,CPUARM_HAS_ALL_MEM,CPUARM_HAS_BX,CPUARM_HAS_BLX,CPUARM_HAS_BLX_LABEL,CPUARM_HAS_CLZ,CPUARM_HAS_EDSP,CPUARM_HAS_REV,CPUARM_HAS_RBIT,CPUARM_HAS_LDREX,CPUARM_HAS_DMB,CPUARM_HAS_THUMB2,CPUARM_HAS_UMULL,CPUARM_HAS_EXTENDED_CONSTANTS],
-       { cpu_armv7r   } [CPUARM_HAS_THUMB,CPUARM_HAS_ALL_MEM,CPUARM_HAS_BX,CPUARM_HAS_BLX,CPUARM_HAS_BLX_LABEL,CPUARM_HAS_CLZ,CPUARM_HAS_EDSP,CPUARM_HAS_REV,CPUARM_HAS_RBIT,CPUARM_HAS_LDREX,CPUARM_HAS_THUMB_IDIV,CPUARM_HAS_DMB,CPUARM_HAS_THUMB2,CPUARM_HAS_UMULL],
-       { cpu_armv7m   } [CPUARM_HAS_THUMB,CPUARM_HAS_ALL_MEM,CPUARM_HAS_BX,CPUARM_HAS_BLX,CPUARM_HAS_CLZ,CPUARM_HAS_EDSP,CPUARM_HAS_REV,CPUARM_HAS_RBIT,CPUARM_HAS_LDREX,CPUARM_HAS_THUMB_IDIV,CPUARM_HAS_DMB,CPUARM_HAS_THUMB2,CPUARM_HAS_UMULL],
-       { cpu_armv7em  } [CPUARM_HAS_THUMB,CPUARM_HAS_ALL_MEM,CPUARM_HAS_BX,CPUARM_HAS_BLX,CPUARM_HAS_CLZ,CPUARM_HAS_EDSP,CPUARM_HAS_REV,CPUARM_HAS_RBIT,CPUARM_HAS_LDREX,CPUARM_HAS_THUMB_IDIV,CPUARM_HAS_DMB,CPUARM_HAS_THUMB2,CPUARM_HAS_UMULL]
+       { cpu_armv7    } [CPUARM_HAS_THUMB,CPUARM_HAS_ALL_MEM,CPUARM_HAS_BX,CPUARM_HAS_BLX,CPUARM_HAS_BLX_LABEL,CPUARM_HAS_CLZ,CPUARM_HAS_EDSP,CPUARM_HAS_REV,CPUARM_HAS_RBIT,CPUARM_HAS_LDREX,CPUARM_HAS_DMB,CPUARM_HAS_THUMB2,CPUARM_HAS_UMULL,CPUARM_HAS_EXTENDED_CONSTANTS,CPUARM_HAS_MP_INSTRUCTIONS],
+       { cpu_armv7a   } [CPUARM_HAS_THUMB,CPUARM_HAS_ALL_MEM,CPUARM_HAS_BX,CPUARM_HAS_BLX,CPUARM_HAS_BLX_LABEL,CPUARM_HAS_CLZ,CPUARM_HAS_EDSP,CPUARM_HAS_REV,CPUARM_HAS_RBIT,CPUARM_HAS_LDREX,CPUARM_HAS_DMB,CPUARM_HAS_THUMB2,CPUARM_HAS_UMULL,CPUARM_HAS_EXTENDED_CONSTANTS,CPUARM_HAS_MP_INSTRUCTIONS],
+       { cpu_armv7r   } [CPUARM_HAS_THUMB,CPUARM_HAS_ALL_MEM,CPUARM_HAS_BX,CPUARM_HAS_BLX,CPUARM_HAS_BLX_LABEL,CPUARM_HAS_CLZ,CPUARM_HAS_EDSP,CPUARM_HAS_REV,CPUARM_HAS_RBIT,CPUARM_HAS_LDREX,CPUARM_HAS_THUMB_IDIV,CPUARM_HAS_DMB,CPUARM_HAS_THUMB2,CPUARM_HAS_UMULL,CPUARM_HAS_MP_INSTRUCTIONS],
+       { cpu_armv7m   } [CPUARM_HAS_THUMB,CPUARM_HAS_ALL_MEM,CPUARM_HAS_BX,CPUARM_HAS_BLX,CPUARM_HAS_CLZ,CPUARM_HAS_EDSP,CPUARM_HAS_REV,CPUARM_HAS_RBIT,CPUARM_HAS_LDREX,CPUARM_HAS_THUMB_IDIV,CPUARM_HAS_DMB,CPUARM_HAS_THUMB2,CPUARM_HAS_UMULL,CPUARM_HAS_MP_INSTRUCTIONS],
+       { cpu_armv7em  } [CPUARM_HAS_THUMB,CPUARM_HAS_ALL_MEM,CPUARM_HAS_BX,CPUARM_HAS_BLX,CPUARM_HAS_CLZ,CPUARM_HAS_EDSP,CPUARM_HAS_REV,CPUARM_HAS_RBIT,CPUARM_HAS_LDREX,CPUARM_HAS_THUMB_IDIV,CPUARM_HAS_DMB,CPUARM_HAS_THUMB2,CPUARM_HAS_UMULL,CPUARM_HAS_MP_INSTRUCTIONS]
      );
 
      fpu_capabilities : array[tfputype] of set of tfpuflags =

+ 59 - 31
compiler/loongarch64/cgcpu.pas

@@ -93,7 +93,7 @@ unit cgcpu;
         procedure g_proc_exit(list: TAsmList; parasize: longint; nostackframe: boolean); override;
 
       protected
-        function fixref(list: TAsmList; var ref: treference; mode : tfixref;out tmpreg : tregister): boolean;
+        function fixref(list: TAsmList; var ref: treference; mode : tfixref;out tmpreg, tmpreg2 : tregister): boolean;
         procedure ungetregister(r : tregister;list :TAsmList);
         procedure maybeadjustresult(list: TAsmList; op: topcg; size: tcgsize; dst: tregister);
       end;
@@ -333,7 +333,7 @@ implementation
         href: treference;
         op: TAsmOp;
         hlist: TAsmList;
-        tmpreg : tregister;
+        tmpreg,tmpreg2 : tregister;
       const
         st_ops: array[boolean,OS_8..OS_INT] of TAsmOp = (
           (A_ST_B,A_ST_H,A_ST_W,A_ST_D),
@@ -351,7 +351,7 @@ implementation
         if stptr_ops[tosize]<>A_NONE then
           begin
             href:=ref;
-            if fixref(hlist,href,fr_big,tmpreg) then
+            if fixref(hlist,href,fr_big,tmpreg,tmpreg2) then
               begin
                 list.concatList(hlist);
                 hlist.free;
@@ -359,13 +359,17 @@ implementation
                 exit;
               end
             else
-              if (tmpreg<>NR_NO) then
-                ungetregister(tmpreg,hlist);
+              begin
+                if (tmpreg<>NR_NO) then
+                  ungetregister(tmpreg,hlist);
+                if (tmpreg2<>NR_NO) then
+                  ungetregister(tmpreg2,hlist);
+              end;
           end;
         hlist.Clear;
         hlist.free;
         href:=ref;
-        op:=st_ops[fixref(list,href,fr_reg,tmpreg),tosize];
+        op:=st_ops[fixref(list,href,fr_reg,tmpreg,tmpreg2),tosize];
         list.concat(taicpu.op_reg_ref(op,reg,href));
       end;
 
@@ -378,7 +382,7 @@ implementation
         have_done: boolean;
         hlist: TAsmList;
         samesign: boolean;
-        tmpreg : tregister;
+        tmpreg, tmpreg2 : tregister;
       const
         ld_ops: array[boolean,boolean,OS_8..OS_INT] of TAsmOp = (
           ((A_LD_B,A_LD_H,A_LD_W,A_LD_D),
@@ -388,6 +392,7 @@ implementation
         );
       begin
         tmpreg:=NR_NO;
+        tmpreg2:=NR_NO;
         if not (fromsize in [OS_8..OS_INT,OS_S8..OS_SINT]) then
           internalerror(2022111938);
         if not (tosize in [OS_8..OS_INT,OS_S8..OS_SINT]) then
@@ -401,7 +406,7 @@ implementation
         if (fromsize=OS_S32) then
           begin
             href:=ref;
-            if fixref(hlist,href,fr_big,tmpreg) then
+            if fixref(hlist,href,fr_big,tmpreg,tmpreg2) then
               begin
                 hlist.concat(taicpu.op_reg_ref(A_LDPTR_W,reg,href));
                 have_done:=true;
@@ -410,7 +415,7 @@ implementation
         else if (fromsize=OS_S64) or (fromsize=OS_64) then
           begin
             href:=ref;
-            if fixref(hlist,href,fr_big,tmpreg) then
+            if fixref(hlist,href,fr_big,tmpreg,tmpreg2) then
               begin
                 hlist.concat(taicpu.op_reg_ref(A_LDPTR_D,reg,href));
                 have_done:=true;
@@ -421,9 +426,11 @@ implementation
           begin
             if (tmpreg<>NR_NO) then
               ungetregister(tmpreg,hlist);
+            if (tmpreg2<>NR_NO) then
+              ungetregister(tmpreg2,hlist);
             hlist.Clear;
             href:=ref;
-            op:=ld_ops[fixref(list,href,fr_reg,tmpreg),fromsize=usizef,usizef];
+            op:=ld_ops[fixref(list,href,fr_reg,tmpreg,tmpreg2),fromsize=usizef,usizef];
             list.concat(taicpu.op_reg_ref(op,reg,href));
           end
         else
@@ -504,10 +511,10 @@ implementation
       var
         href: treference;
         l: TAsmLabel;
-        tmpreg : tregister;
+        tmpreg, tmpreg2 : tregister;
       begin
         href:=ref;
-        fixref(list,href,fr_normal,tmpreg);
+        fixref(list,href,fr_normal,tmpreg,tmpreg2);
         { Fixref, so simplely work here. }
         if href.offset=0 then
           a_load_reg_reg(list,OS_ADDR,OS_ADDR,href.base,r)
@@ -820,7 +827,7 @@ implementation
       var
         op: TAsmOp;
         href: treference;
-        tmpreg : tregister;
+        tmpreg, tmpreg2 : tregister;
       const
         fld_ops: array[boolean,boolean] of TAsmOp = (
           (A_FLD_D, A_FLD_S),
@@ -828,7 +835,7 @@ implementation
         );
       begin
         href:=ref;
-        op:=fld_ops[fixref(list,href,fr_reg,tmpreg),fromsize=OS_F32];
+        op:=fld_ops[fixref(list,href,fr_reg,tmpreg,tmpreg2),fromsize=OS_F32];
         list.concat(taicpu.op_reg_ref(op,reg,href));
         if fromsize<>tosize then
           a_loadfpu_reg_reg(list,fromsize,tosize,reg,reg);
@@ -839,7 +846,7 @@ implementation
         op: TAsmOp;
         tmpfreg: TRegister;
         href: treference;
-        tmpreg : tregister;
+        tmpreg, tmpreg2 : tregister;
         fst_ops: array[boolean,boolean] of TAsmOp = (
           (A_FST_D, A_FST_S),
           (A_FSTX_D, A_FSTX_S)
@@ -853,7 +860,7 @@ implementation
           end;
 
         href:=ref;
-        op:=fst_ops[fixref(list,href,fr_reg,tmpreg),tosize=OS_F32];
+        op:=fst_ops[fixref(list,href,fr_reg,tmpreg,tmpreg2),tosize=OS_F32];
         list.concat(taicpu.op_reg_ref(op,reg,href));
       end;
 
@@ -1498,11 +1505,14 @@ implementation
           end;
       end;
 
-    function tcgloongarch64.fixref(list: TAsmList; var ref: treference; mode : tfixref; out tmpreg : tregister): boolean;
+    function tcgloongarch64.fixref(list: TAsmList; var ref: treference; mode : tfixref; out tmpreg, tmpreg2 : tregister): boolean;
       var
         href: treference;
+	ltmpreg : tregister;
       begin
         tmpreg:=NR_NO;
+        tmpreg2:=NR_NO;
+	result:=false;
         if ref.refaddr=addr_reg_12i then
           begin
             result:=mode=fr_normal;
@@ -1513,7 +1523,7 @@ implementation
             result:=mode=fr_reg;
             exit;
           end
-        else if ref.refaddr=addr_reg_reg then
+        else if ref.refaddr=addr_reg_14i then
           begin
             result:=mode=fr_big;
             exit;
@@ -1579,7 +1589,8 @@ implementation
           begin
             if ref.index<>NR_R0 then
               begin
-                tmpreg:=getintregister(list,OS_INT);
+                if tmpreg=NR_NO then
+                  tmpreg:=getintregister(list,OS_INT);
                 a_op_reg_reg_reg(list,OP_ADD,OS_INT,ref.base,ref.index,tmpreg);
                 ref.base:=tmpreg;
               end;
@@ -1593,7 +1604,8 @@ implementation
           begin
             if ref.index<>NR_NO then
               begin
-                tmpreg:=getintregister(list,OS_INT);
+                if tmpreg=NR_NO then
+                  tmpreg:=getintregister(list,OS_INT);
                 a_op_reg_reg_reg(list,OP_ADD,OS_INT,ref.base,ref.index,tmpreg);
                 ref.base:=tmpreg;
               end;
@@ -1607,15 +1619,21 @@ implementation
           begin
             if ref.offset<>0 then
               begin
-                tmpreg:=getintregister(list,OS_INT);
-                a_load_const_reg(list,OS_INT,ref.offset,tmpreg);
-                if ref.index<>NR_R0 then
+                if (tmpreg<>NR_NO) and (ref.index=tmpreg) then
                   begin
-                    a_op_reg_reg(list,OP_ADD,OS_INT,ref.index,tmpreg);
-                    ref.index:=tmpreg;
+                    tmpreg2:=getintregister(list,OS_INT);
+                    ltmpreg:=tmpreg2;
                   end
                 else
-                  ref.index:=tmpreg;
+                  begin
+                    if tmpreg=NR_NO then
+                      tmpreg:=getintregister(list,OS_INT);
+                    ltmpreg:=tmpreg;
+                  end;
+                a_load_const_reg(list,OS_INT,ref.offset,ltmpreg);
+                if ref.index<>NR_R0 then
+                  a_op_reg_reg(list,OP_ADD,OS_INT,ref.index,ltmpreg);
+                ref.index:=ltmpreg;
               end;
             ref.refaddr:=addr_reg_reg;
             ref.offset:=0;
@@ -1623,12 +1641,22 @@ implementation
             exit;
           end;
 
-        tmpreg:=getintregister(list,OS_INT);
-        a_load_const_reg(list,OS_INT,ref.offset,tmpreg);
+        if (tmpreg<>NR_NO) and ((tmpreg=ref.base) or (tmpreg=ref.index)) then
+          begin
+            tmpreg2:=getintregister(list,OS_INT);
+            ltmpreg:=tmpreg2;
+          end
+        else
+          begin
+            if tmpreg=NR_NO then
+              tmpreg:=getintregister(list,OS_INT);
+            ltmpreg:=tmpreg;
+          end;
+        a_load_const_reg(list,OS_INT,ref.offset,ltmpreg);
         if ref.index<>NR_R0 then
-          a_op_reg_reg(list,OP_ADD,OS_INT,ref.index,tmpreg);
-        a_op_reg_reg(list,OP_ADD,OS_INT,ref.base,tmpreg);
-        ref.base:=tmpreg;
+          a_op_reg_reg(list,OP_ADD,OS_INT,ref.index,ltmpreg);
+        a_op_reg_reg(list,OP_ADD,OS_INT,ref.base,ltmpreg);
+        ref.base:=ltmpreg;
         ref.index:=NR_NO;
         ref.offset:=0;
         result:=mode=fr_normal;

+ 2 - 2
packages/fcl-base/src/fpexprpars.pp

@@ -654,7 +654,7 @@ Type
   { TAggregateMin }
 
   TAggregateMin = Class(TAggregateExpr)
-  Public
+  Protected
     FFirst: Boolean;
   Public
     Procedure InitAggregate; override;
@@ -664,7 +664,7 @@ Type
   { TAggregateMax }
 
   TAggregateMax = Class(TAggregateExpr)
-  Public
+  Protected
     FFirst: Boolean;
   Public
     Procedure InitAggregate; override;

+ 155 - 0
packages/fcl-base/src/syncobjs.pp

@@ -13,6 +13,8 @@
  **********************************************************************}
 {$mode objfpc}
 {$modeswitch advancedrecords}
+{$modeswitch functionreferences}
+{$modeswitch anonymousfunctions}
 {$h+}
 
 {$IF DEFINED(WINCE) or DEFINED(AIX)}
@@ -41,6 +43,8 @@ uses
   {$IFDEF CPUWASM32}
   Wasm.Semaphore,
   {$ENDIF}
+  System.DateUtils,
+  System.Classes,
   System.SysUtils;
   
 {$ELSE FPC_DOTTEDUNITS}
@@ -53,6 +57,8 @@ uses
   {$IFDEF CPUWASM32}
   WasmSem,
   {$ENDIF}
+  DateUtils,
+  Classes, // TThread
   sysutils;
 {$ENDIF FPC_DOTTEDUNITS}
 
@@ -233,6 +239,46 @@ type
   TMutexGuard = specialize TLockGuard<TMutex>;
 {$ENDIF}
 
+  // Delphi compatible (hopefully) TSpinwait
+  // Uses exponential backoff for first 10 SpinCycles, uses sleep(1) every 20 and sleep(1) every 5 cycles afterwards.
+  TSpinFunction = reference to function : Boolean;
+
+  TSpinWait = record
+  private
+    FCount : Integer;
+    // Cache CPU count at program start, assuming it doesn't change
+    class var FCPUCount : LongWord;
+
+    class constructor Create;
+    function GetNextSpinCycleWillYield: Boolean;
+  public
+    procedure Reset;
+    procedure SpinCycle;
+
+    class procedure SpinUntil(const aCondition: TSpinFunction); overload; static;
+    class function SpinUntil(const aCondition: TSpinFunction; aTimeout: Cardinal): Boolean; overload; static;
+    class function SpinUntil(const aCondition: TSpinFunction; const aTimeout: TTimeSpan): Boolean; overload; static;
+    property Count: Integer read FCount;
+    property NextSpinCycleWillYield: Boolean read GetNextSpinCycleWillYield;
+  end;
+
+  // Guardian pattern. Use to see if an object was freed or not by adding a guardian instance to it.
+  
+  IGuardian = interface
+    function GetIsDismantled: Boolean;
+    procedure Dismantle;
+    property IsDismantled: Boolean read GetIsDismantled;
+  end;
+
+  TGuardian = class(TInterfacedObject, IGuardian)
+  private
+    FIsDismantled: Boolean;
+    function GetIsDismantled: Boolean;
+  public
+    procedure Dismantle;
+    property IsDismantled: Boolean read GetIsDismantled;
+  end;
+
 implementation
 
 {$ifdef MSWindows}
@@ -1082,5 +1128,114 @@ begin
   self.obj.Acquire();
 end;
 
+{ ---------------------------------------------------------------------
+  TSpinWait
+  ---------------------------------------------------------------------}
+
+class constructor TSpinWait.Create;
+begin
+  // Get the number of cores on the system once
+  FCPUCount := GetCPUCount; // Available in the System unit
+end;
+
+procedure TSpinWait.Reset;
+begin
+  FCount := 0;
+end;
+
+procedure TSpinWait.SpinCycle;
+var
+  i: Integer;
+  SpinCount: Integer;
+begin
+  // Increment cycle count
+  Inc(FCount);
+  if (FCPUCount > 1) and (FCount <= 10) then
+    begin
+    // Exponential backoff for first 10 cycles
+    // Base 2 exponentially increasing spin count starting at 4
+    SpinCount := 2 shl FCount;
+    TThread.SpinWait(SpinCount);
+    // Do not fallback to Single-CPU yet
+    exit;
+    end;
+  // Single-CPU behaviour, or large spin cycle counts:
+  // Sleep 1ms every 20 cycles
+  if (FCount mod 20) = 0 then
+    Sleep(1)
+  // Sleep 0ms every 5 cycles
+  else if (FCount mod 5) = 0 then
+    Sleep(0)
+  // All other cycles simply yield
+  else
+    TThread.Yield; // Yield execution to other threads
+end;
+
+
+function TSpinWait.GetNextSpinCycleWillYield: Boolean;
+begin
+  // If CPUCount > 1, the first 10 cycles are pure spin (no yield/sleep), so it will not yield.
+  if (FCPUCount > 1) and (FCount < 10) then
+    Exit(False);
+  // Single-CPU logic check (for FCPUCount = 1, or FCPUCount > 1 and FCount >= 10)
+  // The *next* count will be FCount + 1.
+  Result := (((FCount + 1) mod 20) <> 0) // Not a Sleep(1) cycle
+            and (((FCount + 1) mod 5) <> 0);  // Not a Sleep(0) cycle
+end;
+
+
+class procedure TSpinWait.SpinUntil(const aCondition: TSpinFunction); overload; static;
+var
+  lWait : TSpinWait;
+begin
+  // Spin indefinitely until aCondition returns True
+  lWait.Reset;
+  while not aCondition() do
+    lWait.SpinCycle;
+end;
+
+
+class function TSpinWait.SpinUntil(const aCondition: TSpinFunction; aTimeout: Cardinal): Boolean; overload;
+static;
+begin
+  SpinUntil(aCondition, TTimeSpan.FromMilliseconds(aTimeout));
+end;
+
+
+class function TSpinWait.SpinUntil(const aCondition: TSpinFunction; const aTimeout: TTimeSpan): Boolean; overload; static;
+var
+  lStartTime: TDateTime;
+  lWaitTime,lElapsedTime: Int64;
+  lWait: TSpinWait;
+begin
+  Result:=False;
+  if aCondition() then
+    Exit(True);
+  lWaitTime:=Round(aTimeout.TotalMilliseconds);
+  lWait.Reset;
+  lStartTime:=Now;
+  repeat
+    lWait.SpinCycle;
+    if aCondition() then
+      Exit(True);
+    lElapsedTime:=MilliSecondsBetween(Now,lStartTime);
+  until (lElapsedTime >= lWaitTime) or lWait.NextSpinCycleWillYield;
+end;
+
+{ ---------------------------------------------------------------------
+  TGuardian
+  ---------------------------------------------------------------------}
+
+
+procedure TGuardian.Dismantle;
+begin
+  FIsDismantled := True;
+end;
+
+function TGuardian.GetIsDismantled: Boolean;
+begin
+  Result := FIsDismantled;
+end;
+
 
 end.

+ 10 - 0
rtl/aix/Makefile

@@ -2493,6 +2493,9 @@ sysutils$(PPUEXT) : $(SYSUTILS_DEPS)
 	$(COMPILER) -Fi$(OBJPASDIR)/sysutils $<
 System.SysUtils$(PPUEXT) : $(NSINC)/System.SysUtils.pp $(SYSUTILS_DEPS)
 	$(COMPILER) $(SYSUTILS_OPT) -Fi$(OBJPASDIR)/sysutils -Fi$(SYSUTILSDIR) $<
+ifneq ($(findstring $(ARCH),aarch64 arm),)
+CLASSES_DEPS_CPU:=$(CLASSES_DEPS_CPU) $(INTRINSICSUNIT)$(PPUEXT)
+endif
 CLASSES_DEPS=$(CLASSESDIR)/classes.pp $(TTHREADINCDIR)/tthread.inc $(wildcard $(OBJPASDIR)/classes/*.inc) \
 	     $(SYSTEMUNIT)$(PPUEXT) $(OBJPASUNIT)$(PPUEXT) $(SORTBASEUNIT)$(PPUEXT) \
 	     $(SYSUTILSUNIT)$(PPUEXT) $(TYPINFOUNIT)$(PPUEXT) $(RTLCONSTSUNIT)$(PPUEXT) \
@@ -2576,6 +2579,13 @@ mmx$(PPUEXT) : $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
 System.CPU.MMX$(PPUEXT) : $(NSINC)/System.CPU.MMX.pp $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
+INTRINSICS_DEPS=$(PROCINC)/intrinsics.pp \
+	 $(SYSTEMUNIT)$(PPUEXT) \
+	 $(INTRINSICS_DEPS_OS) $(INTRINSICS_DEPS_CPU)
+intrinsics$(PPUEXT) : $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
+System.Intrinsics$(PPUEXT) : $(NSINC)/System.Intrinsics.pp $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
 ifeq ($(filter -dFPC_USE_LIBC,$(FPCOPT)),)
   X86_DEPS_OS+=$(SYSCALLUNIT)$(PPUEXT)
 endif

+ 10 - 0
rtl/amiga/Makefile

@@ -2520,6 +2520,9 @@ sysutils$(PPUEXT) : $(SYSUTILS_DEPS)
 	$(COMPILER) -Fi$(OBJPASDIR)/sysutils $<
 System.SysUtils$(PPUEXT) : $(NSINC)/System.SysUtils.pp $(SYSUTILS_DEPS)
 	$(COMPILER) $(SYSUTILS_OPT) -Fi$(OBJPASDIR)/sysutils -Fi$(SYSUTILSDIR) $<
+ifneq ($(findstring $(ARCH),aarch64 arm),)
+CLASSES_DEPS_CPU:=$(CLASSES_DEPS_CPU) $(INTRINSICSUNIT)$(PPUEXT)
+endif
 CLASSES_DEPS=$(CLASSESDIR)/classes.pp $(TTHREADINCDIR)/tthread.inc $(wildcard $(OBJPASDIR)/classes/*.inc) \
 	     $(SYSTEMUNIT)$(PPUEXT) $(OBJPASUNIT)$(PPUEXT) $(SORTBASEUNIT)$(PPUEXT) \
 	     $(SYSUTILSUNIT)$(PPUEXT) $(TYPINFOUNIT)$(PPUEXT) $(RTLCONSTSUNIT)$(PPUEXT) \
@@ -2603,6 +2606,13 @@ mmx$(PPUEXT) : $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
 System.CPU.MMX$(PPUEXT) : $(NSINC)/System.CPU.MMX.pp $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
+INTRINSICS_DEPS=$(PROCINC)/intrinsics.pp \
+	 $(SYSTEMUNIT)$(PPUEXT) \
+	 $(INTRINSICS_DEPS_OS) $(INTRINSICS_DEPS_CPU)
+intrinsics$(PPUEXT) : $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
+System.Intrinsics$(PPUEXT) : $(NSINC)/System.Intrinsics.pp $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
 ifeq ($(filter -dFPC_USE_LIBC,$(FPCOPT)),)
   X86_DEPS_OS+=$(SYSCALLUNIT)$(PPUEXT)
 endif

+ 23 - 2
rtl/android/Makefile

@@ -943,6 +943,12 @@ endif
 ifeq ($(ARCH),i386)
 CPU_UNITS+=$(MMXUNIT)
 endif
+ifeq ($(ARCH),aarch64)
+CPU_UNITS+=$(INTRINSICSUNIT)
+endif
+ifeq ($(ARCH),arm)
+CPU_UNITS+=$(INTRINSICSUNIT)
+endif
 ifdef RELEASE
 override FPCOPT+=-Ur
 endif
@@ -2108,9 +2114,14 @@ ifdef INSTALL_CREATEPACKAGEFPC
 ifdef FPCMAKE
 ifdef PACKAGE_VERSION
 ifneq ($(wildcard Makefile.fpc),)
-	$(FPCMAKE) -o Package-$(TARGETSUFFIX).fpc -p -T$(CPU_TARGET)-$(OS_TARGET) Makefile.fpc
+ifdef FPCMAKENEW
+	$(MKDIR) $(INSTALL_UNITDIR)
+	$(FPCMAKENEW) -o $(INSTALL_UNITDIR)/Package.fpc -p -T$(CPU_TARGET)-$(OS_TARGET) Makefile.fpc
+else
+	$(FPCMAKE) -p -T$(CPU_TARGET)-$(OS_TARGET) Makefile.fpc
 	$(MKDIR) $(INSTALL_UNITDIR)
-	$(INSTALL) Package-$(TARGETSUFFIX).fpc $(INSTALL_UNITDIR)/Package.fpc
+	$(INSTALL) Package.fpc $(INSTALL_UNITDIR)
+endif
 endif
 endif
 endif
@@ -2638,6 +2649,9 @@ sysutils$(PPUEXT) : $(SYSUTILS_DEPS)
 	$(COMPILER) -Fi$(OBJPASDIR)/sysutils $<
 System.SysUtils$(PPUEXT) : $(NSINC)/System.SysUtils.pp $(SYSUTILS_DEPS)
 	$(COMPILER) $(SYSUTILS_OPT) -Fi$(OBJPASDIR)/sysutils -Fi$(SYSUTILSDIR) $<
+ifneq ($(findstring $(ARCH),aarch64 arm),)
+CLASSES_DEPS_CPU:=$(CLASSES_DEPS_CPU) $(INTRINSICSUNIT)$(PPUEXT)
+endif
 CLASSES_DEPS=$(CLASSESDIR)/classes.pp $(TTHREADINCDIR)/tthread.inc $(wildcard $(OBJPASDIR)/classes/*.inc) \
 	     $(SYSTEMUNIT)$(PPUEXT) $(OBJPASUNIT)$(PPUEXT) $(SORTBASEUNIT)$(PPUEXT) \
 	     $(SYSUTILSUNIT)$(PPUEXT) $(TYPINFOUNIT)$(PPUEXT) $(RTLCONSTSUNIT)$(PPUEXT) \
@@ -2721,6 +2735,13 @@ mmx$(PPUEXT) : $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
 System.CPU.MMX$(PPUEXT) : $(NSINC)/System.CPU.MMX.pp $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
+INTRINSICS_DEPS=$(PROCINC)/intrinsics.pp \
+	 $(SYSTEMUNIT)$(PPUEXT) \
+	 $(INTRINSICS_DEPS_OS) $(INTRINSICS_DEPS_CPU)
+intrinsics$(PPUEXT) : $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
+System.Intrinsics$(PPUEXT) : $(NSINC)/System.Intrinsics.pp $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
 ifeq ($(filter -dFPC_USE_LIBC,$(FPCOPT)),)
   X86_DEPS_OS+=$(SYSCALLUNIT)$(PPUEXT)
 endif

+ 6 - 0
rtl/android/Makefile.fpc

@@ -81,6 +81,12 @@ endif
 ifeq ($(ARCH),i386)
 CPU_UNITS+=$(MMXUNIT)
 endif
+ifeq ($(ARCH),aarch64)
+CPU_UNITS+=$(INTRINSICSUNIT)
+endif
+ifeq ($(ARCH),arm)
+CPU_UNITS+=$(INTRINSICSUNIT)
+endif
 
 
 # Causes release PPU files not to be recompiled

+ 13 - 0
rtl/aros/Makefile

@@ -923,6 +923,9 @@ UNITPREFIX=rtl
 LOADERS=prt0
 SYSINIT_UNITS=si_prc
 OBJPASDIR=$(RTL)/objpas
+ifeq ($(ARCH),arm)
+CPU_UNITS=$(INTRINSICSUNIT)
+endif
 ifeq ($(ARCH),i386)
 CPU_UNITS=$(CPUUNIT) $(MMXUNIT) $(LINEINFOUNIT)
 endif
@@ -2535,6 +2538,9 @@ sysutils$(PPUEXT) : $(SYSUTILS_DEPS)
 	$(COMPILER) -Fi$(OBJPASDIR)/sysutils $<
 System.SysUtils$(PPUEXT) : $(NSINC)/System.SysUtils.pp $(SYSUTILS_DEPS)
 	$(COMPILER) $(SYSUTILS_OPT) -Fi$(OBJPASDIR)/sysutils -Fi$(SYSUTILSDIR) $<
+ifneq ($(findstring $(ARCH),aarch64 arm),)
+CLASSES_DEPS_CPU:=$(CLASSES_DEPS_CPU) $(INTRINSICSUNIT)$(PPUEXT)
+endif
 CLASSES_DEPS=$(CLASSESDIR)/classes.pp $(TTHREADINCDIR)/tthread.inc $(wildcard $(OBJPASDIR)/classes/*.inc) \
 	     $(SYSTEMUNIT)$(PPUEXT) $(OBJPASUNIT)$(PPUEXT) $(SORTBASEUNIT)$(PPUEXT) \
 	     $(SYSUTILSUNIT)$(PPUEXT) $(TYPINFOUNIT)$(PPUEXT) $(RTLCONSTSUNIT)$(PPUEXT) \
@@ -2618,6 +2624,13 @@ mmx$(PPUEXT) : $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
 System.CPU.MMX$(PPUEXT) : $(NSINC)/System.CPU.MMX.pp $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
+INTRINSICS_DEPS=$(PROCINC)/intrinsics.pp \
+	 $(SYSTEMUNIT)$(PPUEXT) \
+	 $(INTRINSICS_DEPS_OS) $(INTRINSICS_DEPS_CPU)
+intrinsics$(PPUEXT) : $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
+System.Intrinsics$(PPUEXT) : $(NSINC)/System.Intrinsics.pp $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
 ifeq ($(filter -dFPC_USE_LIBC,$(FPCOPT)),)
   X86_DEPS_OS+=$(SYSCALLUNIT)$(PPUEXT)
 endif

+ 4 - 0
rtl/aros/Makefile.fpc

@@ -47,6 +47,10 @@ SYSINIT_UNITS=si_prc
 # Paths
 OBJPASDIR=$(RTL)/objpas
 
+ifeq ($(ARCH),arm)
+CPU_UNITS=$(INTRINSICSUNIT)
+endif
+
 ifeq ($(ARCH),i386)
 CPU_UNITS=$(CPUUNIT) $(MMXUNIT) $(LINEINFOUNIT)
 endif

+ 10 - 0
rtl/atari/Makefile

@@ -2490,6 +2490,9 @@ sysutils$(PPUEXT) : $(SYSUTILS_DEPS)
 	$(COMPILER) -Fi$(OBJPASDIR)/sysutils $<
 System.SysUtils$(PPUEXT) : $(NSINC)/System.SysUtils.pp $(SYSUTILS_DEPS)
 	$(COMPILER) $(SYSUTILS_OPT) -Fi$(OBJPASDIR)/sysutils -Fi$(SYSUTILSDIR) $<
+ifneq ($(findstring $(ARCH),aarch64 arm),)
+CLASSES_DEPS_CPU:=$(CLASSES_DEPS_CPU) $(INTRINSICSUNIT)$(PPUEXT)
+endif
 CLASSES_DEPS=$(CLASSESDIR)/classes.pp $(TTHREADINCDIR)/tthread.inc $(wildcard $(OBJPASDIR)/classes/*.inc) \
 	     $(SYSTEMUNIT)$(PPUEXT) $(OBJPASUNIT)$(PPUEXT) $(SORTBASEUNIT)$(PPUEXT) \
 	     $(SYSUTILSUNIT)$(PPUEXT) $(TYPINFOUNIT)$(PPUEXT) $(RTLCONSTSUNIT)$(PPUEXT) \
@@ -2573,6 +2576,13 @@ mmx$(PPUEXT) : $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
 System.CPU.MMX$(PPUEXT) : $(NSINC)/System.CPU.MMX.pp $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
+INTRINSICS_DEPS=$(PROCINC)/intrinsics.pp \
+	 $(SYSTEMUNIT)$(PPUEXT) \
+	 $(INTRINSICS_DEPS_OS) $(INTRINSICS_DEPS_CPU)
+intrinsics$(PPUEXT) : $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
+System.Intrinsics$(PPUEXT) : $(NSINC)/System.Intrinsics.pp $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
 ifeq ($(filter -dFPC_USE_LIBC,$(FPCOPT)),)
   X86_DEPS_OS+=$(SYSCALLUNIT)$(PPUEXT)
 endif

+ 10 - 0
rtl/beos/Makefile

@@ -2499,6 +2499,9 @@ sysutils$(PPUEXT) : $(SYSUTILS_DEPS)
 	$(COMPILER) -Fi$(OBJPASDIR)/sysutils $<
 System.SysUtils$(PPUEXT) : $(NSINC)/System.SysUtils.pp $(SYSUTILS_DEPS)
 	$(COMPILER) $(SYSUTILS_OPT) -Fi$(OBJPASDIR)/sysutils -Fi$(SYSUTILSDIR) $<
+ifneq ($(findstring $(ARCH),aarch64 arm),)
+CLASSES_DEPS_CPU:=$(CLASSES_DEPS_CPU) $(INTRINSICSUNIT)$(PPUEXT)
+endif
 CLASSES_DEPS=$(CLASSESDIR)/classes.pp $(TTHREADINCDIR)/tthread.inc $(wildcard $(OBJPASDIR)/classes/*.inc) \
 	     $(SYSTEMUNIT)$(PPUEXT) $(OBJPASUNIT)$(PPUEXT) $(SORTBASEUNIT)$(PPUEXT) \
 	     $(SYSUTILSUNIT)$(PPUEXT) $(TYPINFOUNIT)$(PPUEXT) $(RTLCONSTSUNIT)$(PPUEXT) \
@@ -2582,6 +2585,13 @@ mmx$(PPUEXT) : $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
 System.CPU.MMX$(PPUEXT) : $(NSINC)/System.CPU.MMX.pp $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
+INTRINSICS_DEPS=$(PROCINC)/intrinsics.pp \
+	 $(SYSTEMUNIT)$(PPUEXT) \
+	 $(INTRINSICS_DEPS_OS) $(INTRINSICS_DEPS_CPU)
+intrinsics$(PPUEXT) : $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
+System.Intrinsics$(PPUEXT) : $(NSINC)/System.Intrinsics.pp $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
 ifeq ($(filter -dFPC_USE_LIBC,$(FPCOPT)),)
   X86_DEPS_OS+=$(SYSCALLUNIT)$(PPUEXT)
 endif

+ 0 - 0
rtl/bsd/powerpc64/.gitkeep


+ 3 - 0
rtl/darwin/Makefile

@@ -2616,6 +2616,9 @@ sysutils$(PPUEXT) : $(SYSUTILS_DEPS)
 	$(COMPILER) -Fi$(OBJPASDIR)/sysutils $<
 System.SysUtils$(PPUEXT) : $(NSINC)/System.SysUtils.pp $(SYSUTILS_DEPS)
 	$(COMPILER) $(SYSUTILS_OPT) -Fi$(OBJPASDIR)/sysutils -Fi$(SYSUTILSDIR) $<
+ifneq ($(findstring $(ARCH),aarch64 arm),)
+CLASSES_DEPS_CPU:=$(CLASSES_DEPS_CPU) $(INTRINSICSUNIT)$(PPUEXT)
+endif
 CLASSES_DEPS=$(CLASSESDIR)/classes.pp $(TTHREADINCDIR)/tthread.inc $(wildcard $(OBJPASDIR)/classes/*.inc) \
 	     $(SYSTEMUNIT)$(PPUEXT) $(OBJPASUNIT)$(PPUEXT) $(SORTBASEUNIT)$(PPUEXT) \
 	     $(SYSUTILSUNIT)$(PPUEXT) $(TYPINFOUNIT)$(PPUEXT) $(RTLCONSTSUNIT)$(PPUEXT) \

+ 10 - 0
rtl/dragonfly/Makefile

@@ -2507,6 +2507,9 @@ sysutils$(PPUEXT) : $(SYSUTILS_DEPS)
 	$(COMPILER) -Fi$(OBJPASDIR)/sysutils $<
 System.SysUtils$(PPUEXT) : $(NSINC)/System.SysUtils.pp $(SYSUTILS_DEPS)
 	$(COMPILER) $(SYSUTILS_OPT) -Fi$(OBJPASDIR)/sysutils -Fi$(SYSUTILSDIR) $<
+ifneq ($(findstring $(ARCH),aarch64 arm),)
+CLASSES_DEPS_CPU:=$(CLASSES_DEPS_CPU) $(INTRINSICSUNIT)$(PPUEXT)
+endif
 CLASSES_DEPS=$(CLASSESDIR)/classes.pp $(TTHREADINCDIR)/tthread.inc $(wildcard $(OBJPASDIR)/classes/*.inc) \
 	     $(SYSTEMUNIT)$(PPUEXT) $(OBJPASUNIT)$(PPUEXT) $(SORTBASEUNIT)$(PPUEXT) \
 	     $(SYSUTILSUNIT)$(PPUEXT) $(TYPINFOUNIT)$(PPUEXT) $(RTLCONSTSUNIT)$(PPUEXT) \
@@ -2590,6 +2593,13 @@ mmx$(PPUEXT) : $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
 System.CPU.MMX$(PPUEXT) : $(NSINC)/System.CPU.MMX.pp $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
+INTRINSICS_DEPS=$(PROCINC)/intrinsics.pp \
+	 $(SYSTEMUNIT)$(PPUEXT) \
+	 $(INTRINSICS_DEPS_OS) $(INTRINSICS_DEPS_CPU)
+intrinsics$(PPUEXT) : $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
+System.Intrinsics$(PPUEXT) : $(NSINC)/System.Intrinsics.pp $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
 ifeq ($(filter -dFPC_USE_LIBC,$(FPCOPT)),)
   X86_DEPS_OS+=$(SYSCALLUNIT)$(PPUEXT)
 endif

+ 14 - 4
rtl/embedded/Makefile

@@ -936,10 +936,12 @@ SYSUTILS_DEPS_OS=$(HEAPMGRUNIT)$(PPUEXT)
 DOSDIR=.
 DOS_DEPS_OS=$(OBJPASUNIT)$(PPUEXT)
 ifeq ($(ARCH),aarch64)
+CPU_SPECIFIC_COMMON_UNITS=$(INTRINSICSUNIT)
 CPU_UNITS=$(RASPI3UNIT) $(MMIOUNIT) $(MAILBOXUNIT) $(RASPIUARTUNIT) $(GPIOUNIT)
 CPU_UNITS_DEFINED=1
 endif
 ifeq ($(ARCH),arm)
+CPU_SPECIFIC_COMMON_UNITS=$(INTRINSICSUNIT)
 ifeq ($(SUBARCH),armv7m)
 CPU_UNITS=$(LM3FURYUNIT) $(LM3TEMPESTUNIT) $(STM32F10X_LDUNIT) $(STM32F10X_MDUNIT) $(STM32F10X_HDUNIT) \
 	$(STM32F10X_XLUNIT) $(STM32F10X_CONNUNIT) $(STM32F10X_CLUNIT) $(LPC13XXUNIT) $(LPC1768UNIT) \
@@ -974,7 +976,7 @@ $(error No CPUs enabled for given SUBARCH, pass either a SUBARCH or set CPU_UNIT
 endif
 endif
 ifeq ($(ARCH),avr)
-CPU_SPECIFIC_COMMON_UNITS=intrinsics
+CPU_SPECIFIC_COMMON_UNITS=$(INTRINSICSUNIT)
 ifeq ($(SUBARCH),avrtiny)
 CPU_UNITS=attiny4 attiny5 attiny9 attiny10 attiny20 attiny40 attiny102 attiny104
 CPU_UNITS_DEFINED=1
@@ -1109,7 +1111,7 @@ $(error No CPUs enabled for given SUBARCH, pass either a SUBARCH or set CPU_UNIT
 endif
 endif
 ifeq ($(ARCH),riscv32)
-CPU_SPECIFIC_COMMON_UNITS=$(SYSUTILSUNIT) $(MATHUNIT) $(CLASSESUNIT) $(FGLUNIT) $(MACPASUNIT) $(TYPINFOUNIT) $(TYPESUNIT) $(RTLCONSTSUNIT) $(GETOPTSUNIT) $(LINEINFOUNIT)
+CPU_SPECIFIC_COMMON_UNITS=$(SYSUTILSUNIT) $(MATHUNIT) $(CLASSESUNIT) $(FGLUNIT) $(MACPASUNIT) $(TYPINFOUNIT) $(TYPESUNIT) $(RTLCONSTSUNIT) $(GETOPTSUNIT) $(LINEINFOUNIT) $(INTRINSICSUNIT)
 ifeq ($(SUBARCH),rv32ec)
 override FPCOPT+=-Cprv32ec
 CPU_UNITS=CH32VxBootstrap
@@ -2914,6 +2916,9 @@ sysutils$(PPUEXT) : $(SYSUTILS_DEPS)
 	$(COMPILER) -Fi$(OBJPASDIR)/sysutils $<
 System.SysUtils$(PPUEXT) : $(NSINC)/System.SysUtils.pp $(SYSUTILS_DEPS)
 	$(COMPILER) $(SYSUTILS_OPT) -Fi$(OBJPASDIR)/sysutils -Fi$(SYSUTILSDIR) $<
+ifneq ($(findstring $(ARCH),aarch64 arm),)
+CLASSES_DEPS_CPU:=$(CLASSES_DEPS_CPU) $(INTRINSICSUNIT)$(PPUEXT)
+endif
 CLASSES_DEPS=$(CLASSESDIR)/classes.pp $(TTHREADINCDIR)/tthread.inc $(wildcard $(OBJPASDIR)/classes/*.inc) \
 	     $(SYSTEMUNIT)$(PPUEXT) $(OBJPASUNIT)$(PPUEXT) $(SORTBASEUNIT)$(PPUEXT) \
 	     $(SYSUTILSUNIT)$(PPUEXT) $(TYPINFOUNIT)$(PPUEXT) $(RTLCONSTSUNIT)$(PPUEXT) \
@@ -2997,6 +3002,13 @@ mmx$(PPUEXT) : $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
 System.CPU.MMX$(PPUEXT) : $(NSINC)/System.CPU.MMX.pp $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
+INTRINSICS_DEPS=$(PROCINC)/intrinsics.pp \
+	 $(SYSTEMUNIT)$(PPUEXT) \
+	 $(INTRINSICS_DEPS_OS) $(INTRINSICS_DEPS_CPU)
+intrinsics$(PPUEXT) : $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
+System.Intrinsics$(PPUEXT) : $(NSINC)/System.Intrinsics.pp $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
 ifeq ($(filter -dFPC_USE_LIBC,$(FPCOPT)),)
   X86_DEPS_OS+=$(SYSCALLUNIT)$(PPUEXT)
 endif
@@ -3455,8 +3467,6 @@ else
 $(addsuffix $(PPUEXT),$(CPU_UNITS)):
 	$(COMPILER) -g -Fi$(OSDIR) -Fi$(OSDIR)/$(ARCH) $<
 endif
-intrinsics$(PPUEXT): $(PROCINC)/intrinsics.pp $(SYSTEMUNIT)$(PPUEXT)
-	$(COMPILER) $<
 avrsim$(PPUEXT): $(ARCH)/avrsim.pp $(HEAPMGRUNIT)$(PPUEXT) $(CONSOLEIOUNIT)$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
 	$(COMPILER) $(ARCH)/avrsim.pp
 MULTIBOOT_DEPS = $(ARCH)/multiboot.pp $(SYSTEMUNIT)$(PPUEXT) $(OBJPASUNIT)$(PPUEXT) \

+ 4 - 5
rtl/embedded/Makefile.fpc

@@ -68,11 +68,13 @@ DOSDIR=.
 DOS_DEPS_OS=$(OBJPASUNIT)$(PPUEXT)
 
 ifeq ($(ARCH),aarch64)
+CPU_SPECIFIC_COMMON_UNITS=$(INTRINSICSUNIT)
 CPU_UNITS=$(RASPI3UNIT) $(MMIOUNIT) $(MAILBOXUNIT) $(RASPIUARTUNIT) $(GPIOUNIT)
 CPU_UNITS_DEFINED=1
 endif
 
 ifeq ($(ARCH),arm)
+CPU_SPECIFIC_COMMON_UNITS=$(INTRINSICSUNIT)
 ifeq ($(SUBARCH),armv7m)
 CPU_UNITS=$(LM3FURYUNIT) $(LM3TEMPESTUNIT) $(STM32F10X_LDUNIT) $(STM32F10X_MDUNIT) $(STM32F10X_HDUNIT) \
 	$(STM32F10X_XLUNIT) $(STM32F10X_CONNUNIT) $(STM32F10X_CLUNIT) $(LPC13XXUNIT) $(LPC1768UNIT) \
@@ -108,7 +110,7 @@ endif
 endif
 
 ifeq ($(ARCH),avr)
-CPU_SPECIFIC_COMMON_UNITS=intrinsics
+CPU_SPECIFIC_COMMON_UNITS=$(INTRINSICSUNIT)
 ifeq ($(SUBARCH),avrtiny)
 CPU_UNITS=attiny4 attiny5 attiny9 attiny10 attiny20 attiny40 attiny102 attiny104
 CPU_UNITS_DEFINED=1
@@ -254,7 +256,7 @@ endif
 endif
 
 ifeq ($(ARCH),riscv32)
-CPU_SPECIFIC_COMMON_UNITS=$(SYSUTILSUNIT) $(MATHUNIT) $(CLASSESUNIT) $(FGLUNIT) $(MACPASUNIT) $(TYPINFOUNIT) $(TYPESUNIT) $(RTLCONSTSUNIT) $(GETOPTSUNIT) $(LINEINFOUNIT)
+CPU_SPECIFIC_COMMON_UNITS=$(SYSUTILSUNIT) $(MATHUNIT) $(CLASSESUNIT) $(FGLUNIT) $(MACPASUNIT) $(TYPINFOUNIT) $(TYPESUNIT) $(RTLCONSTSUNIT) $(GETOPTSUNIT) $(LINEINFOUNIT) $(INTRINSICSUNIT)
 ifeq ($(SUBARCH),rv32ec)
 override FPCOPT+=-Cprv32ec
 CPU_UNITS=CH32VxBootstrap
@@ -392,9 +394,6 @@ endif
 
 # AVR specific units
 
-intrinsics$(PPUEXT): $(PROCINC)/intrinsics.pp $(SYSTEMUNIT)$(PPUEXT)
-	$(COMPILER) $<
-
 avrsim$(PPUEXT): $(ARCH)/avrsim.pp $(HEAPMGRUNIT)$(PPUEXT) $(CONSOLEIOUNIT)$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
 	$(COMPILER) $(ARCH)/avrsim.pp
 

+ 10 - 0
rtl/emx/Makefile

@@ -2499,6 +2499,9 @@ sysutils$(PPUEXT) : $(SYSUTILS_DEPS)
 	$(COMPILER) -Fi$(OBJPASDIR)/sysutils $<
 System.SysUtils$(PPUEXT) : $(NSINC)/System.SysUtils.pp $(SYSUTILS_DEPS)
 	$(COMPILER) $(SYSUTILS_OPT) -Fi$(OBJPASDIR)/sysutils -Fi$(SYSUTILSDIR) $<
+ifneq ($(findstring $(ARCH),aarch64 arm),)
+CLASSES_DEPS_CPU:=$(CLASSES_DEPS_CPU) $(INTRINSICSUNIT)$(PPUEXT)
+endif
 CLASSES_DEPS=$(CLASSESDIR)/classes.pp $(TTHREADINCDIR)/tthread.inc $(wildcard $(OBJPASDIR)/classes/*.inc) \
 	     $(SYSTEMUNIT)$(PPUEXT) $(OBJPASUNIT)$(PPUEXT) $(SORTBASEUNIT)$(PPUEXT) \
 	     $(SYSUTILSUNIT)$(PPUEXT) $(TYPINFOUNIT)$(PPUEXT) $(RTLCONSTSUNIT)$(PPUEXT) \
@@ -2582,6 +2585,13 @@ mmx$(PPUEXT) : $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
 System.CPU.MMX$(PPUEXT) : $(NSINC)/System.CPU.MMX.pp $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
+INTRINSICS_DEPS=$(PROCINC)/intrinsics.pp \
+	 $(SYSTEMUNIT)$(PPUEXT) \
+	 $(INTRINSICS_DEPS_OS) $(INTRINSICS_DEPS_CPU)
+intrinsics$(PPUEXT) : $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
+System.Intrinsics$(PPUEXT) : $(NSINC)/System.Intrinsics.pp $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
 ifeq ($(filter -dFPC_USE_LIBC,$(FPCOPT)),)
   X86_DEPS_OS+=$(SYSCALLUNIT)$(PPUEXT)
 endif

+ 12 - 0
rtl/freebsd/Makefile

@@ -948,6 +948,8 @@ ASTARGET=-a64
 endif
 ifdef RELEASE
 override FPCOPT+=-Ur
+ifeq ($(ARCH),aarch64)
+CPU_UNITS=$(INTRINSICSUNIT)
 endif
 OBJPASDIR=$(RTL)/objpas
 ifeq ($(CPU_OS_TARGET),i386-freebsd)
@@ -2573,6 +2575,9 @@ sysutils$(PPUEXT) : $(SYSUTILS_DEPS)
 	$(COMPILER) -Fi$(OBJPASDIR)/sysutils $<
 System.SysUtils$(PPUEXT) : $(NSINC)/System.SysUtils.pp $(SYSUTILS_DEPS)
 	$(COMPILER) $(SYSUTILS_OPT) -Fi$(OBJPASDIR)/sysutils -Fi$(SYSUTILSDIR) $<
+ifneq ($(findstring $(ARCH),aarch64 arm),)
+CLASSES_DEPS_CPU:=$(CLASSES_DEPS_CPU) $(INTRINSICSUNIT)$(PPUEXT)
+endif
 CLASSES_DEPS=$(CLASSESDIR)/classes.pp $(TTHREADINCDIR)/tthread.inc $(wildcard $(OBJPASDIR)/classes/*.inc) \
 	     $(SYSTEMUNIT)$(PPUEXT) $(OBJPASUNIT)$(PPUEXT) $(SORTBASEUNIT)$(PPUEXT) \
 	     $(SYSUTILSUNIT)$(PPUEXT) $(TYPINFOUNIT)$(PPUEXT) $(RTLCONSTSUNIT)$(PPUEXT) \
@@ -2656,6 +2661,13 @@ mmx$(PPUEXT) : $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
 System.CPU.MMX$(PPUEXT) : $(NSINC)/System.CPU.MMX.pp $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
+INTRINSICS_DEPS=$(PROCINC)/intrinsics.pp \
+	 $(SYSTEMUNIT)$(PPUEXT) \
+	 $(INTRINSICS_DEPS_OS) $(INTRINSICS_DEPS_CPU)
+intrinsics$(PPUEXT) : $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
+System.Intrinsics$(PPUEXT) : $(NSINC)/System.Intrinsics.pp $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
 ifeq ($(filter -dFPC_USE_LIBC,$(FPCOPT)),)
   X86_DEPS_OS+=$(SYSCALLUNIT)$(PPUEXT)
 endif

+ 3 - 0
rtl/freebsd/Makefile.fpc

@@ -84,6 +84,9 @@ ifeq ($(ARCH),x86_64)
 CPU_UNITS=$(X86UNIT) $(PORTSUNIT) $(CPUUNIT)
 ASTARGET=--64
 endif
+ifeq ($(ARCH),aarch64)
+CPU_UNITS=$(INTRINSICSUNIT)
+endif
 
 # Paths
 OBJPASDIR=$(RTL)/objpas

+ 2 - 3
rtl/freebsd/powerpc64/sighnd.inc

@@ -25,14 +25,13 @@ begin
     SIGFPE:
       begin
         case info^.si_code of
-          FPE_FLTDIV: res := 208;  { float divide fault }
-          FPE_INTDIV: res := 207;  { integer divide fault }
+          FPE_INTDIV: res := 200;  { integer divide fault }
           FPE_FLTOVF: res := 205;  { overflow trap }
           FPE_FLTUND: res := 206;  { underflow }
           FPE_FLTRES: res := 216;  { inexact result / device not available }
           FPE_FLTINV: res := 216;  { invalid floating point op }
         else
-          res := 207;              { generic coprocessor error }
+          res := 208;              { generic coprocessor error }
         end;
         sysResetFPU;               { reset FPSCR on PowerPC64 }
       end;

+ 65 - 0
rtl/freebsd/powerpc64/sighndh.inc

@@ -0,0 +1,65 @@
+{
+  This file is part of the Free Pascal run time library.
+  Copyright (c) 2011 by Free Pascal development team
+
+  This file implements all the types/constants related
+  to signals for FreeBSD/powerpc64 (ELFv2).
+
+  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.
+
+ **********************************************************************}
+
+{$packrecords C}
+	SigContextRec = ^TSigContext;
+    TSigContext = record
+       mc_mask      : sigset_t;          { signal mask to restore }
+    { General-purpose registers r0..r31 (64-bit). }
+	   mc_gpr   : array[0..31] of cULong;
+
+    { Link register, condition register, fixed-point exception, count register }
+       mc_lr    : cULong;
+       mc_cr    : cULong;
+       mc_xer   : cULong;
+       mc_ctr   : cULong;
+
+    { Saved instruction address / machine state.
+      On FreeBSD/powerpc64 the PC is in mc_srr0. }
+       mc_srr0  : cULong;  { program counter }
+       mc_srr1  : cULong;  { machine state register }
+       mc_fpreg  : array[0..31] of Double;   { F0–F31 }
+       mc_fpscr   : cULong;
+    { FreeBSD/powerpc64 adds vector + extra FP state }
+       mc_vscr    : QWord;
+       mc_vrsave  : QWord;
+       mc_gqr     : array[0..7] of QWord;
+       mc_vreg    : array[0..63] of QWord;
+
+    { Reserve space for FP/vector/etc. state so this record is not
+      smaller than the real kernel mcontext_t. Adjust size if needed. }
+       mc_reserved : array[0..255] of cUChar;
+    end;
+    
+
+	pstack_t = ^stack_t;
+	stack_t = record
+	  ss_sp: PAnsiChar;                       {* signal stack base *}
+      ss_size: size_t;                    {* signal stack length *}
+      ss_flags: cInt;                     {* SS_DISABLE and/or SS_ONSTACK *}
+	end;
+	TStack = stack_t;
+	PStack = pstack_t;
+
+	PUContext = ^pucontext_t;
+	pucontext_t = ^tucontext_t;
+    tucontext_t = record
+       uc_flags    : cULong;
+       uc_link     : pucontext_t;
+       uc_stack    : stack_t;
+       uc_mcontext : TSigContext;
+       uc_sigmask  : sigset_t;
+    end;

+ 3 - 3
rtl/freebsd/signal.inc

@@ -131,9 +131,7 @@ type sigset_t = array[0..3] of Longint;
 {$endif cpuaarch64}
 
 {$ifdef CPUPOWERPC64}
-    SigContextRec = record
-            _dummy : cint;
-       end;
+{$i sighndh.inc}
 {$endif}
 
   Sigval = Record
@@ -193,6 +191,7 @@ type sigset_t = array[0..3] of Longint;
   PSigActionRec = ^SigActionRec;
   
 
+{$ifndef CPUPOWERPC64}
   pstack_t = ^stack_t;
   stack_t = record
     ss_sp: PAnsiChar;                       {* signal stack base *}
@@ -201,6 +200,7 @@ type sigset_t = array[0..3] of Longint;
   end;
   TStack = stack_t;
   PStack = pstack_t;
+{$endif CPUPOWERPC64}
 
 {
   Change action of process upon receipt of a signal.

+ 24 - 24
rtl/freebsd/ucontexth.inc

@@ -83,33 +83,33 @@ type
   end;
 {$endif cpuaarch64}
 
-{$ifdef powerpc64}
-  gpregs = record
-    { General-purpose registers r0..r31 }
-    gp_r: array[0..31] of NativeUInt;  { 64-bit each }
+{$ifdef CPUPOWERPC64}
+  mcontext_t = record
+    { version & flags }
+    mc_vers    : cint;
+    mc_flags   : cint;
+    { saved sigstack flag and total size of this structure }
+    mc_onstack : cint;
+    mc_len     : cint;
 
-    { Special registers saved in mcontext }
-    gp_nip: NativeUInt;  { Next instruction pointer (PC) }
-    gp_msr: NativeUInt;  { Machine state register }
-    gp_ctr: NativeUInt;  { Count register }
-    gp_lr:  NativeUInt;  { Link register }
-    gp_xer: NativeUInt;  { Integer exception register }
-    gp_cr:  NativeUInt;  { Condition register }
-  end;
+    { general-purpose CPU state (matches trapframe layout) }
+    mc_gpr     : array[0..31] of cuint64;  { r0..r31 }
+    mc_lr      : cuint64;                  { link register }
+    mc_cr      : cuint64;                  { condition register }
+    mc_xer     : cuint64;                  { fixed-point exception }
+    mc_ctr     : cuint64;                  { count register }
+    mc_srr0    : cuint64;                  { PC at signal (NIP) }
+    mc_srr1    : cuint64;                  { MSR }
 
-  fpregs = record
-    { 32 double-precision FP regs f0..f31 }
-    fp_f: array[0..31] of Double;  { each 64-bit IEEE754 }
-    fp_fpscr: QWord;               { Floating-point status/control reg }
-    fp_pad:  array[0..1] of QWord; { padding/reserved }
-  end;
+    { floating-point state }
+    mc_fpscr   : cdouble;                     { saved FPSCR as double }
+    mc_fpreg   : array[0..31] of cdouble;     { FPR0..FPR31 }
 
-  mcontext_t = record
-    mc_gpregs: gpregs;
-    mc_fpregs: fpregs;
-    mc_flags: Int32;
-    mc_pad:   Int32;
-    mc_spare: array[0..7] of NativeInt;
+    { Altivec / VSX state }
+    { 32 vector registers, stored as 2x64-bit words each }
+    mc_avec    : array[0..(32*2)-1] of cuint64;
+    { misc Altivec control: VSCR / VRSAVE (32-bit) }
+    mc_av      : array[0..1] of cuint32;
   end;
 {$endif}
 

+ 11 - 1
rtl/freertos/Makefile

@@ -928,7 +928,7 @@ CPU_SPECIFIC_COMMON_UNITS=
 DOSDIR=.
 DOS_DEPS_OS=$(OBJPASUNIT)$(PPUEXT)
 ifeq ($(ARCH),arm)
-CPU_SPECIFIC_COMMON_UNITS=$(SYSUTILSUNIT) $(MATHUNIT) $(CLASSESUNIT) $(FGLUNIT) $(MACPASUNIT) $(TYPINFOUNIT) $(TYPESUNIT) $(RTLCONSTSUNIT) $(GETOPTSUNIT) $(LINEINFOUNIT)
+CPU_SPECIFIC_COMMON_UNITS=$(SYSUTILSUNIT) $(MATHUNIT) $(CLASSESUNIT) $(FGLUNIT) $(MACPASUNIT) $(TYPINFOUNIT) $(TYPESUNIT) $(RTLCONSTSUNIT) $(GETOPTSUNIT) $(LINEINFOUNIT) $(INTRINSICSUNIT)
 ifeq ($(SUBARCH),armv7m)
 CPU_UNITS=stm32f103xe cortexm3 cortexm4 # thumb2_bare
 CPU_UNITS_DEFINED=1
@@ -2595,6 +2595,9 @@ sysutils$(PPUEXT) : $(SYSUTILS_DEPS)
 	$(COMPILER) -Fi$(OBJPASDIR)/sysutils $<
 System.SysUtils$(PPUEXT) : $(NSINC)/System.SysUtils.pp $(SYSUTILS_DEPS)
 	$(COMPILER) $(SYSUTILS_OPT) -Fi$(OBJPASDIR)/sysutils -Fi$(SYSUTILSDIR) $<
+ifneq ($(findstring $(ARCH),aarch64 arm),)
+CLASSES_DEPS_CPU:=$(CLASSES_DEPS_CPU) $(INTRINSICSUNIT)$(PPUEXT)
+endif
 CLASSES_DEPS=$(CLASSESDIR)/classes.pp $(TTHREADINCDIR)/tthread.inc $(wildcard $(OBJPASDIR)/classes/*.inc) \
 	     $(SYSTEMUNIT)$(PPUEXT) $(OBJPASUNIT)$(PPUEXT) $(SORTBASEUNIT)$(PPUEXT) \
 	     $(SYSUTILSUNIT)$(PPUEXT) $(TYPINFOUNIT)$(PPUEXT) $(RTLCONSTSUNIT)$(PPUEXT) \
@@ -2678,6 +2681,13 @@ mmx$(PPUEXT) : $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
 System.CPU.MMX$(PPUEXT) : $(NSINC)/System.CPU.MMX.pp $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
+INTRINSICS_DEPS=$(PROCINC)/intrinsics.pp \
+	 $(SYSTEMUNIT)$(PPUEXT) \
+	 $(INTRINSICS_DEPS_OS) $(INTRINSICS_DEPS_CPU)
+intrinsics$(PPUEXT) : $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
+System.Intrinsics$(PPUEXT) : $(NSINC)/System.Intrinsics.pp $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
 ifeq ($(filter -dFPC_USE_LIBC,$(FPCOPT)),)
   X86_DEPS_OS+=$(SYSCALLUNIT)$(PPUEXT)
 endif

+ 1 - 1
rtl/freertos/Makefile.fpc

@@ -60,7 +60,7 @@ DOSDIR=.
 DOS_DEPS_OS=$(OBJPASUNIT)$(PPUEXT)
 
 ifeq ($(ARCH),arm)
-CPU_SPECIFIC_COMMON_UNITS=$(SYSUTILSUNIT) $(MATHUNIT) $(CLASSESUNIT) $(FGLUNIT) $(MACPASUNIT) $(TYPINFOUNIT) $(TYPESUNIT) $(RTLCONSTSUNIT) $(GETOPTSUNIT) $(LINEINFOUNIT)
+CPU_SPECIFIC_COMMON_UNITS=$(SYSUTILSUNIT) $(MATHUNIT) $(CLASSESUNIT) $(FGLUNIT) $(MACPASUNIT) $(TYPINFOUNIT) $(TYPESUNIT) $(RTLCONSTSUNIT) $(GETOPTSUNIT) $(LINEINFOUNIT) $(INTRINSICSUNIT)
 ifeq ($(SUBARCH),armv7m)
 CPU_UNITS=stm32f103xe cortexm3 cortexm4 # thumb2_bare
 CPU_UNITS_DEFINED=1

+ 13 - 0
rtl/gba/Makefile

@@ -922,6 +922,9 @@ UNITPREFIX=rtl
 LOADERS=prt0 cprt0
 OBJPASDIR=$(RTL)/objpas
 SYSUTILS_DEPS_OS=$(DOSUNIT)$(PPUEXT)
+ifeq ($(ARCH),arm)
+CPU_UNITS=$(INTRINSICSUNIT)
+endif
 ifeq ($(CPU_OS_TARGET),arm-gba)
 override TARGET_UNITS+=$(SYSTEMUNIT) $(UUCHARUNIT) $(OBJPASUNIT) $(MACPASUNIT) $(ISO7185UNIT) $(EXTPASUNIT) $(STRINGSUNIT) $(SORTBASEUNIT)  $(SYSUTILSUNIT) $(CLASSESUNIT)  $(MATHUNIT) $(TYPINFOUNIT) $(CTYPESUNIT)  $(CHARSETUNIT) $(CPALLUNIT) $(GETOPTSUNIT) $(FPWIDESTRINGUNIT) $(CHARACTERUNIT) $(TYPESUNIT) $(SYSCONSTUNIT) $(RTLCONSTSUNIT) $(LINEINFOUNIT) $(FGLUNIT)
 endif
@@ -2488,6 +2491,9 @@ sysutils$(PPUEXT) : $(SYSUTILS_DEPS)
 	$(COMPILER) -Fi$(OBJPASDIR)/sysutils $<
 System.SysUtils$(PPUEXT) : $(NSINC)/System.SysUtils.pp $(SYSUTILS_DEPS)
 	$(COMPILER) $(SYSUTILS_OPT) -Fi$(OBJPASDIR)/sysutils -Fi$(SYSUTILSDIR) $<
+ifneq ($(findstring $(ARCH),aarch64 arm),)
+CLASSES_DEPS_CPU:=$(CLASSES_DEPS_CPU) $(INTRINSICSUNIT)$(PPUEXT)
+endif
 CLASSES_DEPS=$(CLASSESDIR)/classes.pp $(TTHREADINCDIR)/tthread.inc $(wildcard $(OBJPASDIR)/classes/*.inc) \
 	     $(SYSTEMUNIT)$(PPUEXT) $(OBJPASUNIT)$(PPUEXT) $(SORTBASEUNIT)$(PPUEXT) \
 	     $(SYSUTILSUNIT)$(PPUEXT) $(TYPINFOUNIT)$(PPUEXT) $(RTLCONSTSUNIT)$(PPUEXT) \
@@ -2571,6 +2577,13 @@ mmx$(PPUEXT) : $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
 System.CPU.MMX$(PPUEXT) : $(NSINC)/System.CPU.MMX.pp $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
+INTRINSICS_DEPS=$(PROCINC)/intrinsics.pp \
+	 $(SYSTEMUNIT)$(PPUEXT) \
+	 $(INTRINSICS_DEPS_OS) $(INTRINSICS_DEPS_CPU)
+intrinsics$(PPUEXT) : $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
+System.Intrinsics$(PPUEXT) : $(NSINC)/System.Intrinsics.pp $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
 ifeq ($(filter -dFPC_USE_LIBC,$(FPCOPT)),)
   X86_DEPS_OS+=$(SYSCALLUNIT)$(PPUEXT)
 endif

+ 4 - 0
rtl/gba/Makefile.fpc

@@ -43,6 +43,10 @@ LOADERS=prt0 cprt0
 OBJPASDIR=$(RTL)/objpas
 SYSUTILS_DEPS_OS=$(DOSUNIT)$(PPUEXT)
 
+ifeq ($(ARCH),arm)
+CPU_UNITS=$(INTRINSICSUNIT)
+endif
+
 [rules]
 .NOTPARALLEL:
 # Get the system independent include file names.

+ 10 - 0
rtl/go32v2/Makefile

@@ -2501,6 +2501,9 @@ sysutils$(PPUEXT) : $(SYSUTILS_DEPS)
 	$(COMPILER) -Fi$(OBJPASDIR)/sysutils $<
 System.SysUtils$(PPUEXT) : $(NSINC)/System.SysUtils.pp $(SYSUTILS_DEPS)
 	$(COMPILER) $(SYSUTILS_OPT) -Fi$(OBJPASDIR)/sysutils -Fi$(SYSUTILSDIR) $<
+ifneq ($(findstring $(ARCH),aarch64 arm),)
+CLASSES_DEPS_CPU:=$(CLASSES_DEPS_CPU) $(INTRINSICSUNIT)$(PPUEXT)
+endif
 CLASSES_DEPS=$(CLASSESDIR)/classes.pp $(TTHREADINCDIR)/tthread.inc $(wildcard $(OBJPASDIR)/classes/*.inc) \
 	     $(SYSTEMUNIT)$(PPUEXT) $(OBJPASUNIT)$(PPUEXT) $(SORTBASEUNIT)$(PPUEXT) \
 	     $(SYSUTILSUNIT)$(PPUEXT) $(TYPINFOUNIT)$(PPUEXT) $(RTLCONSTSUNIT)$(PPUEXT) \
@@ -2584,6 +2587,13 @@ mmx$(PPUEXT) : $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
 System.CPU.MMX$(PPUEXT) : $(NSINC)/System.CPU.MMX.pp $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
+INTRINSICS_DEPS=$(PROCINC)/intrinsics.pp \
+	 $(SYSTEMUNIT)$(PPUEXT) \
+	 $(INTRINSICS_DEPS_OS) $(INTRINSICS_DEPS_CPU)
+intrinsics$(PPUEXT) : $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
+System.Intrinsics$(PPUEXT) : $(NSINC)/System.Intrinsics.pp $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
 ifeq ($(filter -dFPC_USE_LIBC,$(FPCOPT)),)
   X86_DEPS_OS+=$(SYSCALLUNIT)$(PPUEXT)
 endif

+ 10 - 0
rtl/haiku/Makefile

@@ -2531,6 +2531,9 @@ sysutils$(PPUEXT) : $(SYSUTILS_DEPS)
 	$(COMPILER) -Fi$(OBJPASDIR)/sysutils $<
 System.SysUtils$(PPUEXT) : $(NSINC)/System.SysUtils.pp $(SYSUTILS_DEPS)
 	$(COMPILER) $(SYSUTILS_OPT) -Fi$(OBJPASDIR)/sysutils -Fi$(SYSUTILSDIR) $<
+ifneq ($(findstring $(ARCH),aarch64 arm),)
+CLASSES_DEPS_CPU:=$(CLASSES_DEPS_CPU) $(INTRINSICSUNIT)$(PPUEXT)
+endif
 CLASSES_DEPS=$(CLASSESDIR)/classes.pp $(TTHREADINCDIR)/tthread.inc $(wildcard $(OBJPASDIR)/classes/*.inc) \
 	     $(SYSTEMUNIT)$(PPUEXT) $(OBJPASUNIT)$(PPUEXT) $(SORTBASEUNIT)$(PPUEXT) \
 	     $(SYSUTILSUNIT)$(PPUEXT) $(TYPINFOUNIT)$(PPUEXT) $(RTLCONSTSUNIT)$(PPUEXT) \
@@ -2614,6 +2617,13 @@ mmx$(PPUEXT) : $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
 System.CPU.MMX$(PPUEXT) : $(NSINC)/System.CPU.MMX.pp $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
+INTRINSICS_DEPS=$(PROCINC)/intrinsics.pp \
+	 $(SYSTEMUNIT)$(PPUEXT) \
+	 $(INTRINSICS_DEPS_OS) $(INTRINSICS_DEPS_CPU)
+intrinsics$(PPUEXT) : $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
+System.Intrinsics$(PPUEXT) : $(NSINC)/System.Intrinsics.pp $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
 ifeq ($(filter -dFPC_USE_LIBC,$(FPCOPT)),)
   X86_DEPS_OS+=$(SYSCALLUNIT)$(PPUEXT)
 endif

+ 10 - 0
rtl/human68k/Makefile

@@ -2490,6 +2490,9 @@ sysutils$(PPUEXT) : $(SYSUTILS_DEPS)
 	$(COMPILER) -Fi$(OBJPASDIR)/sysutils $<
 System.SysUtils$(PPUEXT) : $(NSINC)/System.SysUtils.pp $(SYSUTILS_DEPS)
 	$(COMPILER) $(SYSUTILS_OPT) -Fi$(OBJPASDIR)/sysutils -Fi$(SYSUTILSDIR) $<
+ifneq ($(findstring $(ARCH),aarch64 arm),)
+CLASSES_DEPS_CPU:=$(CLASSES_DEPS_CPU) $(INTRINSICSUNIT)$(PPUEXT)
+endif
 CLASSES_DEPS=$(CLASSESDIR)/classes.pp $(TTHREADINCDIR)/tthread.inc $(wildcard $(OBJPASDIR)/classes/*.inc) \
 	     $(SYSTEMUNIT)$(PPUEXT) $(OBJPASUNIT)$(PPUEXT) $(SORTBASEUNIT)$(PPUEXT) \
 	     $(SYSUTILSUNIT)$(PPUEXT) $(TYPINFOUNIT)$(PPUEXT) $(RTLCONSTSUNIT)$(PPUEXT) \
@@ -2573,6 +2576,13 @@ mmx$(PPUEXT) : $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
 System.CPU.MMX$(PPUEXT) : $(NSINC)/System.CPU.MMX.pp $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
+INTRINSICS_DEPS=$(PROCINC)/intrinsics.pp \
+	 $(SYSTEMUNIT)$(PPUEXT) \
+	 $(INTRINSICS_DEPS_OS) $(INTRINSICS_DEPS_CPU)
+intrinsics$(PPUEXT) : $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
+System.Intrinsics$(PPUEXT) : $(NSINC)/System.Intrinsics.pp $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
 ifeq ($(filter -dFPC_USE_LIBC,$(FPCOPT)),)
   X86_DEPS_OS+=$(SYSCALLUNIT)$(PPUEXT)
 endif

+ 6 - 1
rtl/inc/Makefile.rtl

@@ -1052,12 +1052,17 @@ System.SysUtils$(PPUEXT) : $(NSINC)/System.SysUtils.pp $(SYSUTILS_DEPS)
 #
 # Classes
 #
+# aarch64 and arm classes unit needs intrinsics unit
+ifneq ($(findstring $(ARCH),aarch64 arm),)
+CLASSES_DEPS_CPU:=$(CLASSES_DEPS_CPU) $(INTRINSICSUNIT)$(PPUEXT)
+endif
+
 CLASSES_DEPS=$(CLASSESDIR)/classes.pp $(TTHREADINCDIR)/tthread.inc $(wildcard $(OBJPASDIR)/classes/*.inc) \
 	     $(SYSTEMUNIT)$(PPUEXT) $(OBJPASUNIT)$(PPUEXT) $(SORTBASEUNIT)$(PPUEXT) \
              $(SYSUTILSUNIT)$(PPUEXT) $(TYPINFOUNIT)$(PPUEXT) $(RTLCONSTSUNIT)$(PPUEXT) \
              $(FGLUNIT)$(PPUEXT) $(TYPESUNIT)$(PPUEXT) \
              $(CLASSES_DEPS_OS) $(CLASSES_DEPS_CPU)
- 
+
 classes$(PPUEXT) : $(CLASSES_DEPS)
         $(COMPILER) -Fi$(OBJPASDIR)/classes $(CLASSES_OPT) $<
 

+ 11 - 0
rtl/inc/generic.inc

@@ -14,6 +14,12 @@
 
  **********************************************************************}
 
+{$if defined(freebsd) and defined(cpupowerpc64)}
+{$linklib c}
+// Import FreeBSD's fpsetmask() from libc
+function fpsetmask(mask: LongInt): LongInt; cdecl; external 'c';
+{$endif cpupowerpc64}
+
 function align(addr : PtrUInt;alignment : PtrUInt) : PtrUInt;{$ifdef SYSTEMINLINE}inline;{$endif}
   var
     tmp,am1 : PtrUInt;
@@ -2474,6 +2480,11 @@ end;
 
 {$endif ndef FPC_SYSTEM_HAS_INT_STR_QWORD}
 
+{$if defined(freebsd) and defined(cpupowerpc64)}
+{ Initialize FPU/FP exception state for FreeBSD/powerpc64 }
+	fpsetmask(0);
+{$endif cpupowerpc64}
+
 {$ifndef FPUNONE}
 {$ifndef FPC_SYSTEM_HAS_SYSRESETFPU}
 

+ 23 - 2
rtl/inc/objpas.inc

@@ -738,15 +738,36 @@ end;
           ClassName := PVmt(Self)^.vClassName^;
         end;
 
+      {$if SIZEOF(CHAR)=2}
+      class function TObject.ClassNameIs(const name : AnsiString) : boolean;
+      var
+          SS : ShortString;
+      begin
+        SS:=Name;
+        ClassNameIs:=ClassNameIs(SS);
+      end;
+      {$ENDIF}
+      
+      class function TObject.ClassNameIs(const name : ShortString) : boolean;
+      begin
+        ClassNameIs:=ShortCompareText(PVmt(Self)^.vClassName^, name) = 0;      
+      end;
+
+      {$ifdef FPC_HAS_FEATURE_ANSISTRINGS}
       class function TObject.ClassNameIs(const name : RTLString) : boolean;
 
         var
           SS : ShortString;
           
         begin
-           SS:=ShortString(Name);
-           ClassNameIs:=ShortCompareText(PVmt(Self)^.vClassName^, SS) = 0;
+           {$if SIZEOF(CHAR)=2}
+           SS:=UTF8Encode(Name);
+           {$ELSE}
+           SS:=Name;
+           {$ENDIF}
+           ClassNameIs:=ClassNameIs(SS);
         end;
+      {$endif FPC_HAS_FEATURE_ANSISTRINGS}
 
       class function TObject.InheritsFrom(aclass : TClass) : Boolean;
 

+ 7 - 1
rtl/inc/objpash.inc

@@ -271,7 +271,13 @@
           class function ClassType : tclass;{$ifdef SYSTEMINLINE}inline;{$endif}
           class function ClassInfo : pointer;
           class function ClassName : shortstring;
-          class function ClassNameIs(const name : RTLString) : boolean;
+          {$IF SIZEOF(CHAR)=2}
+          class function ClassNameIs(const name : AnsiString) : boolean; overload; {$ifdef SYSTEMINLINE}inline;{$endif}
+          {$ENDIF}
+          {$ifdef FPC_HAS_FEATURE_ANSISTRINGS}
+	  class function ClassNameIs(const name : RTLString) : boolean; overload;  {$ifdef SYSTEMINLINE}inline;{$endif}
+          {$endif FPC_HAS_FEATURE_ANSISTRINGS}
+          class function ClassNameIs(const name : ShortString) : boolean; 
           class function ClassParent : tclass;{$ifdef SYSTEMINLINE}inline;{$endif}
           class function InstanceSize : SizeInt;// {$ifdef SYSTEMINLINE}inline;{$endif}
           class function InheritsFrom(aclass : tclass) : boolean;

+ 10 - 0
rtl/java/Makefile

@@ -2461,6 +2461,9 @@ sysutils$(PPUEXT) : $(SYSUTILS_DEPS)
 	$(COMPILER) -Fi$(OBJPASDIR)/sysutils $<
 System.SysUtils$(PPUEXT) : $(NSINC)/System.SysUtils.pp $(SYSUTILS_DEPS)
 	$(COMPILER) $(SYSUTILS_OPT) -Fi$(OBJPASDIR)/sysutils -Fi$(SYSUTILSDIR) $<
+ifneq ($(findstring $(ARCH),aarch64 arm),)
+CLASSES_DEPS_CPU:=$(CLASSES_DEPS_CPU) $(INTRINSICSUNIT)$(PPUEXT)
+endif
 CLASSES_DEPS=$(CLASSESDIR)/classes.pp $(TTHREADINCDIR)/tthread.inc $(wildcard $(OBJPASDIR)/classes/*.inc) \
 	     $(SYSTEMUNIT)$(PPUEXT) $(OBJPASUNIT)$(PPUEXT) $(SORTBASEUNIT)$(PPUEXT) \
 	     $(SYSUTILSUNIT)$(PPUEXT) $(TYPINFOUNIT)$(PPUEXT) $(RTLCONSTSUNIT)$(PPUEXT) \
@@ -2544,6 +2547,13 @@ mmx$(PPUEXT) : $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
 System.CPU.MMX$(PPUEXT) : $(NSINC)/System.CPU.MMX.pp $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
+INTRINSICS_DEPS=$(PROCINC)/intrinsics.pp \
+	 $(SYSTEMUNIT)$(PPUEXT) \
+	 $(INTRINSICS_DEPS_OS) $(INTRINSICS_DEPS_CPU)
+intrinsics$(PPUEXT) : $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
+System.Intrinsics$(PPUEXT) : $(NSINC)/System.Intrinsics.pp $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
 ifeq ($(filter -dFPC_USE_LIBC,$(FPCOPT)),)
   X86_DEPS_OS+=$(SYSCALLUNIT)$(PPUEXT)
 endif

+ 3 - 0
rtl/linux/Makefile

@@ -3113,6 +3113,9 @@ sysutils$(PPUEXT) : $(SYSUTILS_DEPS)
 	$(COMPILER) -Fi$(OBJPASDIR)/sysutils $<
 System.SysUtils$(PPUEXT) : $(NSINC)/System.SysUtils.pp $(SYSUTILS_DEPS)
 	$(COMPILER) $(SYSUTILS_OPT) -Fi$(OBJPASDIR)/sysutils -Fi$(SYSUTILSDIR) $<
+ifneq ($(findstring $(ARCH),aarch64 arm),)
+CLASSES_DEPS_CPU:=$(CLASSES_DEPS_CPU) $(INTRINSICSUNIT)$(PPUEXT)
+endif
 CLASSES_DEPS=$(CLASSESDIR)/classes.pp $(TTHREADINCDIR)/tthread.inc $(wildcard $(OBJPASDIR)/classes/*.inc) \
 	     $(SYSTEMUNIT)$(PPUEXT) $(OBJPASUNIT)$(PPUEXT) $(SORTBASEUNIT)$(PPUEXT) \
 	     $(SYSUTILSUNIT)$(PPUEXT) $(TYPINFOUNIT)$(PPUEXT) $(RTLCONSTSUNIT)$(PPUEXT) \

+ 10 - 0
rtl/macos/Makefile

@@ -2479,6 +2479,9 @@ sysutils$(PPUEXT) : $(SYSUTILS_DEPS)
 	$(COMPILER) -Fi$(OBJPASDIR)/sysutils $<
 System.SysUtils$(PPUEXT) : $(NSINC)/System.SysUtils.pp $(SYSUTILS_DEPS)
 	$(COMPILER) $(SYSUTILS_OPT) -Fi$(OBJPASDIR)/sysutils -Fi$(SYSUTILSDIR) $<
+ifneq ($(findstring $(ARCH),aarch64 arm),)
+CLASSES_DEPS_CPU:=$(CLASSES_DEPS_CPU) $(INTRINSICSUNIT)$(PPUEXT)
+endif
 CLASSES_DEPS=$(CLASSESDIR)/classes.pp $(TTHREADINCDIR)/tthread.inc $(wildcard $(OBJPASDIR)/classes/*.inc) \
 	     $(SYSTEMUNIT)$(PPUEXT) $(OBJPASUNIT)$(PPUEXT) $(SORTBASEUNIT)$(PPUEXT) \
 	     $(SYSUTILSUNIT)$(PPUEXT) $(TYPINFOUNIT)$(PPUEXT) $(RTLCONSTSUNIT)$(PPUEXT) \
@@ -2562,6 +2565,13 @@ mmx$(PPUEXT) : $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
 System.CPU.MMX$(PPUEXT) : $(NSINC)/System.CPU.MMX.pp $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
+INTRINSICS_DEPS=$(PROCINC)/intrinsics.pp \
+	 $(SYSTEMUNIT)$(PPUEXT) \
+	 $(INTRINSICS_DEPS_OS) $(INTRINSICS_DEPS_CPU)
+intrinsics$(PPUEXT) : $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
+System.Intrinsics$(PPUEXT) : $(NSINC)/System.Intrinsics.pp $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
 ifeq ($(filter -dFPC_USE_LIBC,$(FPCOPT)),)
   X86_DEPS_OS+=$(SYSCALLUNIT)$(PPUEXT)
 endif

+ 10 - 0
rtl/morphos/Makefile

@@ -2462,6 +2462,9 @@ sysutils$(PPUEXT) : $(SYSUTILS_DEPS)
 	$(COMPILER) -Fi$(OBJPASDIR)/sysutils $<
 System.SysUtils$(PPUEXT) : $(NSINC)/System.SysUtils.pp $(SYSUTILS_DEPS)
 	$(COMPILER) $(SYSUTILS_OPT) -Fi$(OBJPASDIR)/sysutils -Fi$(SYSUTILSDIR) $<
+ifneq ($(findstring $(ARCH),aarch64 arm),)
+CLASSES_DEPS_CPU:=$(CLASSES_DEPS_CPU) $(INTRINSICSUNIT)$(PPUEXT)
+endif
 CLASSES_DEPS=$(CLASSESDIR)/classes.pp $(TTHREADINCDIR)/tthread.inc $(wildcard $(OBJPASDIR)/classes/*.inc) \
 	     $(SYSTEMUNIT)$(PPUEXT) $(OBJPASUNIT)$(PPUEXT) $(SORTBASEUNIT)$(PPUEXT) \
 	     $(SYSUTILSUNIT)$(PPUEXT) $(TYPINFOUNIT)$(PPUEXT) $(RTLCONSTSUNIT)$(PPUEXT) \
@@ -2545,6 +2548,13 @@ mmx$(PPUEXT) : $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
 System.CPU.MMX$(PPUEXT) : $(NSINC)/System.CPU.MMX.pp $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
+INTRINSICS_DEPS=$(PROCINC)/intrinsics.pp \
+	 $(SYSTEMUNIT)$(PPUEXT) \
+	 $(INTRINSICS_DEPS_OS) $(INTRINSICS_DEPS_CPU)
+intrinsics$(PPUEXT) : $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
+System.Intrinsics$(PPUEXT) : $(NSINC)/System.Intrinsics.pp $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
 ifeq ($(filter -dFPC_USE_LIBC,$(FPCOPT)),)
   X86_DEPS_OS+=$(SYSCALLUNIT)$(PPUEXT)
 endif

+ 10 - 0
rtl/msdos/Makefile

@@ -2493,6 +2493,9 @@ sysutils$(PPUEXT) : $(SYSUTILS_DEPS)
 	$(COMPILER) -Fi$(OBJPASDIR)/sysutils $<
 System.SysUtils$(PPUEXT) : $(NSINC)/System.SysUtils.pp $(SYSUTILS_DEPS)
 	$(COMPILER) $(SYSUTILS_OPT) -Fi$(OBJPASDIR)/sysutils -Fi$(SYSUTILSDIR) $<
+ifneq ($(findstring $(ARCH),aarch64 arm),)
+CLASSES_DEPS_CPU:=$(CLASSES_DEPS_CPU) $(INTRINSICSUNIT)$(PPUEXT)
+endif
 CLASSES_DEPS=$(CLASSESDIR)/classes.pp $(TTHREADINCDIR)/tthread.inc $(wildcard $(OBJPASDIR)/classes/*.inc) \
 	     $(SYSTEMUNIT)$(PPUEXT) $(OBJPASUNIT)$(PPUEXT) $(SORTBASEUNIT)$(PPUEXT) \
 	     $(SYSUTILSUNIT)$(PPUEXT) $(TYPINFOUNIT)$(PPUEXT) $(RTLCONSTSUNIT)$(PPUEXT) \
@@ -2576,6 +2579,13 @@ mmx$(PPUEXT) : $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
 System.CPU.MMX$(PPUEXT) : $(NSINC)/System.CPU.MMX.pp $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
+INTRINSICS_DEPS=$(PROCINC)/intrinsics.pp \
+	 $(SYSTEMUNIT)$(PPUEXT) \
+	 $(INTRINSICS_DEPS_OS) $(INTRINSICS_DEPS_CPU)
+intrinsics$(PPUEXT) : $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
+System.Intrinsics$(PPUEXT) : $(NSINC)/System.Intrinsics.pp $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
 ifeq ($(filter -dFPC_USE_LIBC,$(FPCOPT)),)
   X86_DEPS_OS+=$(SYSCALLUNIT)$(PPUEXT)
 endif

+ 10 - 0
rtl/msxdos/Makefile

@@ -2463,6 +2463,9 @@ sysutils$(PPUEXT) : $(SYSUTILS_DEPS)
 	$(COMPILER) -Fi$(OBJPASDIR)/sysutils $<
 System.SysUtils$(PPUEXT) : $(NSINC)/System.SysUtils.pp $(SYSUTILS_DEPS)
 	$(COMPILER) $(SYSUTILS_OPT) -Fi$(OBJPASDIR)/sysutils -Fi$(SYSUTILSDIR) $<
+ifneq ($(findstring $(ARCH),aarch64 arm),)
+CLASSES_DEPS_CPU:=$(CLASSES_DEPS_CPU) $(INTRINSICSUNIT)$(PPUEXT)
+endif
 CLASSES_DEPS=$(CLASSESDIR)/classes.pp $(TTHREADINCDIR)/tthread.inc $(wildcard $(OBJPASDIR)/classes/*.inc) \
 	     $(SYSTEMUNIT)$(PPUEXT) $(OBJPASUNIT)$(PPUEXT) $(SORTBASEUNIT)$(PPUEXT) \
 	     $(SYSUTILSUNIT)$(PPUEXT) $(TYPINFOUNIT)$(PPUEXT) $(RTLCONSTSUNIT)$(PPUEXT) \
@@ -2546,6 +2549,13 @@ mmx$(PPUEXT) : $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
 System.CPU.MMX$(PPUEXT) : $(NSINC)/System.CPU.MMX.pp $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
+INTRINSICS_DEPS=$(PROCINC)/intrinsics.pp \
+	 $(SYSTEMUNIT)$(PPUEXT) \
+	 $(INTRINSICS_DEPS_OS) $(INTRINSICS_DEPS_CPU)
+intrinsics$(PPUEXT) : $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
+System.Intrinsics$(PPUEXT) : $(NSINC)/System.Intrinsics.pp $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
 ifeq ($(filter -dFPC_USE_LIBC,$(FPCOPT)),)
   X86_DEPS_OS+=$(SYSCALLUNIT)$(PPUEXT)
 endif

+ 10 - 0
rtl/nativent/Makefile

@@ -2469,6 +2469,9 @@ sysutils$(PPUEXT) : $(SYSUTILS_DEPS)
 	$(COMPILER) -Fi$(OBJPASDIR)/sysutils $<
 System.SysUtils$(PPUEXT) : $(NSINC)/System.SysUtils.pp $(SYSUTILS_DEPS)
 	$(COMPILER) $(SYSUTILS_OPT) -Fi$(OBJPASDIR)/sysutils -Fi$(SYSUTILSDIR) $<
+ifneq ($(findstring $(ARCH),aarch64 arm),)
+CLASSES_DEPS_CPU:=$(CLASSES_DEPS_CPU) $(INTRINSICSUNIT)$(PPUEXT)
+endif
 CLASSES_DEPS=$(CLASSESDIR)/classes.pp $(TTHREADINCDIR)/tthread.inc $(wildcard $(OBJPASDIR)/classes/*.inc) \
 	     $(SYSTEMUNIT)$(PPUEXT) $(OBJPASUNIT)$(PPUEXT) $(SORTBASEUNIT)$(PPUEXT) \
 	     $(SYSUTILSUNIT)$(PPUEXT) $(TYPINFOUNIT)$(PPUEXT) $(RTLCONSTSUNIT)$(PPUEXT) \
@@ -2552,6 +2555,13 @@ mmx$(PPUEXT) : $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
 System.CPU.MMX$(PPUEXT) : $(NSINC)/System.CPU.MMX.pp $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
+INTRINSICS_DEPS=$(PROCINC)/intrinsics.pp \
+	 $(SYSTEMUNIT)$(PPUEXT) \
+	 $(INTRINSICS_DEPS_OS) $(INTRINSICS_DEPS_CPU)
+intrinsics$(PPUEXT) : $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
+System.Intrinsics$(PPUEXT) : $(NSINC)/System.Intrinsics.pp $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
 ifeq ($(filter -dFPC_USE_LIBC,$(FPCOPT)),)
   X86_DEPS_OS+=$(SYSCALLUNIT)$(PPUEXT)
 endif

+ 13 - 0
rtl/nds/Makefile

@@ -925,6 +925,9 @@ override FPCOPT+=-Ur
 endif
 OBJPASDIR=$(RTL)/objpas
 SYSUTILS_DEPS_OS=$(DOSUNIT)$(PPUEXT)
+ifeq ($(ARCH),arm)
+CPU_UNITS=$(INTRINSICSUNIT)
+endif
 ifeq ($(CPU_OS_TARGET),arm-nds)
 override TARGET_UNITS+=$(SYSTEMUNIT) $(UUCHARUNIT) $(OBJPASUNIT) $(MACPASUNIT) $(ISO7185UNIT) $(EXTPASUNIT) $(STRINGSUNIT) $(SORTBASEUNIT)  $(SYSUTILSUNIT) $(CLASSESUNIT)  $(MATHUNIT) $(TYPINFOUNIT) $(CTYPESUNIT)  $(CHARSETUNIT) $(CPALLUNIT) $(GETOPTSUNIT) $(FPWIDESTRINGUNIT) $(CHARACTERUNIT) $(TYPESUNIT) $(SYSCONSTUNIT) $(RTLCONSTSUNIT) $(LINEINFOUNIT) $(FGLUNIT)
 endif
@@ -2491,6 +2494,9 @@ sysutils$(PPUEXT) : $(SYSUTILS_DEPS)
 	$(COMPILER) -Fi$(OBJPASDIR)/sysutils $<
 System.SysUtils$(PPUEXT) : $(NSINC)/System.SysUtils.pp $(SYSUTILS_DEPS)
 	$(COMPILER) $(SYSUTILS_OPT) -Fi$(OBJPASDIR)/sysutils -Fi$(SYSUTILSDIR) $<
+ifneq ($(findstring $(ARCH),aarch64 arm),)
+CLASSES_DEPS_CPU:=$(CLASSES_DEPS_CPU) $(INTRINSICSUNIT)$(PPUEXT)
+endif
 CLASSES_DEPS=$(CLASSESDIR)/classes.pp $(TTHREADINCDIR)/tthread.inc $(wildcard $(OBJPASDIR)/classes/*.inc) \
 	     $(SYSTEMUNIT)$(PPUEXT) $(OBJPASUNIT)$(PPUEXT) $(SORTBASEUNIT)$(PPUEXT) \
 	     $(SYSUTILSUNIT)$(PPUEXT) $(TYPINFOUNIT)$(PPUEXT) $(RTLCONSTSUNIT)$(PPUEXT) \
@@ -2574,6 +2580,13 @@ mmx$(PPUEXT) : $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
 System.CPU.MMX$(PPUEXT) : $(NSINC)/System.CPU.MMX.pp $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
+INTRINSICS_DEPS=$(PROCINC)/intrinsics.pp \
+	 $(SYSTEMUNIT)$(PPUEXT) \
+	 $(INTRINSICS_DEPS_OS) $(INTRINSICS_DEPS_CPU)
+intrinsics$(PPUEXT) : $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
+System.Intrinsics$(PPUEXT) : $(NSINC)/System.Intrinsics.pp $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
 ifeq ($(filter -dFPC_USE_LIBC,$(FPCOPT)),)
   X86_DEPS_OS+=$(SYSCALLUNIT)$(PPUEXT)
 endif

+ 4 - 0
rtl/nds/Makefile.fpc

@@ -47,6 +47,10 @@ endif
 OBJPASDIR=$(RTL)/objpas
 SYSUTILS_DEPS_OS=$(DOSUNIT)$(PPUEXT)
 
+ifeq ($(ARCH),arm)
+CPU_UNITS=$(INTRINSICSUNIT)
+endif
+
 [rules]
 .NOTPARALLEL:
 # Get the system independent include file names.

+ 13 - 0
rtl/netbsd/Makefile

@@ -942,6 +942,9 @@ endif
 ifeq ($(ARCH),i386)
 CPU_UNITS=$(X86UNIT) $(PORTSUNIT) $(CPUUNIT) $(MMXUNIT)
 endif
+ifeq ($(ARCH),arm)
+CPU_UNITS=$(INTRINSICSUNIT)
+endif
 ifeq ($(CPU_OS_TARGET),i386-netbsd)
 override TARGET_UNITS+=$(SYSTEMUNIT) $(UUCHARUNIT) $(UNIXTYPEUNIT) $(CTYPESUNIT) $(OBJPASUNIT) $(MACPASUNIT) $(ISO7185UNIT) $(EXTPASUNIT) $(STRINGSUNIT) $(SYSCALLUNIT) $(SYSCTLUNIT)  $(BASEUNIXUNIT) $(UNIXUTILUNIT) $(CHARACTERUNIT) $(UNIXUNIT) $(RTLCONSTSUNIT) $(INITCUNIT) $(CMEMUNIT) $(DLUNIT) $(TERMIOUNIT) $(SYSUTILSUNIT) $(MATHUNIT) $(TYPINFOUNIT) $(TYPESUNIT) $(SORTBASEUNIT) $(CLASSESUNIT) $(FGLUNIT) $(DYNLIBSUNIT) $(CPU_UNITS) $(CHARSETUNIT) $(CPALLUNIT) $(GETOPTSUNIT) $(HEAPTRCUNIT) $(LNFODWRFUNIT) $(LINEINFOUNIT) $(ERRORSUNIT) $(BSDUNIT) $(SYSCONSTUNIT) $(CTHREADSUNIT) $(DOSUNIT) $(CWSTRINGUNIT) $(FPINTRESUNIT) $(UNIXCPUNIT) $(FPWIDESTRINGUNIT) $(SOFTFPUUNIT) $(SFPUX80UNIT) $(UFLOATX80UNIT) $(SFPU128UNIT) $(UFLOAT128UNIT) $(UNIX98PTYUNIT)
 endif
@@ -2601,6 +2604,9 @@ sysutils$(PPUEXT) : $(SYSUTILS_DEPS)
 	$(COMPILER) -Fi$(OBJPASDIR)/sysutils $<
 System.SysUtils$(PPUEXT) : $(NSINC)/System.SysUtils.pp $(SYSUTILS_DEPS)
 	$(COMPILER) $(SYSUTILS_OPT) -Fi$(OBJPASDIR)/sysutils -Fi$(SYSUTILSDIR) $<
+ifneq ($(findstring $(ARCH),aarch64 arm),)
+CLASSES_DEPS_CPU:=$(CLASSES_DEPS_CPU) $(INTRINSICSUNIT)$(PPUEXT)
+endif
 CLASSES_DEPS=$(CLASSESDIR)/classes.pp $(TTHREADINCDIR)/tthread.inc $(wildcard $(OBJPASDIR)/classes/*.inc) \
 	     $(SYSTEMUNIT)$(PPUEXT) $(OBJPASUNIT)$(PPUEXT) $(SORTBASEUNIT)$(PPUEXT) \
 	     $(SYSUTILSUNIT)$(PPUEXT) $(TYPINFOUNIT)$(PPUEXT) $(RTLCONSTSUNIT)$(PPUEXT) \
@@ -2684,6 +2690,13 @@ mmx$(PPUEXT) : $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
 System.CPU.MMX$(PPUEXT) : $(NSINC)/System.CPU.MMX.pp $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
+INTRINSICS_DEPS=$(PROCINC)/intrinsics.pp \
+	 $(SYSTEMUNIT)$(PPUEXT) \
+	 $(INTRINSICS_DEPS_OS) $(INTRINSICS_DEPS_CPU)
+intrinsics$(PPUEXT) : $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
+System.Intrinsics$(PPUEXT) : $(NSINC)/System.Intrinsics.pp $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
 ifeq ($(filter -dFPC_USE_LIBC,$(FPCOPT)),)
   X86_DEPS_OS+=$(SYSCALLUNIT)$(PPUEXT)
 endif

+ 3 - 1
rtl/netbsd/Makefile.fpc

@@ -83,7 +83,9 @@ endif
 ifeq ($(ARCH),i386)
 CPU_UNITS=$(X86UNIT) $(PORTSUNIT) $(CPUUNIT) $(MMXUNIT)
 endif
-
+ifeq ($(ARCH),arm)
+CPU_UNITS=$(INTRINSICSUNIT)
+endif
 
 [rules]
 .NOTPARALLEL:

+ 10 - 0
rtl/netware/Makefile

@@ -2506,6 +2506,9 @@ sysutils$(PPUEXT) : $(SYSUTILS_DEPS)
 	$(COMPILER) -Fi$(OBJPASDIR)/sysutils $<
 System.SysUtils$(PPUEXT) : $(NSINC)/System.SysUtils.pp $(SYSUTILS_DEPS)
 	$(COMPILER) $(SYSUTILS_OPT) -Fi$(OBJPASDIR)/sysutils -Fi$(SYSUTILSDIR) $<
+ifneq ($(findstring $(ARCH),aarch64 arm),)
+CLASSES_DEPS_CPU:=$(CLASSES_DEPS_CPU) $(INTRINSICSUNIT)$(PPUEXT)
+endif
 CLASSES_DEPS=$(CLASSESDIR)/classes.pp $(TTHREADINCDIR)/tthread.inc $(wildcard $(OBJPASDIR)/classes/*.inc) \
 	     $(SYSTEMUNIT)$(PPUEXT) $(OBJPASUNIT)$(PPUEXT) $(SORTBASEUNIT)$(PPUEXT) \
 	     $(SYSUTILSUNIT)$(PPUEXT) $(TYPINFOUNIT)$(PPUEXT) $(RTLCONSTSUNIT)$(PPUEXT) \
@@ -2589,6 +2592,13 @@ mmx$(PPUEXT) : $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
 System.CPU.MMX$(PPUEXT) : $(NSINC)/System.CPU.MMX.pp $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
+INTRINSICS_DEPS=$(PROCINC)/intrinsics.pp \
+	 $(SYSTEMUNIT)$(PPUEXT) \
+	 $(INTRINSICS_DEPS_OS) $(INTRINSICS_DEPS_CPU)
+intrinsics$(PPUEXT) : $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
+System.Intrinsics$(PPUEXT) : $(NSINC)/System.Intrinsics.pp $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
 ifeq ($(filter -dFPC_USE_LIBC,$(FPCOPT)),)
   X86_DEPS_OS+=$(SYSCALLUNIT)$(PPUEXT)
 endif

+ 10 - 0
rtl/netwlibc/Makefile

@@ -2494,6 +2494,9 @@ sysutils$(PPUEXT) : $(SYSUTILS_DEPS)
 	$(COMPILER) -Fi$(OBJPASDIR)/sysutils $<
 System.SysUtils$(PPUEXT) : $(NSINC)/System.SysUtils.pp $(SYSUTILS_DEPS)
 	$(COMPILER) $(SYSUTILS_OPT) -Fi$(OBJPASDIR)/sysutils -Fi$(SYSUTILSDIR) $<
+ifneq ($(findstring $(ARCH),aarch64 arm),)
+CLASSES_DEPS_CPU:=$(CLASSES_DEPS_CPU) $(INTRINSICSUNIT)$(PPUEXT)
+endif
 CLASSES_DEPS=$(CLASSESDIR)/classes.pp $(TTHREADINCDIR)/tthread.inc $(wildcard $(OBJPASDIR)/classes/*.inc) \
 	     $(SYSTEMUNIT)$(PPUEXT) $(OBJPASUNIT)$(PPUEXT) $(SORTBASEUNIT)$(PPUEXT) \
 	     $(SYSUTILSUNIT)$(PPUEXT) $(TYPINFOUNIT)$(PPUEXT) $(RTLCONSTSUNIT)$(PPUEXT) \
@@ -2577,6 +2580,13 @@ mmx$(PPUEXT) : $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
 System.CPU.MMX$(PPUEXT) : $(NSINC)/System.CPU.MMX.pp $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
+INTRINSICS_DEPS=$(PROCINC)/intrinsics.pp \
+	 $(SYSTEMUNIT)$(PPUEXT) \
+	 $(INTRINSICS_DEPS_OS) $(INTRINSICS_DEPS_CPU)
+intrinsics$(PPUEXT) : $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
+System.Intrinsics$(PPUEXT) : $(NSINC)/System.Intrinsics.pp $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
 ifeq ($(filter -dFPC_USE_LIBC,$(FPCOPT)),)
   X86_DEPS_OS+=$(SYSCALLUNIT)$(PPUEXT)
 endif

+ 1 - 1
rtl/objpas/classes/compon.inc

@@ -512,7 +512,7 @@ end;
 Destructor TComponent.Destroy;
 begin
   Destroying;
-  FreeAndNil(FObservers);
+  FreeAndNil(FDObservers);
   RemoveFreeNotifications;
   DestroyComponents;
   If FOwner<>Nil Then FOwner.RemoveComponent(Self);

+ 10 - 0
rtl/openbsd/Makefile

@@ -2534,6 +2534,9 @@ sysutils$(PPUEXT) : $(SYSUTILS_DEPS)
 	$(COMPILER) -Fi$(OBJPASDIR)/sysutils $<
 System.SysUtils$(PPUEXT) : $(NSINC)/System.SysUtils.pp $(SYSUTILS_DEPS)
 	$(COMPILER) $(SYSUTILS_OPT) -Fi$(OBJPASDIR)/sysutils -Fi$(SYSUTILSDIR) $<
+ifneq ($(findstring $(ARCH),aarch64 arm),)
+CLASSES_DEPS_CPU:=$(CLASSES_DEPS_CPU) $(INTRINSICSUNIT)$(PPUEXT)
+endif
 CLASSES_DEPS=$(CLASSESDIR)/classes.pp $(TTHREADINCDIR)/tthread.inc $(wildcard $(OBJPASDIR)/classes/*.inc) \
 	     $(SYSTEMUNIT)$(PPUEXT) $(OBJPASUNIT)$(PPUEXT) $(SORTBASEUNIT)$(PPUEXT) \
 	     $(SYSUTILSUNIT)$(PPUEXT) $(TYPINFOUNIT)$(PPUEXT) $(RTLCONSTSUNIT)$(PPUEXT) \
@@ -2617,6 +2620,13 @@ mmx$(PPUEXT) : $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
 System.CPU.MMX$(PPUEXT) : $(NSINC)/System.CPU.MMX.pp $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
+INTRINSICS_DEPS=$(PROCINC)/intrinsics.pp \
+	 $(SYSTEMUNIT)$(PPUEXT) \
+	 $(INTRINSICS_DEPS_OS) $(INTRINSICS_DEPS_CPU)
+intrinsics$(PPUEXT) : $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
+System.Intrinsics$(PPUEXT) : $(NSINC)/System.Intrinsics.pp $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
 ifeq ($(filter -dFPC_USE_LIBC,$(FPCOPT)),)
   X86_DEPS_OS+=$(SYSCALLUNIT)$(PPUEXT)
 endif

+ 10 - 0
rtl/os2/Makefile

@@ -2498,6 +2498,9 @@ sysutils$(PPUEXT) : $(SYSUTILS_DEPS)
 	$(COMPILER) -Fi$(OBJPASDIR)/sysutils $<
 System.SysUtils$(PPUEXT) : $(NSINC)/System.SysUtils.pp $(SYSUTILS_DEPS)
 	$(COMPILER) $(SYSUTILS_OPT) -Fi$(OBJPASDIR)/sysutils -Fi$(SYSUTILSDIR) $<
+ifneq ($(findstring $(ARCH),aarch64 arm),)
+CLASSES_DEPS_CPU:=$(CLASSES_DEPS_CPU) $(INTRINSICSUNIT)$(PPUEXT)
+endif
 CLASSES_DEPS=$(CLASSESDIR)/classes.pp $(TTHREADINCDIR)/tthread.inc $(wildcard $(OBJPASDIR)/classes/*.inc) \
 	     $(SYSTEMUNIT)$(PPUEXT) $(OBJPASUNIT)$(PPUEXT) $(SORTBASEUNIT)$(PPUEXT) \
 	     $(SYSUTILSUNIT)$(PPUEXT) $(TYPINFOUNIT)$(PPUEXT) $(RTLCONSTSUNIT)$(PPUEXT) \
@@ -2581,6 +2584,13 @@ mmx$(PPUEXT) : $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
 System.CPU.MMX$(PPUEXT) : $(NSINC)/System.CPU.MMX.pp $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
+INTRINSICS_DEPS=$(PROCINC)/intrinsics.pp \
+	 $(SYSTEMUNIT)$(PPUEXT) \
+	 $(INTRINSICS_DEPS_OS) $(INTRINSICS_DEPS_CPU)
+intrinsics$(PPUEXT) : $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
+System.Intrinsics$(PPUEXT) : $(NSINC)/System.Intrinsics.pp $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
 ifeq ($(filter -dFPC_USE_LIBC,$(FPCOPT)),)
   X86_DEPS_OS+=$(SYSCALLUNIT)$(PPUEXT)
 endif

+ 13 - 0
rtl/palmos/Makefile

@@ -920,6 +920,9 @@ PROCINC=$(RTL)/$(CPU_TARGET)
 UNITPREFIX=rtl
 PRT0=prt0
 OBJPASDIR=$(RTL)/objpas
+ifeq ($(ARCH),arm)
+CPU_UNITS=$(INTRINSICSUNIT)
+endif
 ifeq ($(CPU_OS_TARGET),m68k-palmos)
 override TARGET_UNITS+=$(SYSTEMUNIT) si_prc $(UUCHARUNIT) $(OBJPASUNIT) $(ISO7185UNIT) $(STRINGSUNIT) $(CTYPESUNIT) $(CHARSETUNIT) $(CPALLUNIT) $(SYSCONSTUNIT) systraps pilot
 endif
@@ -2501,6 +2504,9 @@ sysutils$(PPUEXT) : $(SYSUTILS_DEPS)
 	$(COMPILER) -Fi$(OBJPASDIR)/sysutils $<
 System.SysUtils$(PPUEXT) : $(NSINC)/System.SysUtils.pp $(SYSUTILS_DEPS)
 	$(COMPILER) $(SYSUTILS_OPT) -Fi$(OBJPASDIR)/sysutils -Fi$(SYSUTILSDIR) $<
+ifneq ($(findstring $(ARCH),aarch64 arm),)
+CLASSES_DEPS_CPU:=$(CLASSES_DEPS_CPU) $(INTRINSICSUNIT)$(PPUEXT)
+endif
 CLASSES_DEPS=$(CLASSESDIR)/classes.pp $(TTHREADINCDIR)/tthread.inc $(wildcard $(OBJPASDIR)/classes/*.inc) \
 	     $(SYSTEMUNIT)$(PPUEXT) $(OBJPASUNIT)$(PPUEXT) $(SORTBASEUNIT)$(PPUEXT) \
 	     $(SYSUTILSUNIT)$(PPUEXT) $(TYPINFOUNIT)$(PPUEXT) $(RTLCONSTSUNIT)$(PPUEXT) \
@@ -2584,6 +2590,13 @@ mmx$(PPUEXT) : $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
 System.CPU.MMX$(PPUEXT) : $(NSINC)/System.CPU.MMX.pp $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
+INTRINSICS_DEPS=$(PROCINC)/intrinsics.pp \
+	 $(SYSTEMUNIT)$(PPUEXT) \
+	 $(INTRINSICS_DEPS_OS) $(INTRINSICS_DEPS_CPU)
+intrinsics$(PPUEXT) : $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
+System.Intrinsics$(PPUEXT) : $(NSINC)/System.Intrinsics.pp $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
 ifeq ($(filter -dFPC_USE_LIBC,$(FPCOPT)),)
   X86_DEPS_OS+=$(SYSCALLUNIT)$(PPUEXT)
 endif

+ 5 - 1
rtl/palmos/Makefile.fpc

@@ -1,5 +1,5 @@
 #
-#   Makefile.fpc for Free Pascal WinCE RTL
+#   Makefile.fpc for Free Pascal PalmOS RTL
 #
 
 [package]
@@ -56,6 +56,10 @@ PRT0=prt0
 # Paths
 OBJPASDIR=$(RTL)/objpas
 
+ifeq ($(ARCH),arm)
+CPU_UNITS=$(INTRINSICSUNIT)
+endif
+
 [rules]
 .NOTPARALLEL:
 SYSTEMPPU=syspalm.ppu

+ 1 - 1
rtl/powerpc64/math.inc

@@ -78,7 +78,7 @@ end;
   must appear at the start right after setting up the TOC pointer, but the local
   variables will cause the code generator to already insert the stack allocation
   before that... -> disable this routine for ELFv2 }
-{$if not defined(aix) and not defined(freebsd) and (not defined(linux) or (defined(_ELF_CALL) and (_ELF_CALL = 1))) }
+{$if not defined(aix) and not defined(freebsd) and (not defined(linux) or (defined(_CALL_ELF) and (_CALL_ELF = 1))) }
 
 {$define FPC_SYSTEM_HAS_QWORD_TO_DOUBLE}
 function fpc_qword_to_double(q: qword): double; compilerproc;assembler;

+ 10 - 0
rtl/ps1/Makefile

@@ -2459,6 +2459,9 @@ sysutils$(PPUEXT) : $(SYSUTILS_DEPS)
 	$(COMPILER) -Fi$(OBJPASDIR)/sysutils $<
 System.SysUtils$(PPUEXT) : $(NSINC)/System.SysUtils.pp $(SYSUTILS_DEPS)
 	$(COMPILER) $(SYSUTILS_OPT) -Fi$(OBJPASDIR)/sysutils -Fi$(SYSUTILSDIR) $<
+ifneq ($(findstring $(ARCH),aarch64 arm),)
+CLASSES_DEPS_CPU:=$(CLASSES_DEPS_CPU) $(INTRINSICSUNIT)$(PPUEXT)
+endif
 CLASSES_DEPS=$(CLASSESDIR)/classes.pp $(TTHREADINCDIR)/tthread.inc $(wildcard $(OBJPASDIR)/classes/*.inc) \
 	     $(SYSTEMUNIT)$(PPUEXT) $(OBJPASUNIT)$(PPUEXT) $(SORTBASEUNIT)$(PPUEXT) \
 	     $(SYSUTILSUNIT)$(PPUEXT) $(TYPINFOUNIT)$(PPUEXT) $(RTLCONSTSUNIT)$(PPUEXT) \
@@ -2542,6 +2545,13 @@ mmx$(PPUEXT) : $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
 System.CPU.MMX$(PPUEXT) : $(NSINC)/System.CPU.MMX.pp $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
+INTRINSICS_DEPS=$(PROCINC)/intrinsics.pp \
+	 $(SYSTEMUNIT)$(PPUEXT) \
+	 $(INTRINSICS_DEPS_OS) $(INTRINSICS_DEPS_CPU)
+intrinsics$(PPUEXT) : $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
+System.Intrinsics$(PPUEXT) : $(NSINC)/System.Intrinsics.pp $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
 ifeq ($(filter -dFPC_USE_LIBC,$(FPCOPT)),)
   X86_DEPS_OS+=$(SYSCALLUNIT)$(PPUEXT)
 endif

+ 10 - 0
rtl/sinclairql/Makefile

@@ -2490,6 +2490,9 @@ sysutils$(PPUEXT) : $(SYSUTILS_DEPS)
 	$(COMPILER) -Fi$(OBJPASDIR)/sysutils $<
 System.SysUtils$(PPUEXT) : $(NSINC)/System.SysUtils.pp $(SYSUTILS_DEPS)
 	$(COMPILER) $(SYSUTILS_OPT) -Fi$(OBJPASDIR)/sysutils -Fi$(SYSUTILSDIR) $<
+ifneq ($(findstring $(ARCH),aarch64 arm),)
+CLASSES_DEPS_CPU:=$(CLASSES_DEPS_CPU) $(INTRINSICSUNIT)$(PPUEXT)
+endif
 CLASSES_DEPS=$(CLASSESDIR)/classes.pp $(TTHREADINCDIR)/tthread.inc $(wildcard $(OBJPASDIR)/classes/*.inc) \
 	     $(SYSTEMUNIT)$(PPUEXT) $(OBJPASUNIT)$(PPUEXT) $(SORTBASEUNIT)$(PPUEXT) \
 	     $(SYSUTILSUNIT)$(PPUEXT) $(TYPINFOUNIT)$(PPUEXT) $(RTLCONSTSUNIT)$(PPUEXT) \
@@ -2573,6 +2576,13 @@ mmx$(PPUEXT) : $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
 System.CPU.MMX$(PPUEXT) : $(NSINC)/System.CPU.MMX.pp $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
+INTRINSICS_DEPS=$(PROCINC)/intrinsics.pp \
+	 $(SYSTEMUNIT)$(PPUEXT) \
+	 $(INTRINSICS_DEPS_OS) $(INTRINSICS_DEPS_CPU)
+intrinsics$(PPUEXT) : $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
+System.Intrinsics$(PPUEXT) : $(NSINC)/System.Intrinsics.pp $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
 ifeq ($(filter -dFPC_USE_LIBC,$(FPCOPT)),)
   X86_DEPS_OS+=$(SYSCALLUNIT)$(PPUEXT)
 endif

+ 10 - 0
rtl/solaris/Makefile

@@ -2506,6 +2506,9 @@ sysutils$(PPUEXT) : $(SYSUTILS_DEPS)
 	$(COMPILER) -Fi$(OBJPASDIR)/sysutils $<
 System.SysUtils$(PPUEXT) : $(NSINC)/System.SysUtils.pp $(SYSUTILS_DEPS)
 	$(COMPILER) $(SYSUTILS_OPT) -Fi$(OBJPASDIR)/sysutils -Fi$(SYSUTILSDIR) $<
+ifneq ($(findstring $(ARCH),aarch64 arm),)
+CLASSES_DEPS_CPU:=$(CLASSES_DEPS_CPU) $(INTRINSICSUNIT)$(PPUEXT)
+endif
 CLASSES_DEPS=$(CLASSESDIR)/classes.pp $(TTHREADINCDIR)/tthread.inc $(wildcard $(OBJPASDIR)/classes/*.inc) \
 	     $(SYSTEMUNIT)$(PPUEXT) $(OBJPASUNIT)$(PPUEXT) $(SORTBASEUNIT)$(PPUEXT) \
 	     $(SYSUTILSUNIT)$(PPUEXT) $(TYPINFOUNIT)$(PPUEXT) $(RTLCONSTSUNIT)$(PPUEXT) \
@@ -2589,6 +2592,13 @@ mmx$(PPUEXT) : $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
 System.CPU.MMX$(PPUEXT) : $(NSINC)/System.CPU.MMX.pp $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
+INTRINSICS_DEPS=$(PROCINC)/intrinsics.pp \
+	 $(SYSTEMUNIT)$(PPUEXT) \
+	 $(INTRINSICS_DEPS_OS) $(INTRINSICS_DEPS_CPU)
+intrinsics$(PPUEXT) : $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
+System.Intrinsics$(PPUEXT) : $(NSINC)/System.Intrinsics.pp $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
 ifeq ($(filter -dFPC_USE_LIBC,$(FPCOPT)),)
   X86_DEPS_OS+=$(SYSCALLUNIT)$(PPUEXT)
 endif

+ 11 - 1
rtl/symbian/Makefile

@@ -928,7 +928,7 @@ ifeq ($(ARCH),i386)
 CPU_UNITS=$(CPUUNIT) $(MMXUNIT)
 endif
 ifeq ($(ARCH),arm)
-CPU_UNITS=$(CPUUNIT)
+CPU_UNITS=$(CPUUNIT) $(INTRINSICSUNIT)
 endif
 ifneq ($(findstring $(ARCH),i386),)
 CPU_DEPS_CPU=$(SYSUTILSUNIT)$(PPUEXT) $(OBJPASUNIT)$(PPUEXT)
@@ -2484,6 +2484,9 @@ sysutils$(PPUEXT) : $(SYSUTILS_DEPS)
 	$(COMPILER) -Fi$(OBJPASDIR)/sysutils $<
 System.SysUtils$(PPUEXT) : $(NSINC)/System.SysUtils.pp $(SYSUTILS_DEPS)
 	$(COMPILER) $(SYSUTILS_OPT) -Fi$(OBJPASDIR)/sysutils -Fi$(SYSUTILSDIR) $<
+ifneq ($(findstring $(ARCH),aarch64 arm),)
+CLASSES_DEPS_CPU:=$(CLASSES_DEPS_CPU) $(INTRINSICSUNIT)$(PPUEXT)
+endif
 CLASSES_DEPS=$(CLASSESDIR)/classes.pp $(TTHREADINCDIR)/tthread.inc $(wildcard $(OBJPASDIR)/classes/*.inc) \
 	     $(SYSTEMUNIT)$(PPUEXT) $(OBJPASUNIT)$(PPUEXT) $(SORTBASEUNIT)$(PPUEXT) \
 	     $(SYSUTILSUNIT)$(PPUEXT) $(TYPINFOUNIT)$(PPUEXT) $(RTLCONSTSUNIT)$(PPUEXT) \
@@ -2567,6 +2570,13 @@ mmx$(PPUEXT) : $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
 System.CPU.MMX$(PPUEXT) : $(NSINC)/System.CPU.MMX.pp $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
+INTRINSICS_DEPS=$(PROCINC)/intrinsics.pp \
+	 $(SYSTEMUNIT)$(PPUEXT) \
+	 $(INTRINSICS_DEPS_OS) $(INTRINSICS_DEPS_CPU)
+intrinsics$(PPUEXT) : $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
+System.Intrinsics$(PPUEXT) : $(NSINC)/System.Intrinsics.pp $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
 ifeq ($(filter -dFPC_USE_LIBC,$(FPCOPT)),)
   X86_DEPS_OS+=$(SYSCALLUNIT)$(PPUEXT)
 endif

+ 1 - 1
rtl/symbian/Makefile.fpc

@@ -48,7 +48,7 @@ CPU_UNITS=$(CPUUNIT) $(MMXUNIT)
 endif
 
 ifeq ($(ARCH),arm)
-CPU_UNITS=$(CPUUNIT)
+CPU_UNITS=$(CPUUNIT) $(INTRINSICSUNIT)
 endif
 
 ifneq ($(findstring $(ARCH),i386),)

+ 3 - 0
rtl/unix/classes.pp

@@ -49,6 +49,9 @@ uses
   fgl,
 {$endif}
   rtlconsts,
+{$IF DEFINED(CPUARM) or DEFINED(CPUAARCH64) }
+  intrinsics,
+{$ENDIF}
   sortbase;
 {$ENDIF FPC_DOTTEDUNITS}
 

+ 10 - 0
rtl/wasip1/Makefile

@@ -2470,6 +2470,9 @@ sysutils$(PPUEXT) : $(SYSUTILS_DEPS)
 	$(COMPILER) -Fi$(OBJPASDIR)/sysutils $<
 System.SysUtils$(PPUEXT) : $(NSINC)/System.SysUtils.pp $(SYSUTILS_DEPS)
 	$(COMPILER) $(SYSUTILS_OPT) -Fi$(OBJPASDIR)/sysutils -Fi$(SYSUTILSDIR) $<
+ifneq ($(findstring $(ARCH),aarch64 arm),)
+CLASSES_DEPS_CPU:=$(CLASSES_DEPS_CPU) $(INTRINSICSUNIT)$(PPUEXT)
+endif
 CLASSES_DEPS=$(CLASSESDIR)/classes.pp $(TTHREADINCDIR)/tthread.inc $(wildcard $(OBJPASDIR)/classes/*.inc) \
 	     $(SYSTEMUNIT)$(PPUEXT) $(OBJPASUNIT)$(PPUEXT) $(SORTBASEUNIT)$(PPUEXT) \
 	     $(SYSUTILSUNIT)$(PPUEXT) $(TYPINFOUNIT)$(PPUEXT) $(RTLCONSTSUNIT)$(PPUEXT) \
@@ -2553,6 +2556,13 @@ mmx$(PPUEXT) : $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
 System.CPU.MMX$(PPUEXT) : $(NSINC)/System.CPU.MMX.pp $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
+INTRINSICS_DEPS=$(PROCINC)/intrinsics.pp \
+	 $(SYSTEMUNIT)$(PPUEXT) \
+	 $(INTRINSICS_DEPS_OS) $(INTRINSICS_DEPS_CPU)
+intrinsics$(PPUEXT) : $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
+System.Intrinsics$(PPUEXT) : $(NSINC)/System.Intrinsics.pp $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
 ifeq ($(filter -dFPC_USE_LIBC,$(FPCOPT)),)
   X86_DEPS_OS+=$(SYSCALLUNIT)$(PPUEXT)
 endif

+ 10 - 0
rtl/wasip1threads/Makefile

@@ -2470,6 +2470,9 @@ sysutils$(PPUEXT) : $(SYSUTILS_DEPS)
 	$(COMPILER) -Fi$(OBJPASDIR)/sysutils $<
 System.SysUtils$(PPUEXT) : $(NSINC)/System.SysUtils.pp $(SYSUTILS_DEPS)
 	$(COMPILER) $(SYSUTILS_OPT) -Fi$(OBJPASDIR)/sysutils -Fi$(SYSUTILSDIR) $<
+ifneq ($(findstring $(ARCH),aarch64 arm),)
+CLASSES_DEPS_CPU:=$(CLASSES_DEPS_CPU) $(INTRINSICSUNIT)$(PPUEXT)
+endif
 CLASSES_DEPS=$(CLASSESDIR)/classes.pp $(TTHREADINCDIR)/tthread.inc $(wildcard $(OBJPASDIR)/classes/*.inc) \
 	     $(SYSTEMUNIT)$(PPUEXT) $(OBJPASUNIT)$(PPUEXT) $(SORTBASEUNIT)$(PPUEXT) \
 	     $(SYSUTILSUNIT)$(PPUEXT) $(TYPINFOUNIT)$(PPUEXT) $(RTLCONSTSUNIT)$(PPUEXT) \
@@ -2553,6 +2556,13 @@ mmx$(PPUEXT) : $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
 System.CPU.MMX$(PPUEXT) : $(NSINC)/System.CPU.MMX.pp $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
+INTRINSICS_DEPS=$(PROCINC)/intrinsics.pp \
+	 $(SYSTEMUNIT)$(PPUEXT) \
+	 $(INTRINSICS_DEPS_OS) $(INTRINSICS_DEPS_CPU)
+intrinsics$(PPUEXT) : $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
+System.Intrinsics$(PPUEXT) : $(NSINC)/System.Intrinsics.pp $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
 ifeq ($(filter -dFPC_USE_LIBC,$(FPCOPT)),)
   X86_DEPS_OS+=$(SYSCALLUNIT)$(PPUEXT)
 endif

+ 10 - 0
rtl/wasip2/Makefile

@@ -2466,6 +2466,9 @@ sysutils$(PPUEXT) : $(SYSUTILS_DEPS)
 	$(COMPILER) -Fi$(OBJPASDIR)/sysutils $<
 System.SysUtils$(PPUEXT) : $(NSINC)/System.SysUtils.pp $(SYSUTILS_DEPS)
 	$(COMPILER) $(SYSUTILS_OPT) -Fi$(OBJPASDIR)/sysutils -Fi$(SYSUTILSDIR) $<
+ifneq ($(findstring $(ARCH),aarch64 arm),)
+CLASSES_DEPS_CPU:=$(CLASSES_DEPS_CPU) $(INTRINSICSUNIT)$(PPUEXT)
+endif
 CLASSES_DEPS=$(CLASSESDIR)/classes.pp $(TTHREADINCDIR)/tthread.inc $(wildcard $(OBJPASDIR)/classes/*.inc) \
 	     $(SYSTEMUNIT)$(PPUEXT) $(OBJPASUNIT)$(PPUEXT) $(SORTBASEUNIT)$(PPUEXT) \
 	     $(SYSUTILSUNIT)$(PPUEXT) $(TYPINFOUNIT)$(PPUEXT) $(RTLCONSTSUNIT)$(PPUEXT) \
@@ -2549,6 +2552,13 @@ mmx$(PPUEXT) : $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
 System.CPU.MMX$(PPUEXT) : $(NSINC)/System.CPU.MMX.pp $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
+INTRINSICS_DEPS=$(PROCINC)/intrinsics.pp \
+	 $(SYSTEMUNIT)$(PPUEXT) \
+	 $(INTRINSICS_DEPS_OS) $(INTRINSICS_DEPS_CPU)
+intrinsics$(PPUEXT) : $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
+System.Intrinsics$(PPUEXT) : $(NSINC)/System.Intrinsics.pp $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
 ifeq ($(filter -dFPC_USE_LIBC,$(FPCOPT)),)
   X86_DEPS_OS+=$(SYSCALLUNIT)$(PPUEXT)
 endif

+ 10 - 0
rtl/watcom/Makefile

@@ -2497,6 +2497,9 @@ sysutils$(PPUEXT) : $(SYSUTILS_DEPS)
 	$(COMPILER) -Fi$(OBJPASDIR)/sysutils $<
 System.SysUtils$(PPUEXT) : $(NSINC)/System.SysUtils.pp $(SYSUTILS_DEPS)
 	$(COMPILER) $(SYSUTILS_OPT) -Fi$(OBJPASDIR)/sysutils -Fi$(SYSUTILSDIR) $<
+ifneq ($(findstring $(ARCH),aarch64 arm),)
+CLASSES_DEPS_CPU:=$(CLASSES_DEPS_CPU) $(INTRINSICSUNIT)$(PPUEXT)
+endif
 CLASSES_DEPS=$(CLASSESDIR)/classes.pp $(TTHREADINCDIR)/tthread.inc $(wildcard $(OBJPASDIR)/classes/*.inc) \
 	     $(SYSTEMUNIT)$(PPUEXT) $(OBJPASUNIT)$(PPUEXT) $(SORTBASEUNIT)$(PPUEXT) \
 	     $(SYSUTILSUNIT)$(PPUEXT) $(TYPINFOUNIT)$(PPUEXT) $(RTLCONSTSUNIT)$(PPUEXT) \
@@ -2580,6 +2583,13 @@ mmx$(PPUEXT) : $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
 System.CPU.MMX$(PPUEXT) : $(NSINC)/System.CPU.MMX.pp $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
+INTRINSICS_DEPS=$(PROCINC)/intrinsics.pp \
+	 $(SYSTEMUNIT)$(PPUEXT) \
+	 $(INTRINSICS_DEPS_OS) $(INTRINSICS_DEPS_CPU)
+intrinsics$(PPUEXT) : $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
+System.Intrinsics$(PPUEXT) : $(NSINC)/System.Intrinsics.pp $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
 ifeq ($(filter -dFPC_USE_LIBC,$(FPCOPT)),)
   X86_DEPS_OS+=$(SYSCALLUNIT)$(PPUEXT)
 endif

+ 10 - 0
rtl/wii/Makefile

@@ -2460,6 +2460,9 @@ sysutils$(PPUEXT) : $(SYSUTILS_DEPS)
 	$(COMPILER) -Fi$(OBJPASDIR)/sysutils $<
 System.SysUtils$(PPUEXT) : $(NSINC)/System.SysUtils.pp $(SYSUTILS_DEPS)
 	$(COMPILER) $(SYSUTILS_OPT) -Fi$(OBJPASDIR)/sysutils -Fi$(SYSUTILSDIR) $<
+ifneq ($(findstring $(ARCH),aarch64 arm),)
+CLASSES_DEPS_CPU:=$(CLASSES_DEPS_CPU) $(INTRINSICSUNIT)$(PPUEXT)
+endif
 CLASSES_DEPS=$(CLASSESDIR)/classes.pp $(TTHREADINCDIR)/tthread.inc $(wildcard $(OBJPASDIR)/classes/*.inc) \
 	     $(SYSTEMUNIT)$(PPUEXT) $(OBJPASUNIT)$(PPUEXT) $(SORTBASEUNIT)$(PPUEXT) \
 	     $(SYSUTILSUNIT)$(PPUEXT) $(TYPINFOUNIT)$(PPUEXT) $(RTLCONSTSUNIT)$(PPUEXT) \
@@ -2543,6 +2546,13 @@ mmx$(PPUEXT) : $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
 System.CPU.MMX$(PPUEXT) : $(NSINC)/System.CPU.MMX.pp $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
+INTRINSICS_DEPS=$(PROCINC)/intrinsics.pp \
+	 $(SYSTEMUNIT)$(PPUEXT) \
+	 $(INTRINSICS_DEPS_OS) $(INTRINSICS_DEPS_CPU)
+intrinsics$(PPUEXT) : $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
+System.Intrinsics$(PPUEXT) : $(NSINC)/System.Intrinsics.pp $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
 ifeq ($(filter -dFPC_USE_LIBC,$(FPCOPT)),)
   X86_DEPS_OS+=$(SYSCALLUNIT)$(PPUEXT)
 endif

+ 1 - 1
rtl/win/sysutils.pp

@@ -701,7 +701,7 @@ begin
   Result := False;
   SetLastError(ERROR_SUCCESS);
   FN:=FileName;
-  if Not GetFileAttributesExW(PWideChar(FileName), GetFileExInfoStandard, @Data) then
+  if Not GetFileAttributesExW(PWideChar(FN), GetFileExInfoStandard, @Data) then
     exit;
   if ((Data.dwFileAttributes and faSymlink)=faSymlink) then
     begin

+ 10 - 0
rtl/win16/Makefile

@@ -2496,6 +2496,9 @@ sysutils$(PPUEXT) : $(SYSUTILS_DEPS)
 	$(COMPILER) -Fi$(OBJPASDIR)/sysutils $<
 System.SysUtils$(PPUEXT) : $(NSINC)/System.SysUtils.pp $(SYSUTILS_DEPS)
 	$(COMPILER) $(SYSUTILS_OPT) -Fi$(OBJPASDIR)/sysutils -Fi$(SYSUTILSDIR) $<
+ifneq ($(findstring $(ARCH),aarch64 arm),)
+CLASSES_DEPS_CPU:=$(CLASSES_DEPS_CPU) $(INTRINSICSUNIT)$(PPUEXT)
+endif
 CLASSES_DEPS=$(CLASSESDIR)/classes.pp $(TTHREADINCDIR)/tthread.inc $(wildcard $(OBJPASDIR)/classes/*.inc) \
 	     $(SYSTEMUNIT)$(PPUEXT) $(OBJPASUNIT)$(PPUEXT) $(SORTBASEUNIT)$(PPUEXT) \
 	     $(SYSUTILSUNIT)$(PPUEXT) $(TYPINFOUNIT)$(PPUEXT) $(RTLCONSTSUNIT)$(PPUEXT) \
@@ -2579,6 +2582,13 @@ mmx$(PPUEXT) : $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
 System.CPU.MMX$(PPUEXT) : $(NSINC)/System.CPU.MMX.pp $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
+INTRINSICS_DEPS=$(PROCINC)/intrinsics.pp \
+	 $(SYSTEMUNIT)$(PPUEXT) \
+	 $(INTRINSICS_DEPS_OS) $(INTRINSICS_DEPS_CPU)
+intrinsics$(PPUEXT) : $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
+System.Intrinsics$(PPUEXT) : $(NSINC)/System.Intrinsics.pp $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
 ifeq ($(filter -dFPC_USE_LIBC,$(FPCOPT)),)
   X86_DEPS_OS+=$(SYSCALLUNIT)$(PPUEXT)
 endif

+ 10 - 0
rtl/win32/Makefile

@@ -2507,6 +2507,9 @@ sysutils$(PPUEXT) : $(SYSUTILS_DEPS)
 	$(COMPILER) -Fi$(OBJPASDIR)/sysutils $<
 System.SysUtils$(PPUEXT) : $(NSINC)/System.SysUtils.pp $(SYSUTILS_DEPS)
 	$(COMPILER) $(SYSUTILS_OPT) -Fi$(OBJPASDIR)/sysutils -Fi$(SYSUTILSDIR) $<
+ifneq ($(findstring $(ARCH),aarch64 arm),)
+CLASSES_DEPS_CPU:=$(CLASSES_DEPS_CPU) $(INTRINSICSUNIT)$(PPUEXT)
+endif
 CLASSES_DEPS=$(CLASSESDIR)/classes.pp $(TTHREADINCDIR)/tthread.inc $(wildcard $(OBJPASDIR)/classes/*.inc) \
 	     $(SYSTEMUNIT)$(PPUEXT) $(OBJPASUNIT)$(PPUEXT) $(SORTBASEUNIT)$(PPUEXT) \
 	     $(SYSUTILSUNIT)$(PPUEXT) $(TYPINFOUNIT)$(PPUEXT) $(RTLCONSTSUNIT)$(PPUEXT) \
@@ -2590,6 +2593,13 @@ mmx$(PPUEXT) : $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
 System.CPU.MMX$(PPUEXT) : $(NSINC)/System.CPU.MMX.pp $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
+INTRINSICS_DEPS=$(PROCINC)/intrinsics.pp \
+	 $(SYSTEMUNIT)$(PPUEXT) \
+	 $(INTRINSICS_DEPS_OS) $(INTRINSICS_DEPS_CPU)
+intrinsics$(PPUEXT) : $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
+System.Intrinsics$(PPUEXT) : $(NSINC)/System.Intrinsics.pp $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
 ifeq ($(filter -dFPC_USE_LIBC,$(FPCOPT)),)
   X86_DEPS_OS+=$(SYSCALLUNIT)$(PPUEXT)
 endif

+ 3 - 0
rtl/win32/classes.pp

@@ -51,6 +51,9 @@ uses
   fgl,
 {$endif}
   typinfo,
+{$IF DEFINED(CPUARM) or DEFINED(CPUAARCH64) }
+  intrinsics,
+{$ENDIF}
   windows;
 {$ENDIF FPC_DOTTEDUNITS}
 

+ 13 - 0
rtl/win64/Makefile

@@ -934,6 +934,9 @@ LNFODWRF_DEPS_OS=buildrtl$(PPUEXT)
 ifeq ($(ARCH),x86_64)
 CPU_UNITS=$(CPUUNIT) $(SIGNALSUNIT)
 endif
+ifeq ($(ARCH),aarch64)
+CPU_UNITS=$(INTRINSICSUNIT)
+endif
 OBJPASDIR=$(RTL)/objpas
 WINDOWS_SOURCE_FILES=$(addprefix $(WININC)/,$(addsuffix .inc,$(WINDOWS_FILES)))
 override FPC_SYSTEM_OPT += -Fi../win
@@ -2528,6 +2531,9 @@ sysutils$(PPUEXT) : $(SYSUTILS_DEPS)
 	$(COMPILER) -Fi$(OBJPASDIR)/sysutils $<
 System.SysUtils$(PPUEXT) : $(NSINC)/System.SysUtils.pp $(SYSUTILS_DEPS)
 	$(COMPILER) $(SYSUTILS_OPT) -Fi$(OBJPASDIR)/sysutils -Fi$(SYSUTILSDIR) $<
+ifneq ($(findstring $(ARCH),aarch64 arm),)
+CLASSES_DEPS_CPU:=$(CLASSES_DEPS_CPU) $(INTRINSICSUNIT)$(PPUEXT)
+endif
 CLASSES_DEPS=$(CLASSESDIR)/classes.pp $(TTHREADINCDIR)/tthread.inc $(wildcard $(OBJPASDIR)/classes/*.inc) \
 	     $(SYSTEMUNIT)$(PPUEXT) $(OBJPASUNIT)$(PPUEXT) $(SORTBASEUNIT)$(PPUEXT) \
 	     $(SYSUTILSUNIT)$(PPUEXT) $(TYPINFOUNIT)$(PPUEXT) $(RTLCONSTSUNIT)$(PPUEXT) \
@@ -2611,6 +2617,13 @@ mmx$(PPUEXT) : $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
 System.CPU.MMX$(PPUEXT) : $(NSINC)/System.CPU.MMX.pp $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
+INTRINSICS_DEPS=$(PROCINC)/intrinsics.pp \
+	 $(SYSTEMUNIT)$(PPUEXT) \
+	 $(INTRINSICS_DEPS_OS) $(INTRINSICS_DEPS_CPU)
+intrinsics$(PPUEXT) : $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
+System.Intrinsics$(PPUEXT) : $(NSINC)/System.Intrinsics.pp $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
 ifeq ($(filter -dFPC_USE_LIBC,$(FPCOPT)),)
   X86_DEPS_OS+=$(SYSCALLUNIT)$(PPUEXT)
 endif

+ 3 - 0
rtl/win64/Makefile.fpc

@@ -73,6 +73,9 @@ ifeq ($(ARCH),x86_64)
 # signals unit is x86 specific for now
 CPU_UNITS=$(CPUUNIT) $(SIGNALSUNIT)
 endif
+ifeq ($(ARCH),aarch64)
+CPU_UNITS=$(INTRINSICSUNIT)
+endif
 
 # Paths
 OBJPASDIR=$(RTL)/objpas

+ 3 - 0
rtl/win64/classes.pp

@@ -51,6 +51,9 @@ uses
   fgl,
 {$endif}
   typinfo,
+{$IF DEFINED(CPUARM) or DEFINED(CPUAARCH64) }
+  intrinsics,
+{$ENDIF}
   windows;
 {$ENDIF FPC_DOTTEDUNITS}
 

+ 13 - 0
rtl/wince/Makefile

@@ -921,6 +921,9 @@ WINDIR=../win
 WININC=$(WINDIR)/wininc
 UNITPREFIX=rtl
 PRT0=wprt0
+ifeq ($(ARCH),arm)
+CPU_UNITS=$(INTRINSICSUNIT)
+endif
 ifeq ($(ARCH),i386)
 CPU_UNITS=$(CPUUNIT) $(MMXUNIT)
 CPU_DEPS_CPU=$(SYSUTILSUNIT)$(PPUEXT) 
@@ -2486,6 +2489,9 @@ sysutils$(PPUEXT) : $(SYSUTILS_DEPS)
 	$(COMPILER) -Fi$(OBJPASDIR)/sysutils $<
 System.SysUtils$(PPUEXT) : $(NSINC)/System.SysUtils.pp $(SYSUTILS_DEPS)
 	$(COMPILER) $(SYSUTILS_OPT) -Fi$(OBJPASDIR)/sysutils -Fi$(SYSUTILSDIR) $<
+ifneq ($(findstring $(ARCH),aarch64 arm),)
+CLASSES_DEPS_CPU:=$(CLASSES_DEPS_CPU) $(INTRINSICSUNIT)$(PPUEXT)
+endif
 CLASSES_DEPS=$(CLASSESDIR)/classes.pp $(TTHREADINCDIR)/tthread.inc $(wildcard $(OBJPASDIR)/classes/*.inc) \
 	     $(SYSTEMUNIT)$(PPUEXT) $(OBJPASUNIT)$(PPUEXT) $(SORTBASEUNIT)$(PPUEXT) \
 	     $(SYSUTILSUNIT)$(PPUEXT) $(TYPINFOUNIT)$(PPUEXT) $(RTLCONSTSUNIT)$(PPUEXT) \
@@ -2569,6 +2575,13 @@ mmx$(PPUEXT) : $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
 System.CPU.MMX$(PPUEXT) : $(NSINC)/System.CPU.MMX.pp $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
+INTRINSICS_DEPS=$(PROCINC)/intrinsics.pp \
+	 $(SYSTEMUNIT)$(PPUEXT) \
+	 $(INTRINSICS_DEPS_OS) $(INTRINSICS_DEPS_CPU)
+intrinsics$(PPUEXT) : $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
+System.Intrinsics$(PPUEXT) : $(NSINC)/System.Intrinsics.pp $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
 ifeq ($(filter -dFPC_USE_LIBC,$(FPCOPT)),)
   X86_DEPS_OS+=$(SYSCALLUNIT)$(PPUEXT)
 endif

+ 3 - 0
rtl/wince/Makefile.fpc

@@ -54,6 +54,9 @@ UNITPREFIX=rtl
 
 PRT0=wprt0
 
+ifeq ($(ARCH),arm)
+CPU_UNITS=$(INTRINSICSUNIT)
+endif
 ifeq ($(ARCH),i386)
 CPU_UNITS=$(CPUUNIT) $(MMXUNIT)
 CPU_DEPS_CPU=$(SYSUTILSUNIT)$(PPUEXT) 

+ 3 - 0
rtl/wince/classes.pp

@@ -52,6 +52,9 @@ uses
   fgl,
 {$endif}
   typinfo,
+{$IF DEFINED(CPUARM) or DEFINED(CPUAARCH64) }
+  intrinsics,
+{$ENDIF}
   windows;
 {$ENDIF FPC_DOTTEDUNITS}
 

+ 10 - 0
rtl/zxspectrum/Makefile

@@ -2459,6 +2459,9 @@ sysutils$(PPUEXT) : $(SYSUTILS_DEPS)
 	$(COMPILER) -Fi$(OBJPASDIR)/sysutils $<
 System.SysUtils$(PPUEXT) : $(NSINC)/System.SysUtils.pp $(SYSUTILS_DEPS)
 	$(COMPILER) $(SYSUTILS_OPT) -Fi$(OBJPASDIR)/sysutils -Fi$(SYSUTILSDIR) $<
+ifneq ($(findstring $(ARCH),aarch64 arm),)
+CLASSES_DEPS_CPU:=$(CLASSES_DEPS_CPU) $(INTRINSICSUNIT)$(PPUEXT)
+endif
 CLASSES_DEPS=$(CLASSESDIR)/classes.pp $(TTHREADINCDIR)/tthread.inc $(wildcard $(OBJPASDIR)/classes/*.inc) \
 	     $(SYSTEMUNIT)$(PPUEXT) $(OBJPASUNIT)$(PPUEXT) $(SORTBASEUNIT)$(PPUEXT) \
 	     $(SYSUTILSUNIT)$(PPUEXT) $(TYPINFOUNIT)$(PPUEXT) $(RTLCONSTSUNIT)$(PPUEXT) \
@@ -2542,6 +2545,13 @@ mmx$(PPUEXT) : $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
 System.CPU.MMX$(PPUEXT) : $(NSINC)/System.CPU.MMX.pp $(MMX_DEPS)
 	$(COMPILER) $(MMX_OPT) $<
+INTRINSICS_DEPS=$(PROCINC)/intrinsics.pp \
+	 $(SYSTEMUNIT)$(PPUEXT) \
+	 $(INTRINSICS_DEPS_OS) $(INTRINSICS_DEPS_CPU)
+intrinsics$(PPUEXT) : $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
+System.Intrinsics$(PPUEXT) : $(NSINC)/System.Intrinsics.pp $(INTRINSICS_DEPS)
+	$(COMPILER) $(INTRINSICS_OPT) $<
 ifeq ($(filter -dFPC_USE_LIBC,$(FPCOPT)),)
   X86_DEPS_OS+=$(SYSCALLUNIT)$(PPUEXT)
 endif

+ 16 - 0
tests/tppu/changeinlinebody/changed/testcib_bird.pas

@@ -0,0 +1,16 @@
+unit testcib_bird;
+
+{$mode objfpc}
+
+interface
+
+function Fly(w : word): word;
+
+implementation
+
+function Fly(w : word): word; inline;
+begin
+  Result:= 3 * w;
+end;
+
+end.

+ 1 - 0
tests/tppu/changeinlinebody/lib/.gitignore

@@ -0,0 +1 @@
+testcib_prog

+ 16 - 0
tests/tppu/changeinlinebody/original/testcib_bird.pas

@@ -0,0 +1,16 @@
+unit testcib_bird;
+
+{$mode objfpc}
+
+interface
+
+function Fly(w : word): word;
+
+implementation
+
+function Fly(w : word): word; inline;
+begin
+  Result:= 13 * w;
+end;
+
+end.

+ 1 - 0
tests/tppu/changeinlinebody/pkg/lib/readme.txt

@@ -0,0 +1 @@
+Output folder for tests.

+ 11 - 0
tests/tppu/changeinlinebody/pkg/testcib_ant.pas

@@ -0,0 +1,11 @@
+unit testcib_ant;
+
+{$mode objfpc}
+
+interface
+
+uses testcib_bird;
+
+implementation
+
+end.

+ 19 - 0
tests/tppu/changeinlinebody/testcib_elk.pas

@@ -0,0 +1,19 @@
+unit testcib_elk;
+
+{$mode objfpc}
+{$inline on}
+
+interface
+
+uses testcib_bird;
+
+function Run(w : word): word;
+
+implementation
+
+function Run(w : word): word;
+begin
+  Result:= 10 * Fly(w);
+end;
+
+end.

+ 6 - 0
tests/tppu/changeinlinebody/testcib_prog.pas

@@ -0,0 +1,6 @@
+{$mode objfpc}
+uses testcib_elk;
+
+begin
+  writeln(Run(2));
+end.

+ 107 - 16
tests/tppu/tcrecompile.pas

@@ -26,6 +26,7 @@ type
     procedure CleanOutputDir(Dir: string); overload;
     procedure Compile;
     procedure CheckCompiled(const Expected: TStringArray);
+    procedure MakeDateDiffer(const File1, File2: string);
     property PP: string read FPP write FPP;
     property UnitPath: string read FUnitPath write FUnitPath;
     property OutDir: string read FOutDir write FOutDir;
@@ -40,6 +41,7 @@ type
     procedure TestTwoUnits; // 2 units
     procedure TestChangeLeaf1; // prog+2 units, change leaf
     procedure TestChangeInner1; // prog+2 units, change inner unit, keep leaf
+    procedure TestChangeInlineBodyBug; // Bug: prog+1 unit plus a package of 2 units, change of inline body should change crc, but does not
 
     // inline modifier in implementation (not in interface)
     procedure TestImplInline1; // 2 units, cycle, impl inline
@@ -60,6 +62,7 @@ begin
   UnitPath:='';
   OutDir:='';
   MainSrc:='';
+  Compiled:=TStringList.Create;
 end;
 
 procedure TTestRecompile.TearDown;
@@ -119,6 +122,7 @@ var
   i: Integer;
   Line, Filename: String;
 begin
+  Compiled.Clear;
   if UnitPath='' then
     Fail('missing UnitPath, Step='+Step);
 
@@ -133,7 +137,6 @@ begin
     Fail('main src file not found "'+MainSrc+'", Step='+Step);
 
   Lines:=nil;
-  Compiled:=TStringList.Create;
   Params:=TStringList.Create;
   try
     Params.Add('-Fu'+UnitPath);
@@ -148,7 +151,7 @@ begin
       if LeftStr(Line,length('Compiling '))='Compiling ' then
       begin
         Filename:=copy(Line,length('Compiling ')+1,length(Line));
-        writeln('Compiling: ',Filename);
+        writeln('Compiling ',Filename);
         Filename:=ExtractFileName(Filename);
         if Compiled.IndexOf(Filename)<0 then
           Compiled.Add(Filename);
@@ -165,7 +168,7 @@ var
   i, j: Integer;
 begin
   for i:=0 to length(Expected)-1 do
-    if Compiled.IndexOf(Expected[i])<0 then
+    if (Compiled=nil) or (Compiled.IndexOf(Expected[i])<0) then
       Fail('missing compiling "'+Expected[i]+'", Step='+Step);
   for i:=0 to Compiled.Count-1 do
   begin
@@ -176,6 +179,20 @@ begin
   end;
 end;
 
+procedure TTestRecompile.MakeDateDiffer(const File1, File2: string);
+var
+  Age1, Age2: Int64;
+begin
+  Age1:=FileAge(File1);
+  if Age1<0 then
+    Fail('file not found "'+File1+'"');
+  Age2:=FileAge(File2);
+  if Age2<0 then
+    Fail('file not found "'+File2+'"');
+  if Age1<>Age2 then exit;
+  FileSetDate(File2,Age2-2);
+end;
+
 constructor TTestRecompile.Create;
 begin
   inherited Create;
@@ -228,10 +245,16 @@ begin
 end;
 
 procedure TTestRecompile.TestChangeLeaf1;
+var
+  Dir: String;
 begin
-  UnitPath:='changeleaf1;changeleaf1'+PathDelim+'src1';
-  OutDir:='changeleaf1'+PathDelim+'ppus';
-  MainSrc:='changeleaf1'+PathDelim+'changeleaf1_prg.pas';
+  Dir:='changeleaf1';
+  UnitPath:=Dir+';'+Dir+PathDelim+'src1';
+  OutDir:=Dir+PathDelim+'ppus';
+  MainSrc:=Dir+PathDelim+'changeleaf1_prg.pas';
+  MakeDateDiffer(
+    Dir+PathDelim+'src1'+PathDelim+'changeleaf1_bird.pas',
+    Dir+PathDelim+'src2'+PathDelim+'changeleaf1_bird.pas');
 
   Step:='First compile';
   CleanOutputDir;
@@ -239,17 +262,23 @@ begin
   CheckCompiled(['changeleaf1_prg.pas','changeleaf1_ant.pas','changeleaf1_bird.pas']);
 
   Step:='Second compile';
-  UnitPath:='changeleaf1;changeleaf1'+PathDelim+'src2';
+  UnitPath:=Dir+';'+Dir+PathDelim+'src2';
   Compile;
-  // the main src is always compiled, bird changed, so all ant must be recompiled as well
+  // the main src is always compiled, bird changed, so ant must be recompiled as well
   CheckCompiled(['changeleaf1_prg.pas','changeleaf1_ant.pas','changeleaf1_bird.pas']);
 end;
 
 procedure TTestRecompile.TestChangeInner1;
+var
+  Dir: String;
 begin
-  UnitPath:='changeinner1;changeinner1'+PathDelim+'src1';
-  OutDir:='changeinner1'+PathDelim+'ppus';
-  MainSrc:='changeinner1'+PathDelim+'changeinner1_prg.pas';
+  Dir:='changeinner1';
+  UnitPath:=Dir+';'+Dir+PathDelim+'src1';
+  OutDir:=Dir+PathDelim+'ppus';
+  MainSrc:=Dir+PathDelim+'changeinner1_prg.pas';
+  MakeDateDiffer(
+    Dir+PathDelim+'src1'+PathDelim+'changeinner1_ant.pas',
+    Dir+PathDelim+'src2'+PathDelim+'changeinner1_ant.pas');
 
   Step:='First compile';
   CleanOutputDir;
@@ -257,12 +286,65 @@ begin
   CheckCompiled(['changeinner1_prg.pas','changeinner1_ant.pas','changeinner1_bird.pas']);
 
   Step:='Second compile';
-  UnitPath:='changeinner1;changeinner1'+PathDelim+'src2';
+  UnitPath:=Dir+';'+Dir+PathDelim+'src2';
   Compile;
   // the main src is always compiled, ant changed, bird is kept
   CheckCompiled(['changeinner1_prg.pas','changeinner1_ant.pas']);
 end;
 
+procedure TTestRecompile.TestChangeInlineBodyBug;
+var
+  ProgDir, PkgDir, PkgOutDir: String;
+begin
+  // unit testcib_elk uses an inline function of unit testcib_bird
+  // elk belongs to the program, bird to the package, so they are compiled separately
+  // when the inline body of bird changes, the elk.ppu must be rebuilt too
+
+  ProgDir:='changeinlinebody'+PathDelim;
+  PkgDir:=ProgDir+'pkg';
+  PkgOutDir:=PkgDir+PathDelim+'lib';
+  MakeDateDiffer(
+    ProgDir+'original'+PathDelim+'testcib_bird.pas',
+    ProgDir+'changed'+PathDelim+'testcib_bird.pas');
+
+  // compile package containing testcib_ant.pas and testcib_bird.pas
+  Step:='Compile original package';
+  UnitPath:=PkgDir+';'+ProgDir+'original';
+  OutDir:=PkgOutDir;
+  MainSrc:=PkgDir+PathDelim+'testcib_ant.pas';
+  CleanOutputDir;
+  Compile;
+  CheckCompiled(['testcib_ant.pas','testcib_bird.pas']);
+
+  // compile program
+  Step:='Compile program with original package ppus';
+  UnitPath:=ProgDir+';'+PkgOutDir;
+  OutDir:=ProgDir+'lib';
+  MainSrc:=ProgDir+'testcib_prog.pas';
+  CleanOutputDir;
+  Compile;
+  CheckCompiled(['testcib_prog.pas','testcib_elk.pas']);
+
+  // recompile package with changed testcib_bird.pas
+  Step:='Compile changed package';
+  UnitPath:=PkgDir+';'+ProgDir+'changed';
+  OutDir:=PkgOutDir;
+  MainSrc:=PkgDir+PathDelim+'testcib_ant.pas';
+  Compile;
+  CheckCompiled(['testcib_ant.pas','testcib_bird.pas']);
+
+  // recompile program
+  Step:='Compile program with changed package ppus';
+  UnitPath:=ProgDir+';'+PkgOutDir;
+  OutDir:=ProgDir+'lib';
+  MainSrc:=ProgDir+'testcib_prog.pas';
+  Compile;
+  // fpc should compile elk:
+  //CheckCompiled(['testcib_prog.pas','testcib_elk.pas']);
+  // But it does not:
+  CheckCompiled(['testcib_prog.pas']);
+end;
+
 procedure TTestRecompile.TestImplInline1;
 // unit ant uses bird
 // unit bird impl uses ant and has a function with inline modifier in implementation
@@ -321,10 +403,19 @@ begin
 end;
 
 procedure TTestRecompile.TestImplInline3;
+var
+  Dir: String;
 begin
-  UnitPath:='implinline3;implinline3'+PathDelim+'src1';
-  OutDir:='implinline3'+PathDelim+'ppus';
-  MainSrc:='implinline3'+PathDelim+'implinline3_prg.pas';
+  Dir:='implinline3';
+  UnitPath:=Dir+';'+Dir+PathDelim+'src1';
+  OutDir:=Dir+PathDelim+'ppus';
+  MainSrc:=Dir+PathDelim+'implinline3_prg.pas';
+  MakeDateDiffer(
+    Dir+PathDelim+'src1'+PathDelim+'implinline3_ant.pas',
+    Dir+PathDelim+'src2'+PathDelim+'implinline3_ant.pas');
+  MakeDateDiffer(
+    Dir+PathDelim+'src1'+PathDelim+'implinline3_bird.pas',
+    Dir+PathDelim+'src2'+PathDelim+'implinline3_bird.pas');
 
   Step:='First compile';
   CleanOutputDir;
@@ -332,7 +423,7 @@ begin
   CheckCompiled(['implinline3_prg.pas','implinline3_ant.pas','implinline3_bird.pas']);
 
   Step:='Second compile';
-  UnitPath:='implinline3;implinline3'+PathDelim+'src2';
+  UnitPath:=Dir+';'+Dir+PathDelim+'src2';
   Compile;
   // the main src is always compiled, and the ant impl changed, so bird is also compiled
   CheckCompiled(['implinline3_prg.pas','implinline3_ant.pas','implinline3_bird.pas']);

+ 207 - 0
utils/fpdoc/newcss.inc

@@ -0,0 +1,207 @@
+
+Const
+  DefaultNewCSS : Array[0..3458] of byte = (
+      47, 42, 10, 32, 32, 36, 73,100, 58, 32,102,112,100,111, 99, 50, 46,
+      99,115,115, 44,118, 32, 49, 46, 49, 32, 50, 48, 48, 51, 47, 48, 51,
+      47, 49, 55, 32, 50, 51, 58, 48, 51, 58, 50, 48, 32,109,105, 99,104,
+      97,101,108, 32, 69,120,112, 32, 36, 10, 10, 32, 32, 68,101,102, 97,
+     117,108,116, 32,115,116,121,108,101, 32,115,104,101,101,116, 32,102,
+     111,114, 32, 70, 80, 68,111, 99, 32,114,101,102,101,114,101,110, 99,
+     101, 32,100,111, 99,117,109,101,110,116, 97,116,105,111,110, 10, 32,
+      32, 98,121, 32, 83,101, 98, 97,115,116,105, 97,110, 32, 71,117,101,
+     110,116,104,101,114, 44, 32,115,103, 64,102,114,101,101,112, 97,115,
+      99, 97,108, 46,111,114,103, 10, 10, 32, 32, 70,101,101,108, 32,102,
+     114,101,101, 32,116,111, 32,117,115,101, 32,116,104,105,115, 32,102,
+     105,108,101, 32, 97,115, 32, 97, 32,116,101,109,112,108, 97,116,101,
+      32,102,111,114, 32,121,111,117,114, 32,111,119,110, 32,115,116,121,
+     108,101, 32,115,104,101,101,116,115, 46, 10, 42, 47, 10, 10, 46,115,
+     101, 99,116,105,111,110, 32,123, 10, 32, 32,112, 97,100,100,105,110,
+     103, 58, 32, 49,114,101,109, 32, 49,114,101,109, 59, 32, 33,105,109,
+     112,111,114,116, 97,110,116, 10,125, 10, 10,100,105,118, 46, 99,111,
+     100,101, 44, 32,116,116, 44, 32,115,112, 97,110, 46,107,119, 44, 32,
+     112,114,101, 44, 32,100,105,118, 46, 99,111,100,101, 32, 97, 32,123,
+      10, 32, 32,102,111,110,116, 45,102, 97,109,105,108,121, 58, 32, 67,
+     111,117,114,105,101,114, 44, 32,109,111,110,111,115,112, 97, 99,101,
+      10,125, 10, 10, 46, 99,111,108,117,109,110, 46,108,105,115,116, 32,
+     123, 10, 32, 32,112, 97,100,100,105,110,103, 45,116,111,112, 58, 32,
+      48,112,120, 59, 10, 32, 32,112, 97,100,100,105,110,103, 45, 98,111,
+     116,116,111,109, 58, 32, 48,112,120, 59, 10,125, 10, 10, 47, 42, 32,
+     115,111,117,114, 99,101, 32,102,114, 97,103,109,101,110,116,115, 32,
+      42, 47, 10,115,112, 97,110, 46, 99,111,100,101, 32,123, 10, 32, 32,
+     119,104,105,116,101, 45,115,112, 97, 99,101, 58, 32,110,111,119,114,
+      97,112, 10,125, 10, 10, 47, 42, 32,115,121,109, 98,111,108,115, 32,
+     105,110, 32,115,111,117,114, 99,101, 32,102,114, 97,103,109,101,110,
+     116,115, 32, 42, 47, 10,115,112, 97,110, 46,115,121,109, 32,123, 10,
+      32, 32, 99,111,108,111,114, 58, 32,100, 97,114,107,114,101,100, 10,
+     125, 10, 10, 47, 42, 32,107,101,121,119,111,114,100,115, 32,105,110,
+      32,115,111,117,114, 99,101, 32,102,114, 97,103,109,101,110,116,115,
+      32, 42, 47, 10,115,112, 97,110, 46,107,119, 32,123, 10, 32, 32,102,
+     111,110,116, 45,119,101,105,103,104,116, 58, 32, 98,111,108,100, 10,
+     125, 10, 10, 47, 42, 32, 99,111,109,109,101,110,116,115, 32,105,110,
+      32,115,111,117,114, 99,101, 32,102,114, 97,103,109,101,110,116,115,
+      32, 42, 47, 10,115,112, 97,110, 46, 99,109,116, 32,123, 10, 32, 32,
+      99,111,108,111,114, 58, 32,100, 97,114,107, 99,121, 97,110, 59, 10,
+      32, 32,102,111,110,116, 45,115,116,121,108,101, 58, 32,105,116, 97,
+     108,105, 99, 10,125, 10, 10, 47, 42, 32,100,105,114,101, 99,116,105,
+     118,101,115, 32,105,110, 32,115,111,117,114, 99,101, 32,102,114, 97,
+     103,109,101,110,116,115, 32, 42, 47, 10,115,112, 97,110, 46,100,105,
+     114, 32,123, 10, 32, 32, 99,111,108,111,114, 58, 32,100, 97,114,107,
+     121,101,108,108,111,119, 59, 10, 32, 32,102,111,110,116, 45,115,116,
+     121,108,101, 58, 32,105,116, 97,108,105, 99, 10,125, 10, 10, 47, 42,
+      32,110,117,109, 98,101,114,115, 32,105,110, 32,115,111,117,114, 99,
+     101, 32,102,114, 97,103,109,101,110,116,115, 32, 42, 47, 10,115,112,
+      97,110, 46,110,117,109, 32,123, 10, 32, 32, 99,111,108,111,114, 58,
+      32,100, 97,114,107,109, 97,103,101,110,116, 97, 10,125, 10, 10, 47,
+      42, 32, 99,104, 97,114, 97, 99,116,101,114,115, 32, 40, 35, 46, 46,
+      46, 41, 32,105,110, 32,115,111,117,114, 99,101, 32,102,114, 97,103,
+     109,101,110,116,115, 32, 42, 47, 10,115,112, 97,110, 46, 99,104,114,
+      32,123, 10, 32, 32, 99,111,108,111,114, 58, 32,100, 97,114,107, 99,
+     121, 97,110, 10,125, 10, 10, 47, 42, 32,115,116,114,105,110,103,115,
+      32,105,110, 32,115,111,117,114, 99,101, 32,102,114, 97,103,109,101,
+     110,116,115, 32, 42, 47, 10,115,112, 97,110, 46,115,116,114, 32,123,
+      10, 32, 32, 99,111,108,111,114, 58, 32, 98,108,117,101, 10,125, 10,
+      10, 47, 42, 32, 97,115,115,101,109, 98,108,101,114, 32,112, 97,115,
+     115, 97,103,101,115, 32,105,110, 32,115,111,117,114, 99,101, 32,102,
+     114, 97,103,109,101,110,116,115, 32, 42, 47, 10,115,112, 97,110, 46,
+      97,115,109, 32,123, 10, 32, 32, 99,111,108,111,114, 58, 32,103,114,
+     101,101,110, 10,125, 10, 10,112, 46, 99,109,116, 32,123, 10, 32, 32,
+      99,111,108,111,114, 58, 32,103,114, 97,121, 10,125, 10, 10,115,112,
+      97,110, 46,119, 97,114,110,105,110,103, 32,123, 10, 32, 32, 99,111,
+     108,111,114, 58, 32,114,101,100, 59, 10, 32, 32,102,111,110,116, 45,
+     119,101,105,103,104,116, 58, 32, 98,111,108,100, 10,125, 10, 10, 47,
+      42, 32, 33, 33, 33, 58, 32, 72,111,119, 32,115,104,111,117,108,100,
+      32,119,101, 32,100,101,102,105,110,101, 32,116,104,105,115, 46, 46,
+      46, 63, 32, 42, 47, 10,115,112, 97,110, 46,102,105,108,101, 32,123,
+      10, 32, 32, 99,111,108,111,114, 58, 32,100, 97,114,107,103,114,101,
+     101,110, 10,125, 10, 10,115,112, 97,110, 46,102,111,111,116,101,114,
+      32,123, 10, 32, 32,102,111,110,116, 45,115,116,121,108,101, 58, 32,
+     105,116, 97,108,105, 99, 59, 10, 32, 32, 99,111,108,111,114, 58, 32,
+     100, 97,114,107, 98,108,117,101, 10,125, 10, 10,115,112, 97,110, 46,
+     116,111,103,103,108,101,116,114,101,101, 99,108,111,115,101, 32,123,
+      10, 32, 32, 32, 32, 98, 97, 99,107,103,114,111,117,110,100, 58, 32,
+     117,114,108, 40,109,105,110,117,115, 46,112,110,103, 41, 32, 99,101,
+     110,116,101,114, 32,108,101,102,116, 32,110,111, 45,114,101,112,101,
+      97,116, 59, 10, 32, 32, 32, 32,112, 97,100,100,105,110,103, 45,108,
+     101,102,116, 58, 32, 50, 48,112,120, 59, 10,125, 10,115,112, 97,110,
+      46,116,111,103,103,108,101,116,114,101,101,111,112,101,110, 32,123,
+      10, 32, 32, 32, 32, 98, 97, 99,107,103,114,111,117,110,100, 58, 32,
+     117,114,108, 40,112,108,117,115, 46,112,110,103, 41, 32, 99,101,110,
+     116,101,114, 32,108,101,102,116, 32,110,111, 45,114,101,112,101, 97,
+     116, 59, 10, 32, 32, 32, 32,112, 97,100,100,105,110,103, 45,108,101,
+     102,116, 58, 32, 50, 48,112,120, 59, 10,125, 10, 10,117,108, 46, 99,
+     108, 97,115,115,116,114,101,101,108,105,115,116, 32,108,105, 32,123,
+      32,112, 97,100,100,105,110,103, 45,108,101,102,116, 58, 32, 48,112,
+     120, 59, 32,125, 10, 10,117,108, 46, 99,108, 97,115,115,116,114,101,
+     101,108,105,115,116, 32,123, 32,108,105,115,116, 45,115,116,121,108,
+     101, 45,116,121,112,101, 58,110,111,110,101, 59, 32,125, 10, 10,108,
+     105, 46, 99,108, 97,115,115,116,114,101,101, 32,117,108, 32,123, 32,
+     100,105,115,112,108, 97,121, 58, 32, 98,108,111, 99,107, 59, 32,125,
+      10, 32, 10,108,105, 46, 99,108, 97,115,115,116,114,101,101, 99,108,
+     111,115,101,100, 32,117,108, 32,123, 32,100,105,115,112,108, 97,121,
+      58, 32,110,111,110,101, 59, 32,125, 10, 10, 32, 32, 32, 32, 32, 32,
+      32, 32, 47, 42, 32, 45, 45, 45, 32, 66, 97,115,101, 32, 83,116,114,
+     117, 99,116,117,114,101, 32, 83,116,121,108,105,110,103, 32, 45, 45,
+      45, 32, 42, 47, 10, 32, 32, 32, 32, 32, 32, 32, 32, 46,116,114,101,
+     101,118,105,101,119, 44, 32, 46,116,114,101,101,118,105,101,119, 32,
+     117,108, 32,123, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+     108,105,115,116, 45,115,116,121,108,101, 58, 32,110,111,110,101, 59,
+      32, 47, 42, 32, 82,101,109,111,118,101, 32,100,101,102, 97,117,108,
+     116, 32, 98,117,108,108,101,116,115, 32, 42, 47, 10, 32, 32, 32, 32,
+      32, 32, 32, 32, 32, 32, 32, 32,112, 97,100,100,105,110,103, 45,108,
+     101,102,116, 58, 32, 49, 53,112,120, 59, 10, 32, 32, 32, 32, 32, 32,
+      32, 32, 32, 32, 32, 32,109, 97,114,103,105,110, 58, 32, 48, 59, 10,
+      32, 32, 32, 32, 32, 32, 32, 32,125, 10, 10, 32, 32, 32, 32, 32, 32,
+      32, 32, 46,116,114,101,101,118,105,101,119, 32,108,105, 32,123, 10,
+      32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,108,105,110,101, 45,
+     104,101,105,103,104,116, 58, 32, 49, 46, 53, 59, 10, 32, 32, 32, 32,
+      32, 32, 32, 32, 32, 32, 32, 32, 99,117,114,115,111,114, 58, 32,112,
+     111,105,110,116,101,114, 59, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+      32, 32, 32,112,111,115,105,116,105,111,110, 58, 32,114,101,108, 97,
+     116,105,118,101, 59, 32, 47, 42, 32, 78,101,101,100,101,100, 32,102,
+     111,114, 32,112,111,115,105,116,105,111,110,105,110,103, 32,116,104,
+     101, 32,112,115,101,117,100,111, 45,101,108,101,109,101,110,116, 32,
+      42, 47, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,112, 97,
+     100,100,105,110,103, 45,108,101,102,116, 58, 32, 53,112,120, 59, 32,
+      47, 42, 32, 65,100,100, 32,115,111,109,101, 32,115,112, 97, 99,101,
+      32,102,111,114, 32,116,104,101, 32,105, 99,111,110, 32, 42, 47, 10,
+      32, 32, 32, 32, 32, 32, 32, 32,125, 10, 10, 32, 32, 32, 32, 32, 32,
+      32, 32, 47, 42, 32, 45, 45, 45, 32, 78,101,115,116,101,100, 32, 76,
+     105,115,116, 32, 86,105,115,105, 98,105,108,105,116,121, 32, 45, 45,
+      45, 32, 42, 47, 10, 10, 32, 32, 32, 32, 32, 32, 32, 32, 47, 42, 32,
+      72,105,100,101, 32, 97,108,108, 32,110,101,115,116,101,100, 32, 85,
+      76,115, 32, 98,121, 32,100,101,102, 97,117,108,116, 32, 42, 47, 10,
+      32, 32, 32, 32, 32, 32, 32, 32, 46,116,114,101,101,118,105,101,119,
+      32,117,108, 32,123, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+      32,100,105,115,112,108, 97,121, 58, 32,110,111,110,101, 59, 10, 32,
+      32, 32, 32, 32, 32, 32, 32,125, 10, 10, 32, 32, 32, 32, 32, 32, 32,
+      32, 47, 42, 32, 83,104,111,119, 32,116,104,101, 32,110,101,115,116,
+     101,100, 32, 85, 76, 32,119,104,101,110, 32,116,104,101, 32,112, 97,
+     114,101,110,116, 32, 76, 73, 32,104, 97,115, 32,116,104,101, 32, 39,
+     101,120,112, 97,110,100,101,100, 39, 32, 99,108, 97,115,115, 32, 42,
+      47, 10, 32, 32, 32, 32, 32, 32, 32, 32, 46,116,114,101,101,118,105,
+     101,119, 32,108,105, 46,101,120,112, 97,110,100,101,100, 32, 62, 32,
+     117,108, 32,123, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+     100,105,115,112,108, 97,121, 58, 32, 98,108,111, 99,107, 59, 10, 32,
+      32, 32, 32, 32, 32, 32, 32,125, 10, 10, 32, 32, 32, 32, 32, 32, 32,
+      32, 47, 42, 32, 45, 45, 45, 32, 73, 99,111,110, 32, 76,111,103,105,
+      99, 32,117,115,105,110,103, 32, 58, 58, 98,101,102,111,114,101, 32,
+      80,115,101,117,100,111, 45, 69,108,101,109,101,110,116, 32, 45, 45,
+      45, 32, 42, 47, 10, 32, 32, 32, 32, 32, 32, 32, 32, 10, 32, 32, 32,
+      32, 32, 32, 32, 32, 47, 42, 32, 49, 46, 32, 68,101,102, 97,117,108,
+     116, 47, 67,111,108,108, 97,112,115,101,100, 32, 83,116, 97,116,101,
+      32,102,111,114, 32, 80, 97,114,101,110,116, 32, 78,111,100,101,115,
+      32, 42, 47, 10, 32, 32, 32, 32, 32, 32, 32, 32, 46,116,114,101,101,
+     118,105,101,119, 32,108,105, 46,112, 97,114,101,110,116, 58, 58, 98,
+     101,102,111,114,101, 32,123, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+      32, 32, 32, 47, 42, 32, 82,105,103,104,116, 45,112,111,105,110,116,
+     105,110,103, 32,116,114,105, 97,110,103,108,101, 58, 32, 38, 35, 57,
+      54, 53, 54, 59, 32,111,114, 32, 92, 50, 53, 66, 56, 32, 42, 47, 10,
+      32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 99,111,110,116,101,
+     110,116, 58, 32, 39, 92, 50, 53, 66, 56, 39, 59, 32, 10, 32, 32, 32,
+      32, 32, 32, 32, 32, 32, 32, 32, 32,109, 97,114,103,105,110, 45,114,
+     105,103,104,116, 58, 32, 53,112,120, 59, 10, 32, 32, 32, 32, 32, 32,
+      32, 32, 32, 32, 32, 32, 99,111,108,111,114, 58, 32, 35, 48, 48, 55,
+      98,102,102, 59, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+     100,105,115,112,108, 97,121, 58, 32,105,110,108,105,110,101, 45, 98,
+     108,111, 99,107, 59, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+      32,102,111,110,116, 45,119,101,105,103,104,116, 58, 32, 98,111,108,
+     100, 59, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,102,111,
+     110,116, 45,115,105,122,101, 58, 32, 49, 56,112,120, 59, 32, 47, 42,
+      32, 65,100,106,117,115,116, 32,115,105,122,101, 32,116,111, 32,108,
+     111,111,107, 32,110,101, 97,116, 32, 42, 47, 10, 32, 32, 32, 32, 32,
+      32, 32, 32,125, 10, 10, 32, 32, 32, 32, 32, 32, 32, 32, 47, 42, 32,
+      50, 46, 32, 69,120,112, 97,110,100,101,100, 32, 83,116, 97,116,101,
+      32,102,111,114, 32, 80, 97,114,101,110,116, 32, 78,111,100,101,115,
+      32, 42, 47, 10, 32, 32, 32, 32, 32, 32, 32, 32, 46,116,114,101,101,
+     118,105,101,119, 32,108,105, 46,101,120,112, 97,110,100,101,100, 46,
+     112, 97,114,101,110,116, 58, 58, 98,101,102,111,114,101, 32,123, 10,
+      32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 47, 42, 32, 68,111,
+     119,110, 45,112,111,105,110,116,105,110,103, 32,116,114,105, 97,110,
+     103,108,101, 58, 32, 38, 35, 57, 54, 54, 50, 59, 32,111,114, 32, 92,
+      50, 53, 66, 69, 32, 42, 47, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+      32, 32, 32, 99,111,110,116,101,110,116, 58, 32, 39, 92, 50, 53, 66,
+      69, 39, 59, 10, 32, 32, 32, 32, 32, 32, 32, 32,125, 10, 10, 32, 32,
+      32, 32, 32, 32, 32, 32, 47, 42, 32, 51, 46, 32, 83,116,121,108,105,
+     110,103, 32,102,111,114, 32, 76,101, 97,102, 32, 78,111,100,101,115,
+      32, 40, 78,111, 32, 69,120,112, 97,110,115,105,111,110, 41, 32, 42,
+      47, 10, 32, 32, 32, 32, 32, 32, 32, 32, 47, 42, 32, 84,104,101, 32,
+     101,108,101,109,101,110,116, 32,119,105,116,104,111,117,116, 32,116,
+     104,101, 32, 39,112, 97,114,101,110,116, 39, 32, 99,108, 97,115,115,
+      32,105,115, 32, 97, 32,108,101, 97,102, 32,110,111,100,101, 32, 42,
+      47, 10, 32, 32, 32, 32, 32, 32, 32, 32, 46,116,114,101,101,118,105,
+     101,119, 32,108,105, 58,110,111,116, 40, 46,112, 97,114,101,110,116,
+      41, 58, 58, 98,101,102,111,114,101, 32,123, 10, 32, 32, 32, 32, 32,
+      32, 32, 32, 32, 32, 32, 32, 47, 42, 32, 66,108, 97, 99,107, 32, 99,
+     105,114, 99,108,101, 47,100,111,116, 32,102,111,114, 32, 97, 32,115,
+     105,109,112,108,101, 32,108,101, 97,102, 32,105, 99,111,110, 58, 32,
+      38, 35, 57, 54, 55, 57, 59, 32,111,114, 32, 92, 50, 53, 67, 70, 32,
+      42, 47, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 99,111,
+     110,116,101,110,116, 58, 32, 39, 92, 50, 53, 67, 70, 39, 59, 32, 10,
+      32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,109, 97,114,103,105,
+     110, 45,114,105,103,104,116, 58, 32, 53,112,120, 59, 10, 32, 32, 32,
+      32, 32, 32, 32, 32, 32, 32, 32, 32, 99,111,108,111,114, 58, 32,103,
+     114, 97,121, 59, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+     102,111,110,116, 45,115,105,122,101, 58, 32, 48, 46, 56,101,109, 59,
+      10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 99,117,114,115,
+     111,114, 58, 32,100,101,102, 97,117,108,116, 59, 32, 10, 32, 32, 32,
+      32, 32, 32, 32, 32,125, 10, 10);