Prechádzať zdrojové kódy

Add support for FreeBSD/PowerPC64

Curtis Hamilton 2 mesiacov pred
rodič
commit
947c30e9f1
42 zmenil súbory, kde vykonal 1327 pridanie a 35 odobranie
  1. 11 1
      Makefile
  2. 25 1
      compiler/Makefile
  3. 6 4
      compiler/options.pas
  4. 3 0
      compiler/powerpc64/cputarg.pas
  5. 2 2
      compiler/ppcgen/agppcgas.pas
  6. 2 2
      compiler/ppcgen/cgppc.pas
  7. 4 4
      compiler/ppcgen/hlcgppc.pas
  8. 2 1
      compiler/systems.inc
  9. 5 0
      compiler/systems.pas
  10. 73 0
      compiler/systems/i_bsd.pas
  11. 13 0
      compiler/systems/t_bsd.pas
  12. 16 1
      compiler/utils/Makefile
  13. 2 1
      compiler/utils/ppuutils/ppudump.pp
  14. 13 1
      installer/Makefile
  15. 4 1
      packages/Makefile
  16. 9 1
      packages/build/Makefile.pkg
  17. 8 1
      packages/cdrom/examples/Makefile
  18. 8 1
      packages/dbus/examples/Makefile
  19. 16 1
      packages/fcl-base/examples/Makefile
  20. 18 1
      packages/fcl-db/src/base/Makefile
  21. 14 1
      packages/fcl-db/src/codegen/Makefile
  22. 21 1
      packages/fcl-db/src/datadict/Makefile
  23. 20 1
      packages/fcl-db/src/dbase/Makefile
  24. 13 1
      packages/fcl-db/tests/Makefile
  25. 8 1
      packages/fpmkunit/Makefile
  26. 1 1
      packages/fpmkunit/src/fpmkunit.pp
  27. 7 1
      rtl/Makefile
  28. 25 1
      rtl/freebsd/Makefile
  29. 14 0
      rtl/freebsd/powerpc64/bsyscall.inc
  30. 115 0
      rtl/freebsd/powerpc64/cprt0.as
  31. 115 0
      rtl/freebsd/powerpc64/dllprt0.as
  32. 106 0
      rtl/freebsd/powerpc64/gprt0.as
  33. 101 0
      rtl/freebsd/powerpc64/prt0.as
  34. 88 0
      rtl/freebsd/powerpc64/si_c.inc
  35. 56 0
      rtl/freebsd/powerpc64/sighnd.inc
  36. 291 0
      rtl/freebsd/powerpc64/syscall.inc
  37. 35 0
      rtl/freebsd/powerpc64/syscallh.inc
  38. 6 0
      rtl/freebsd/signal.inc
  39. 30 0
      rtl/freebsd/ucontexth.inc
  40. 10 1
      utils/Makefile
  41. 10 1
      utils/build/Makefile.pkg
  42. 1 1
      utils/fpcm/fpcmmain.pp

+ 11 - 1
Makefile

@@ -2,7 +2,7 @@
 # Don't edit, this file is generated by FPCMake Version 2.0.0
 #
 default: help
-MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim i386-android i386-aros m68k-linux m68k-netbsd m68k-amiga m68k-atari m68k-palmos m68k-macosclassic m68k-embedded m68k-sinclairql m68k-human68k powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macosclassic powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii powerpc-aix sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-haiku x86_64-netbsd x86_64-solaris x86_64-openbsd x86_64-darwin x86_64-win64 x86_64-embedded x86_64-iphonesim x86_64-android x86_64-aros x86_64-dragonfly arm-linux arm-netbsd arm-palmos arm-wince arm-gba arm-nds arm-embedded arm-symbian arm-android arm-aros arm-freertos arm-ios powerpc64-linux powerpc64-darwin powerpc64-embedded powerpc64-aix avr-embedded armeb-linux armeb-embedded mips-linux mipsel-linux mipsel-embedded mipsel-android mipsel-ps1 mips64-linux mips64el-linux jvm-java jvm-android i8086-embedded i8086-msdos i8086-win16 aarch64-linux aarch64-freebsd aarch64-darwin aarch64-win64 aarch64-embedded aarch64-iphonesim aarch64-android aarch64-ios wasm32-embedded wasm32-wasip1 wasm32-wasip1threads wasm32-wasip2 sparc64-linux riscv32-linux riscv32-embedded riscv32-freertos riscv64-linux riscv64-embedded xtensa-linux xtensa-embedded xtensa-freertos z80-embedded z80-zxspectrum z80-msxdos z80-amstradcpc loongarch64-linux
+MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim i386-android i386-aros m68k-linux m68k-netbsd m68k-amiga m68k-atari m68k-palmos m68k-macosclassic m68k-embedded m68k-sinclairql m68k-human68k powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macosclassic powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii powerpc-aix sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-haiku x86_64-netbsd x86_64-solaris x86_64-openbsd x86_64-darwin x86_64-win64 x86_64-embedded x86_64-iphonesim x86_64-android x86_64-aros x86_64-dragonfly arm-linux arm-netbsd arm-palmos arm-wince arm-gba arm-nds arm-embedded arm-symbian arm-android arm-aros arm-freertos arm-ios powerpc64-linux powerpc64-darwin powerpc64-embedded powerpc64-aix powerpc64-freebsd avr-embedded armeb-linux armeb-embedded mips-linux mipsel-linux mipsel-embedded mipsel-android mipsel-ps1 mips64-linux mips64el-linux jvm-java jvm-android i8086-embedded i8086-msdos i8086-win16 aarch64-linux aarch64-freebsd aarch64-darwin aarch64-win64 aarch64-embedded aarch64-iphonesim aarch64-android aarch64-ios wasm32-embedded wasm32-wasip1 wasm32-wasip1threads wasm32-wasip2 sparc64-linux riscv32-linux riscv32-embedded riscv32-freertos riscv64-linux riscv64-embedded xtensa-linux xtensa-embedded xtensa-freertos z80-embedded z80-zxspectrum z80-msxdos z80-amstradcpc loongarch64-linux
 BSDs = freebsd netbsd openbsd darwin dragonfly
 UNIXs = linux $(BSDs) solaris qnx haiku aix
 LIMIT83fs = go32v2 os2 emx watcom msdos win16 atari human68k
@@ -770,6 +770,9 @@ endif
 ifeq ($(CPU_OS_TARGET),powerpc64-aix)
 override TARGET_DIRS+=compiler rtl utils packages installer
 endif
+ifeq ($(CPU_OS_TARGET),powerpc64-freebsd)
+override TARGET_DIRS+=compiler rtl utils packages installer
+endif
 ifeq ($(CPU_OS_TARGET),avr-embedded)
 override TARGET_DIRS+=compiler rtl utils packages installer
 endif
@@ -2760,6 +2763,13 @@ TARGET_DIRS_UTILS=1
 TARGET_DIRS_PACKAGES=1
 TARGET_DIRS_INSTALLER=1
 endif
+ifeq ($(CPU_OS_TARGET),powerpc64-freebsd)
+TARGET_DIRS_COMPILER=1
+TARGET_DIRS_RTL=1
+TARGET_DIRS_UTILS=1
+TARGET_DIRS_PACKAGES=1
+TARGET_DIRS_INSTALLER=1
+endif
 ifeq ($(CPU_OS_TARGET),avr-embedded)
 TARGET_DIRS_COMPILER=1
 TARGET_DIRS_RTL=1

+ 25 - 1
compiler/Makefile

@@ -2,7 +2,7 @@
 # Don't edit, this file is generated by FPCMake Version 2.0.0
 #
 default: all
-MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim i386-android i386-aros m68k-linux m68k-netbsd m68k-amiga m68k-atari m68k-palmos m68k-macosclassic m68k-embedded m68k-sinclairql m68k-human68k powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macosclassic powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii powerpc-aix sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-haiku x86_64-netbsd x86_64-solaris x86_64-openbsd x86_64-darwin x86_64-win64 x86_64-embedded x86_64-iphonesim x86_64-android x86_64-aros x86_64-dragonfly arm-linux arm-netbsd arm-palmos arm-wince arm-gba arm-nds arm-embedded arm-symbian arm-android arm-aros arm-freertos arm-ios powerpc64-linux powerpc64-darwin powerpc64-embedded powerpc64-aix avr-embedded armeb-linux armeb-embedded mips-linux mipsel-linux mipsel-embedded mipsel-android mipsel-ps1 mips64-linux mips64el-linux jvm-java jvm-android i8086-embedded i8086-msdos i8086-win16 aarch64-linux aarch64-freebsd aarch64-darwin aarch64-win64 aarch64-embedded aarch64-iphonesim aarch64-android aarch64-ios wasm32-embedded wasm32-wasip1 wasm32-wasip1threads wasm32-wasip2 sparc64-linux riscv32-linux riscv32-embedded riscv32-freertos riscv64-linux riscv64-embedded xtensa-linux xtensa-embedded xtensa-freertos z80-embedded z80-zxspectrum z80-msxdos z80-amstradcpc loongarch64-linux
+MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim i386-android i386-aros m68k-linux m68k-netbsd m68k-amiga m68k-atari m68k-palmos m68k-macosclassic m68k-embedded m68k-sinclairql m68k-human68k powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macosclassic powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii powerpc-aix sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-haiku x86_64-netbsd x86_64-solaris x86_64-openbsd x86_64-darwin x86_64-win64 x86_64-embedded x86_64-iphonesim x86_64-android x86_64-aros x86_64-dragonfly arm-linux arm-netbsd arm-palmos arm-wince arm-gba arm-nds arm-embedded arm-symbian arm-android arm-aros arm-freertos arm-ios powerpc64-linux powerpc64-darwin powerpc64-embedded powerpc64-aix powerpc64-freebsd avr-embedded armeb-linux armeb-embedded mips-linux mipsel-linux mipsel-embedded mipsel-android mipsel-ps1 mips64-linux mips64el-linux jvm-java jvm-android i8086-embedded i8086-msdos i8086-win16 aarch64-linux aarch64-freebsd aarch64-darwin aarch64-win64 aarch64-embedded aarch64-iphonesim aarch64-android aarch64-ios wasm32-embedded wasm32-wasip1 wasm32-wasip1threads wasm32-wasip2 sparc64-linux riscv32-linux riscv32-embedded riscv32-freertos riscv64-linux riscv64-embedded xtensa-linux xtensa-embedded xtensa-freertos z80-embedded z80-zxspectrum z80-msxdos z80-amstradcpc loongarch64-linux
 BSDs = freebsd netbsd openbsd darwin dragonfly
 UNIXs = linux $(BSDs) solaris qnx haiku aix
 LIMIT83fs = go32v2 os2 emx watcom msdos win16 atari human68k
@@ -952,6 +952,9 @@ endif
 ifeq ($(CPU_OS_TARGET),powerpc64-aix)
 override TARGET_DIRS+=utils
 endif
+ifeq ($(CPU_OS_TARGET),powerpc64-freebsd)
+override TARGET_DIRS+=utils
+endif
 ifeq ($(CPU_OS_TARGET),avr-embedded)
 override TARGET_DIRS+=utils
 endif
@@ -1297,6 +1300,9 @@ endif
 ifeq ($(CPU_OS_TARGET),powerpc64-aix)
 override TARGET_PROGRAMS+=pp
 endif
+ifeq ($(CPU_OS_TARGET),powerpc64-freebsd)
+override TARGET_PROGRAMS+=pp
+endif
 ifeq ($(CPU_OS_TARGET),avr-embedded)
 override TARGET_PROGRAMS+=pp
 endif
@@ -1643,6 +1649,9 @@ endif
 ifeq ($(CPU_OS_TARGET),powerpc64-aix)
 override COMPILER_INCLUDEDIR+=$(CPC_TARGET)
 endif
+ifeq ($(CPU_OS_TARGET),powerpc64-freebsd)
+override COMPILER_INCLUDEDIR+=$(CPC_TARGET)
+endif
 ifeq ($(CPU_OS_TARGET),avr-embedded)
 override COMPILER_INCLUDEDIR+=$(CPC_TARGET)
 endif
@@ -1988,6 +1997,9 @@ endif
 ifeq ($(CPU_OS_TARGET),powerpc64-aix)
 override COMPILER_UNITDIR+=$(COMPILERSOURCEDIR)
 endif
+ifeq ($(CPU_OS_TARGET),powerpc64-freebsd)
+override COMPILER_UNITDIR+=$(COMPILERSOURCEDIR)
+endif
 ifeq ($(CPU_OS_TARGET),avr-embedded)
 override COMPILER_UNITDIR+=$(COMPILERSOURCEDIR)
 endif
@@ -2333,6 +2345,9 @@ endif
 ifeq ($(CPU_OS_TARGET),powerpc64-aix)
 override COMPILER_TARGETDIR+=$(CPU_UNITDIR)/bin/$(FULL_TARGET)
 endif
+ifeq ($(CPU_OS_TARGET),powerpc64-freebsd)
+override COMPILER_TARGETDIR+=$(CPU_UNITDIR)/bin/$(FULL_TARGET)
+endif
 ifeq ($(CPU_OS_TARGET),avr-embedded)
 override COMPILER_TARGETDIR+=$(CPU_UNITDIR)/bin/$(FULL_TARGET)
 endif
@@ -2678,6 +2693,9 @@ endif
 ifeq ($(CPU_OS_TARGET),powerpc64-aix)
 override COMPILER_UNITTARGETDIR+=$(CPU_UNITDIR)/units/$(FULL_TARGET)
 endif
+ifeq ($(CPU_OS_TARGET),powerpc64-freebsd)
+override COMPILER_UNITTARGETDIR+=$(CPU_UNITDIR)/units/$(FULL_TARGET)
+endif
 ifeq ($(CPU_OS_TARGET),avr-embedded)
 override COMPILER_UNITTARGETDIR+=$(CPU_UNITDIR)/units/$(FULL_TARGET)
 endif
@@ -3817,6 +3835,9 @@ endif
 ifeq ($(CPU_OS_TARGET),powerpc64-aix)
 REQUIRE_PACKAGES_RTL=1
 endif
+ifeq ($(CPU_OS_TARGET),powerpc64-freebsd)
+REQUIRE_PACKAGES_RTL=1
+endif
 ifeq ($(CPU_OS_TARGET),avr-embedded)
 REQUIRE_PACKAGES_RTL=1
 endif
@@ -4839,6 +4860,9 @@ endif
 ifeq ($(CPU_OS_TARGET),powerpc64-aix)
 TARGET_DIRS_UTILS=1
 endif
+ifeq ($(CPU_OS_TARGET),powerpc64-freebsd)
+TARGET_DIRS_UTILS=1
+endif
 ifeq ($(CPU_OS_TARGET),avr-embedded)
 TARGET_DIRS_UTILS=1
 endif

+ 6 - 4
compiler/options.pas

@@ -5883,11 +5883,13 @@ begin
     begin
       if (target_info.abi=abi_powerpc_sysv) and
          (target_info.endian=endian_little) then
-        target_info.abi:=abi_powerpc_elfv2
-      else
-        if (target_info.abi=abi_powerpc_elfv2) and
+        target_info.abi:=abi_powerpc_elfv2;
+     if (target_info.abi=abi_powerpc_elfv2) and
+         (target_info.endian=endian_big) then
+        target_info.abi:=abi_powerpc_sysv;
+	if (target_info.system=system_powerpc64_freebsd) and
          (target_info.endian=endian_big) then
-        target_info.abi:=abi_powerpc_sysv
+        target_info.abi:=abi_powerpc_elfv2;
     end;
 {$endif}
 

+ 3 - 0
compiler/powerpc64/cputarg.pas

@@ -38,6 +38,9 @@ implementation
     {$ifndef NOTARGETLINUX}
       ,t_linux
     {$endif}
+    {$ifndef NOTARGETBSD}
+      ,t_bsd
+    {$endif}
     {$ifndef NOTARGETDARWIN}
       ,t_darwin
     {$endif}

+ 2 - 2
compiler/ppcgen/agppcgas.pas

@@ -166,7 +166,7 @@ unit agppcgas;
              end;
 {$ifdef cpu64bitaddr}
            if (refaddr=addr_pic) and
-              (target_info.system=system_powerpc64_linux) then
+              (target_info.system=system_powerpc64_freebsd) or (target_info.system=system_powerpc64_linux) then
              s := s + '@got';
 {$endif cpu64bitaddr}
 
@@ -675,7 +675,7 @@ unit agppcgas;
          asmcmd: '$ENDIAN -o $OBJ $EXTRAOPT $ARCH $ASM';
 {$endif cpu64bitaddr}
          supported_targets : [system_powerpc_linux,system_powerpc_netbsd,system_powerpc_openbsd,
-                              system_powerpc_MorphOS,system_powerpc_Amiga,system_powerpc_wii,
+                              system_powerpc_MorphOS,system_powerpc_Amiga,system_powerpc_wii,system_powerpc64_freebsd,
                               system_powerpc64_linux,system_powerpc_embedded,system_powerpc64_embedded];
          flags : [af_needar,af_smartlink_sections];
          labelprefix : '.L';

+ 2 - 2
compiler/ppcgen/cgppc.pas

@@ -759,7 +759,7 @@ unit cgppc;
       l: tasmsymbol;
       ref: treference;
     begin
-      if target_info.system=system_powerpc64_linux then
+      if (target_info.system=system_powerpc64_freebsd) or (target_info.system=system_powerpc64_linux) then
         begin
           l:=current_asmdata.getasmsymbol(symbol);
           reference_reset_symbol(ref,l,0,sizeof(pint),[]);
@@ -1034,7 +1034,7 @@ unit cgppc;
           end;
 
         { if we have to create PIC, add the symbol to the TOC/GOT }
-        if (((target_info.system = system_powerpc64_linux) and
+        if (((target_info.system=system_powerpc64_freebsd) or (target_info.system = system_powerpc64_linux) and
              (cs_create_pic in current_settings.moduleswitches)) or
             (target_info.system in systems_aix+[system_powerpc_macosclassic])) and
            (assigned(ref.symbol) and

+ 4 - 4
compiler/ppcgen/hlcgppc.pas

@@ -130,7 +130,7 @@ implementation
         { use R12 for dispatch because most ABIs don't care and ELFv2
           requires it }
         cg.a_load_ref_reg(list,OS_ADDR,OS_ADDR,href,NR_R12);
-        if (target_info.system in systems_aix) or
+        if (target_info.system in systems_aix) or (target_info.system = system_powerpc64_freebsd) or
            ((target_info.system = system_powerpc64_linux) and
             (target_info.abi=abi_powerpc_sysv)) then
           begin
@@ -139,7 +139,7 @@ implementation
           end;
         list.concat(taicpu.op_reg(A_MTCTR,NR_R12));
         list.concat(taicpu.op_none(A_BCTR));
-        if (target_info.system in ([system_powerpc64_linux]+systems_aix)) then
+        if (target_info.system in ([system_powerpc64_freebsd]+[system_powerpc64_linux]+systems_aix)) then
           list.concat(taicpu.op_none(A_NOP));
       end;
 
@@ -190,7 +190,7 @@ implementation
                 list.concat(taicpu.op_sym(A_B,current_asmdata.RefAsmSymbol('.' + procdef.mangledname,AT_FUNCTION)))
               else
                 list.concat(taicpu.op_sym(A_B,current_asmdata.RefAsmSymbol(procdef.mangledname,AT_FUNCTION)));
-              if (target_info.system in ([system_powerpc64_linux]+systems_aix)) then
+              if (target_info.system in ([system_powerpc64_freebsd]+[system_powerpc64_linux]+systems_aix)) then
                 list.concat(taicpu.op_none(A_NOP));
             end;
         end;
@@ -202,7 +202,7 @@ implementation
     var
       href : treference;
     begin
-      if not(target_info.system in ([system_powerpc64_linux]+systems_aix)) then begin
+      if not(target_info.system in ([system_powerpc64_freebsd]+[system_powerpc64_linux]+systems_aix)) then begin
         inherited;
         exit;
       end;

+ 2 - 1
compiler/systems.inc

@@ -217,7 +217,8 @@
              system_m68k_human68k,      { 122 }
              system_mipsel_ps1,         { 123 }
              system_wasm32_wasip1threads,{ 124 }
-             system_wasm32_wasip2       { 125 }
+             system_wasm32_wasip2,      { 125 }
+             system_powerpc64_freebsd   { 126 }
        );
 
      type

+ 5 - 0
compiler/systems.pas

@@ -266,6 +266,7 @@ interface
                        system_riscv32_linux,system_riscv64_linux,system_xtensa_linux,system_loongarch64_linux];
        systems_dragonfly = [system_x86_64_dragonfly];
        systems_freebsd = [system_aarch64_freebsd,
+                          system_powerpc64_freebsd,
                           system_i386_freebsd,
                           system_x86_64_freebsd];
        systems_netbsd  = [system_i386_netbsd,
@@ -1069,6 +1070,10 @@ begin
      default_target(system_powerpc64_aix);
      {$define default_target_set}
     {$endif}
+    {$ifdef freebsd}
+     default_target(system_powerpc64_freebsd);
+     {$define default_target_set}
+    {$endif}
   {$endif cpupowerpc64}
   {$ifndef default_target_set}
     default_target(system_powerpc64_linux);

+ 73 - 0
compiler/systems/i_bsd.pas

@@ -182,6 +182,74 @@ unit i_bsd;
             llvmdatalayout : 'e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32-S32';
           );
 
+       system_powerpc64_freebsd_info : tsysteminfo =
+          (
+            system       : system_powerpc64_freebsd;
+            name         : 'FreeBSD for PowerPC64';
+            shortname    : 'FreeBSD';
+            flags        : [tf_needs_symbol_size,tf_needs_dwarf_cfi,tf_library_needs_pic,tf_needs_symbol_type,
+                            tf_files_case_sensitive,
+                            tf_dwarf_only_local_labels,
+                            {tf_pic_uses_got,}tf_smartlink_sections,tf_has_winlike_resources];
+            cpu          : cpu_powerpc64;
+            unit_env     : 'BSDUNITS';
+            extradefines : 'UNIX;HASUNIX;BSD';
+            exeext       : '';
+            defext       : '.def';
+            scriptext    : '.sh';
+            smartext     : '.sl';
+            unitext      : '.ppu';
+            unitlibext   : '.ppl';
+            asmext       : '.s';
+            objext       : '.o';
+            resext       : '.res';
+            resobjext    : '.or';
+            sharedlibext : '.so';
+            staticlibext : '.a';
+            staticlibprefix : 'libp';
+            sharedlibprefix : 'lib';
+            sharedClibext : '.so';
+            staticClibext : '.a';
+            staticClibprefix : 'lib';
+            sharedClibprefix : 'lib';
+            importlibprefix : 'libimp';
+            importlibext : '.a';
+            Cprefix      : '';
+            newline      : #10;
+            dirsep       : '/';
+            assem        : as_gas;
+            assemextern  : as_gas;
+            link         : ld_none;
+            linkextern   : ld_bsd;
+            ar           : ar_gnu_ar;
+            res          : res_elf;
+            dbg          : dbg_dwarf2;
+            script       : script_unix;
+            endian       : endian_big;
+            alignment    :
+              (
+                procalign       : 8;
+                loopalign       : 4;
+                jumpalign       : 0;
+                jumpalignskipmax    : 0;
+                coalescealign   : 0;
+                coalescealignskipmax: 0;
+                constalignmin   : 4;
+                constalignmax   : 16;
+                varalignmin     : 4;
+                varalignmax     : 16;
+                localalignmin   : 0;
+                localalignmax   : 16;
+                recordalignmin  : 0;
+                recordalignmax  : 16;
+                maxCrecordalign : 16
+              );
+            first_parm_offset : 8;
+            stacksize    : 10*1024*1024;
+            stackalign   : 16;
+            abi : abi_powerpc_elfv2;
+            llvmdatalayout : 'E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f128:64:64-v128:128:128-n32:64';
+          );
 
        system_x86_64_freebsd_info : tsysteminfo =
           (
@@ -845,6 +913,11 @@ initialization
      set_source_info(system_powerpc_netbsd_info);
   {$endif}
 {$endif cpupowerpc32}
+{$ifdef cpupowerpc64}
+  {$ifdef FreeBSD}
+    set_source_info(system_powerpc64_freebsd_info);
+  {$endif FreeBSD}
+{$endif powerpc64}
 {$ifdef cpuarm}
   {$ifdef NetBSD}
      set_source_info(system_arm_netbsd_info);

+ 13 - 0
compiler/systems/t_bsd.pas

@@ -751,6 +751,19 @@ initialization
   RegisterExport(system_powerpc_netbsd,texportlibbsd);
   RegisterTarget(system_powerpc_netbsd_info);
 {$endif powerpc}
+{$ifdef powerpc64}
+ {$ifdef freebsd}
+ 	{$ifdef powerpc64le}
+   		system_powerpc64_freebsd_info.endian:=endian_little;
+	 {$else}
+   		system_powerpc64_freebsd_info.endian:=endian_big;
+  	{$endif powerpc64le}
+  system_powerpc64_freebsd_info.abi:=abi_powerpc_elfv2;
+ {$endif freebsd}
+  RegisterImport(system_powerpc64_freebsd,timportlibbsd);
+  RegisterExport(system_powerpc64_freebsd,texportlibbsd);
+  RegisterTarget(system_powerpc64_freebsd_info);
+{$endif powerpc64}
 {$ifdef arm}
   RegisterImport(system_arm_netbsd,timportlibbsd);
   RegisterExport(system_arm_netbsd,texportlibbsd);

+ 16 - 1
compiler/utils/Makefile

@@ -2,7 +2,7 @@
 # Don't edit, this file is generated by FPCMake Version 2.0.0
 #
 default: all
-MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim i386-android i386-aros m68k-linux m68k-netbsd m68k-amiga m68k-atari m68k-palmos m68k-macosclassic m68k-embedded m68k-sinclairql m68k-human68k powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macosclassic powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii powerpc-aix sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-haiku x86_64-netbsd x86_64-solaris x86_64-openbsd x86_64-darwin x86_64-win64 x86_64-embedded x86_64-iphonesim x86_64-android x86_64-aros x86_64-dragonfly arm-linux arm-netbsd arm-palmos arm-wince arm-gba arm-nds arm-embedded arm-symbian arm-android arm-aros arm-freertos arm-ios powerpc64-linux powerpc64-darwin powerpc64-embedded powerpc64-aix avr-embedded armeb-linux armeb-embedded mips-linux mipsel-linux mipsel-embedded mipsel-android mipsel-ps1 mips64-linux mips64el-linux jvm-java jvm-android i8086-embedded i8086-msdos i8086-win16 aarch64-linux aarch64-freebsd aarch64-darwin aarch64-win64 aarch64-embedded aarch64-iphonesim aarch64-android aarch64-ios wasm32-embedded wasm32-wasip1 wasm32-wasip1threads wasm32-wasip2 sparc64-linux riscv32-linux riscv32-embedded riscv32-freertos riscv64-linux riscv64-embedded xtensa-linux xtensa-embedded xtensa-freertos z80-embedded z80-zxspectrum z80-msxdos z80-amstradcpc loongarch64-linux
+MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim i386-android i386-aros m68k-linux m68k-netbsd m68k-amiga m68k-atari m68k-palmos m68k-macosclassic m68k-embedded m68k-sinclairql m68k-human68k powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macosclassic powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii powerpc-aix sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-haiku x86_64-netbsd x86_64-solaris x86_64-openbsd x86_64-darwin x86_64-win64 x86_64-embedded x86_64-iphonesim x86_64-android x86_64-aros x86_64-dragonfly arm-linux arm-netbsd arm-palmos arm-wince arm-gba arm-nds arm-embedded arm-symbian arm-android arm-aros arm-freertos arm-ios powerpc64-linux powerpc64-darwin powerpc64-embedded powerpc64-aix powerpc64-freebsd avr-embedded armeb-linux armeb-embedded mips-linux mipsel-linux mipsel-embedded mipsel-android mipsel-ps1 mips64-linux mips64el-linux jvm-java jvm-android i8086-embedded i8086-msdos i8086-win16 aarch64-linux aarch64-freebsd aarch64-darwin aarch64-win64 aarch64-embedded aarch64-iphonesim aarch64-android aarch64-ios wasm32-embedded wasm32-wasip1 wasm32-wasip1threads wasm32-wasip2 sparc64-linux riscv32-linux riscv32-embedded riscv32-freertos riscv64-linux riscv64-embedded xtensa-linux xtensa-embedded xtensa-freertos z80-embedded z80-zxspectrum z80-msxdos z80-amstradcpc loongarch64-linux
 BSDs = freebsd netbsd openbsd darwin dragonfly
 UNIXs = linux $(BSDs) solaris qnx haiku aix
 LIMIT83fs = go32v2 os2 emx watcom msdos win16 atari human68k
@@ -591,6 +591,9 @@ endif
 ifeq ($(CPU_OS_TARGET),powerpc64-aix)
 override TARGET_PROGRAMS+=fpc ppufiles ppudump ppumove mka64ins mkarmins mkx86ins msg2inc mkx86inl mkz80ins
 endif
+ifeq ($(CPU_OS_TARGET),powerpc64-freebsd)
+override TARGET_PROGRAMS+=fpc ppufiles ppudump ppumove mka64ins mkarmins mkx86ins msg2inc mkx86inl mkz80ins
+endif
 ifeq ($(CPU_OS_TARGET),avr-embedded)
 override TARGET_PROGRAMS+=fpc ppufiles ppudump ppumove mka64ins mkarmins mkx86ins msg2inc mkx86inl mkz80ins
 endif
@@ -936,6 +939,9 @@ endif
 ifeq ($(CPU_OS_TARGET),powerpc64-aix)
 override CLEAN_UNITS+=ppu crc
 endif
+ifeq ($(CPU_OS_TARGET),powerpc64-freebsd)
+override CLEAN_UNITS+=ppu crc
+endif
 ifeq ($(CPU_OS_TARGET),avr-embedded)
 override CLEAN_UNITS+=ppu crc
 endif
@@ -1282,6 +1288,9 @@ endif
 ifeq ($(CPU_OS_TARGET),powerpc64-aix)
 override COMPILER_UNITDIR+=..
 endif
+ifeq ($(CPU_OS_TARGET),powerpc64-freebsd)
+override COMPILER_UNITDIR+=..
+endif
 ifeq ($(CPU_OS_TARGET),avr-embedded)
 override COMPILER_UNITDIR+=..
 endif
@@ -1627,6 +1636,9 @@ endif
 ifeq ($(CPU_OS_TARGET),powerpc64-aix)
 override COMPILER_SOURCEDIR+=..
 endif
+ifeq ($(CPU_OS_TARGET),powerpc64-freebsd)
+override COMPILER_SOURCEDIR+=..
+endif
 ifeq ($(CPU_OS_TARGET),avr-embedded)
 override COMPILER_SOURCEDIR+=..
 endif
@@ -2775,6 +2787,9 @@ endif
 ifeq ($(CPU_OS_TARGET),powerpc64-aix)
 REQUIRE_PACKAGES_RTL=1
 endif
+ifeq ($(CPU_OS_TARGET),powerpc64-freebsd)
+REQUIRE_PACKAGES_RTL=1
+endif
 ifeq ($(CPU_OS_TARGET),avr-embedded)
 REQUIRE_PACKAGES_RTL=1
 endif

+ 2 - 1
compiler/utils/ppuutils/ppudump.pp

@@ -251,7 +251,8 @@ const
   { 122 } 'Human68k-m68k',
   { 123 } 'PS1-mipsel',
   { 124 } 'WASIp1threads-WASM32',
-  { 125 } 'WASIp2-WASM32'
+  { 125 } 'WASIp2-WASM32',
+  { 126 } 'FreeBSD-powerpc64'
   );
 
 const

+ 13 - 1
installer/Makefile

@@ -2,7 +2,7 @@
 # Don't edit, this file is generated by FPCMake Version 2.0.0
 #
 default: all
-MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim i386-android i386-aros m68k-linux m68k-netbsd m68k-amiga m68k-atari m68k-palmos m68k-macosclassic m68k-embedded m68k-sinclairql m68k-human68k powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macosclassic powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii powerpc-aix sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-haiku x86_64-netbsd x86_64-solaris x86_64-openbsd x86_64-darwin x86_64-win64 x86_64-embedded x86_64-iphonesim x86_64-android x86_64-aros x86_64-dragonfly arm-linux arm-netbsd arm-palmos arm-wince arm-gba arm-nds arm-embedded arm-symbian arm-android arm-aros arm-freertos arm-ios powerpc64-linux powerpc64-darwin powerpc64-embedded powerpc64-aix avr-embedded armeb-linux armeb-embedded mips-linux mipsel-linux mipsel-embedded mipsel-android mipsel-ps1 mips64-linux mips64el-linux jvm-java jvm-android i8086-embedded i8086-msdos i8086-win16 aarch64-linux aarch64-freebsd aarch64-darwin aarch64-win64 aarch64-embedded aarch64-iphonesim aarch64-android aarch64-ios wasm32-embedded wasm32-wasip1 wasm32-wasip1threads wasm32-wasip2 sparc64-linux riscv32-linux riscv32-embedded riscv32-freertos riscv64-linux riscv64-embedded xtensa-linux xtensa-embedded xtensa-freertos z80-embedded z80-zxspectrum z80-msxdos z80-amstradcpc loongarch64-linux
+MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim i386-android i386-aros m68k-linux m68k-netbsd m68k-amiga m68k-atari m68k-palmos m68k-macosclassic m68k-embedded m68k-sinclairql m68k-human68k powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macosclassic powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii powerpc-aix sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-haiku x86_64-netbsd x86_64-solaris x86_64-openbsd x86_64-darwin x86_64-win64 x86_64-embedded x86_64-iphonesim x86_64-android x86_64-aros x86_64-dragonfly arm-linux arm-netbsd arm-palmos arm-wince arm-gba arm-nds arm-embedded arm-symbian arm-android arm-aros arm-freertos arm-ios powerpc64-linux powerpc64-darwin powerpc64-embedded powerpc64-aix powerpc64-freebsd avr-embedded armeb-linux armeb-embedded mips-linux mipsel-linux mipsel-embedded mipsel-android mipsel-ps1 mips64-linux mips64el-linux jvm-java jvm-android i8086-embedded i8086-msdos i8086-win16 aarch64-linux aarch64-freebsd aarch64-darwin aarch64-win64 aarch64-embedded aarch64-iphonesim aarch64-android aarch64-ios wasm32-embedded wasm32-wasip1 wasm32-wasip1threads wasm32-wasip2 sparc64-linux riscv32-linux riscv32-embedded riscv32-freertos riscv64-linux riscv64-embedded xtensa-linux xtensa-embedded xtensa-freertos z80-embedded z80-zxspectrum z80-msxdos z80-amstradcpc loongarch64-linux
 BSDs = freebsd netbsd openbsd darwin dragonfly
 UNIXs = linux $(BSDs) solaris qnx haiku aix
 LIMIT83fs = go32v2 os2 emx watcom msdos win16 atari human68k
@@ -662,6 +662,9 @@ endif
 ifeq ($(CPU_OS_TARGET),powerpc64-aix)
 override CLEAN_UNITS+=scroll insthelp
 endif
+ifeq ($(CPU_OS_TARGET),powerpc64-freebsd)
+override CLEAN_UNITS+=scroll insthelp
+endif
 ifeq ($(CPU_OS_TARGET),avr-embedded)
 override CLEAN_UNITS+=scroll insthelp
 endif
@@ -2316,6 +2319,15 @@ REQUIRE_PACKAGES_UNZIP=1
 REQUIRE_PACKAGES_RTL-EXTRA=1
 REQUIRE_PACKAGES_IDE=1
 endif
+ifeq ($(CPU_OS_TARGET),powerpc64-freebsd)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_RTL-UNICODE=1
+REQUIRE_PACKAGES_RTL-CONSOLE=1
+REQUIRE_PACKAGES_FV=1
+REQUIRE_PACKAGES_UNZIP=1
+REQUIRE_PACKAGES_RTL-EXTRA=1
+REQUIRE_PACKAGES_IDE=1
+endif
 ifeq ($(CPU_OS_TARGET),avr-embedded)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL-UNICODE=1

+ 4 - 1
packages/Makefile

@@ -2,7 +2,7 @@
 # Don't edit, this file is generated by FPCMake Version 2.0.0
 #
 default: all
-MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim i386-android i386-aros m68k-linux m68k-netbsd m68k-amiga m68k-atari m68k-palmos m68k-macosclassic m68k-embedded m68k-sinclairql m68k-human68k powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macosclassic powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii powerpc-aix sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-haiku x86_64-netbsd x86_64-solaris x86_64-openbsd x86_64-darwin x86_64-win64 x86_64-embedded x86_64-iphonesim x86_64-android x86_64-aros x86_64-dragonfly arm-linux arm-netbsd arm-palmos arm-wince arm-gba arm-nds arm-embedded arm-symbian arm-android arm-aros arm-freertos arm-ios powerpc64-linux powerpc64-darwin powerpc64-embedded powerpc64-aix avr-embedded armeb-linux armeb-embedded mips-linux mipsel-linux mipsel-embedded mipsel-android mipsel-ps1 mips64-linux mips64el-linux jvm-java jvm-android i8086-embedded i8086-msdos i8086-win16 aarch64-linux aarch64-freebsd aarch64-darwin aarch64-win64 aarch64-embedded aarch64-iphonesim aarch64-android aarch64-ios wasm32-embedded wasm32-wasip1 wasm32-wasip1threads wasm32-wasip2 sparc64-linux riscv32-linux riscv32-embedded riscv32-freertos riscv64-linux riscv64-embedded xtensa-linux xtensa-embedded xtensa-freertos z80-embedded z80-zxspectrum z80-msxdos z80-amstradcpc loongarch64-linux
+MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim i386-android i386-aros m68k-linux m68k-netbsd m68k-amiga m68k-atari m68k-palmos m68k-macosclassic m68k-embedded m68k-sinclairql m68k-human68k powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macosclassic powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii powerpc-aix sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-haiku x86_64-netbsd x86_64-solaris x86_64-openbsd x86_64-darwin x86_64-win64 x86_64-embedded x86_64-iphonesim x86_64-android x86_64-aros x86_64-dragonfly arm-linux arm-netbsd arm-palmos arm-wince arm-gba arm-nds arm-embedded arm-symbian arm-android arm-aros arm-freertos arm-ios powerpc64-linux powerpc64-darwin powerpc64-embedded powerpc64-aix powerpc64-freebsd avr-embedded armeb-linux armeb-embedded mips-linux mipsel-linux mipsel-embedded mipsel-android mipsel-ps1 mips64-linux mips64el-linux jvm-java jvm-android i8086-embedded i8086-msdos i8086-win16 aarch64-linux aarch64-freebsd aarch64-darwin aarch64-win64 aarch64-embedded aarch64-iphonesim aarch64-android aarch64-ios wasm32-embedded wasm32-wasip1 wasm32-wasip1threads wasm32-wasip2 sparc64-linux riscv32-linux riscv32-embedded riscv32-freertos riscv64-linux riscv64-embedded xtensa-linux xtensa-embedded xtensa-freertos z80-embedded z80-zxspectrum z80-msxdos z80-amstradcpc loongarch64-linux
 BSDs = freebsd netbsd openbsd darwin dragonfly
 UNIXs = linux $(BSDs) solaris qnx haiku aix
 LIMIT83fs = go32v2 os2 emx watcom msdos win16 atari human68k
@@ -1424,6 +1424,9 @@ endif
 ifeq ($(CPU_OS_TARGET),powerpc64-aix)
 REQUIRE_PACKAGES_RTL=1
 endif
+ifeq ($(CPU_OS_TARGET),powerpc64-freebsd)
+REQUIRE_PACKAGES_RTL=1
+endif
 ifeq ($(CPU_OS_TARGET),avr-embedded)
 REQUIRE_PACKAGES_RTL=1
 endif

+ 9 - 1
packages/build/Makefile.pkg

@@ -2,7 +2,7 @@
 # Don't edit, this file is generated by FPCMake Version 2.0.0
 #
 default: all
-MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim i386-android i386-aros m68k-linux m68k-netbsd m68k-amiga m68k-atari m68k-palmos m68k-macosclassic m68k-embedded m68k-sinclairql m68k-human68k powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macosclassic powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii powerpc-aix sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-haiku x86_64-netbsd x86_64-solaris x86_64-openbsd x86_64-darwin x86_64-win64 x86_64-embedded x86_64-iphonesim x86_64-android x86_64-aros x86_64-dragonfly arm-linux arm-netbsd arm-palmos arm-wince arm-gba arm-nds arm-embedded arm-symbian arm-android arm-aros arm-freertos arm-ios powerpc64-linux powerpc64-darwin powerpc64-embedded powerpc64-aix avr-embedded armeb-linux armeb-embedded mips-linux mipsel-linux mipsel-embedded mipsel-android mipsel-ps1 mips64-linux mips64el-linux jvm-java jvm-android i8086-embedded i8086-msdos i8086-win16 aarch64-linux aarch64-freebsd aarch64-darwin aarch64-win64 aarch64-embedded aarch64-iphonesim aarch64-android aarch64-ios wasm32-embedded wasm32-wasip1 wasm32-wasip1threads wasm32-wasip2 sparc64-linux riscv32-linux riscv32-embedded riscv32-freertos riscv64-linux riscv64-embedded xtensa-linux xtensa-embedded xtensa-freertos z80-embedded z80-zxspectrum z80-msxdos z80-amstradcpc loongarch64-linux
+MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim i386-android i386-aros m68k-linux m68k-netbsd m68k-amiga m68k-atari m68k-palmos m68k-macosclassic m68k-embedded m68k-sinclairql m68k-human68k powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macosclassic powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii powerpc-aix sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-haiku x86_64-netbsd x86_64-solaris x86_64-openbsd x86_64-darwin x86_64-win64 x86_64-embedded x86_64-iphonesim x86_64-android x86_64-aros x86_64-dragonfly arm-linux arm-netbsd arm-palmos arm-wince arm-gba arm-nds arm-embedded arm-symbian arm-android arm-aros arm-freertos arm-ios powerpc64-linux powerpc64-darwin powerpc64-embedded powerpc64-aix powerpc64-freebsd avr-embedded armeb-linux armeb-embedded mips-linux mipsel-linux mipsel-embedded mipsel-android mipsel-ps1 mips64-linux mips64el-linux jvm-java jvm-android i8086-embedded i8086-msdos i8086-win16 aarch64-linux aarch64-freebsd aarch64-darwin aarch64-win64 aarch64-embedded aarch64-iphonesim aarch64-android aarch64-ios wasm32-embedded wasm32-wasip1 wasm32-wasip1threads wasm32-wasip2 sparc64-linux riscv32-linux riscv32-embedded riscv32-freertos riscv64-linux riscv64-embedded xtensa-linux xtensa-embedded xtensa-freertos z80-embedded z80-zxspectrum z80-msxdos z80-amstradcpc loongarch64-linux
 BSDs = freebsd netbsd openbsd darwin dragonfly
 UNIXs = linux $(BSDs) solaris qnx haiku aix
 LIMIT83fs = go32v2 os2 emx watcom msdos win16 atari human68k
@@ -1763,6 +1763,14 @@ REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_LIBTAR=1
 REQUIRE_PACKAGES_FPMKUNIT=1
 endif
+ifeq ($(CPU_OS_TARGET),powerpc64-freebsd)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_LIBTAR=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+endif
 ifeq ($(CPU_OS_TARGET),avr-embedded)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PASZLIB=1

+ 8 - 1
packages/cdrom/examples/Makefile

@@ -2,7 +2,7 @@
 # Don't edit, this file is generated by FPCMake Version 2.0.0
 #
 default: all
-MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim i386-android i386-aros m68k-linux m68k-netbsd m68k-amiga m68k-atari m68k-palmos m68k-macosclassic m68k-embedded m68k-sinclairql m68k-human68k powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macosclassic powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii powerpc-aix sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-haiku x86_64-netbsd x86_64-solaris x86_64-openbsd x86_64-darwin x86_64-win64 x86_64-embedded x86_64-iphonesim x86_64-android x86_64-aros x86_64-dragonfly arm-linux arm-netbsd arm-palmos arm-wince arm-gba arm-nds arm-embedded arm-symbian arm-android arm-aros arm-freertos arm-ios powerpc64-linux powerpc64-darwin powerpc64-embedded powerpc64-aix avr-embedded armeb-linux armeb-embedded mips-linux mipsel-linux mipsel-embedded mipsel-android mipsel-ps1 mips64-linux mips64el-linux jvm-java jvm-android i8086-embedded i8086-msdos i8086-win16 aarch64-linux aarch64-freebsd aarch64-darwin aarch64-win64 aarch64-embedded aarch64-iphonesim aarch64-android aarch64-ios wasm32-embedded wasm32-wasip1 wasm32-wasip1threads wasm32-wasip2 sparc64-linux riscv32-linux riscv32-embedded riscv32-freertos riscv64-linux riscv64-embedded xtensa-linux xtensa-embedded xtensa-freertos z80-embedded z80-zxspectrum z80-msxdos z80-amstradcpc loongarch64-linux
+MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim i386-android i386-aros m68k-linux m68k-netbsd m68k-amiga m68k-atari m68k-palmos m68k-macosclassic m68k-embedded m68k-sinclairql m68k-human68k powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macosclassic powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii powerpc-aix sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-haiku x86_64-netbsd x86_64-solaris x86_64-openbsd x86_64-darwin x86_64-win64 x86_64-embedded x86_64-iphonesim x86_64-android x86_64-aros x86_64-dragonfly arm-linux arm-netbsd arm-palmos arm-wince arm-gba arm-nds arm-embedded arm-symbian arm-android arm-aros arm-freertos arm-ios powerpc64-linux powerpc64-darwin powerpc64-embedded powerpc64-aix powerpc64-freebsd avr-embedded armeb-linux armeb-embedded mips-linux mipsel-linux mipsel-embedded mipsel-android mipsel-ps1 mips64-linux mips64el-linux jvm-java jvm-android i8086-embedded i8086-msdos i8086-win16 aarch64-linux aarch64-freebsd aarch64-darwin aarch64-win64 aarch64-embedded aarch64-iphonesim aarch64-android aarch64-ios wasm32-embedded wasm32-wasip1 wasm32-wasip1threads wasm32-wasip2 sparc64-linux riscv32-linux riscv32-embedded riscv32-freertos riscv64-linux riscv64-embedded xtensa-linux xtensa-embedded xtensa-freertos z80-embedded z80-zxspectrum z80-msxdos z80-amstradcpc loongarch64-linux
 BSDs = freebsd netbsd openbsd darwin dragonfly
 UNIXs = linux $(BSDs) solaris qnx haiku aix
 LIMIT83fs = go32v2 os2 emx watcom msdos win16 atari human68k
@@ -588,6 +588,9 @@ endif
 ifeq ($(CPU_OS_TARGET),powerpc64-aix)
 override TARGET_PROGRAMS+=getdiscid showcds
 endif
+ifeq ($(CPU_OS_TARGET),powerpc64-freebsd)
+override TARGET_PROGRAMS+=getdiscid showcds
+endif
 ifeq ($(CPU_OS_TARGET),avr-embedded)
 override TARGET_PROGRAMS+=getdiscid showcds
 endif
@@ -1809,6 +1812,10 @@ ifeq ($(CPU_OS_TARGET),powerpc64-aix)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_CDROM=1
 endif
+ifeq ($(CPU_OS_TARGET),powerpc64-freebsd)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_CDROM=1
+endif
 ifeq ($(CPU_OS_TARGET),avr-embedded)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_CDROM=1

+ 8 - 1
packages/dbus/examples/Makefile

@@ -2,7 +2,7 @@
 # Don't edit, this file is generated by FPCMake Version 2.0.0
 #
 default: all
-MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim i386-android i386-aros m68k-linux m68k-netbsd m68k-amiga m68k-atari m68k-palmos m68k-macosclassic m68k-embedded m68k-sinclairql m68k-human68k powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macosclassic powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii powerpc-aix sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-haiku x86_64-netbsd x86_64-solaris x86_64-openbsd x86_64-darwin x86_64-win64 x86_64-embedded x86_64-iphonesim x86_64-android x86_64-aros x86_64-dragonfly arm-linux arm-netbsd arm-palmos arm-wince arm-gba arm-nds arm-embedded arm-symbian arm-android arm-aros arm-freertos arm-ios powerpc64-linux powerpc64-darwin powerpc64-embedded powerpc64-aix avr-embedded armeb-linux armeb-embedded mips-linux mipsel-linux mipsel-embedded mipsel-android mipsel-ps1 mips64-linux mips64el-linux jvm-java jvm-android i8086-embedded i8086-msdos i8086-win16 aarch64-linux aarch64-freebsd aarch64-darwin aarch64-win64 aarch64-embedded aarch64-iphonesim aarch64-android aarch64-ios wasm32-embedded wasm32-wasip1 wasm32-wasip1threads wasm32-wasip2 sparc64-linux riscv32-linux riscv32-embedded riscv32-freertos riscv64-linux riscv64-embedded xtensa-linux xtensa-embedded xtensa-freertos z80-embedded z80-zxspectrum z80-msxdos z80-amstradcpc loongarch64-linux
+MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim i386-android i386-aros m68k-linux m68k-netbsd m68k-amiga m68k-atari m68k-palmos m68k-macosclassic m68k-embedded m68k-sinclairql m68k-human68k powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macosclassic powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii powerpc-aix sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-haiku x86_64-netbsd x86_64-solaris x86_64-openbsd x86_64-darwin x86_64-win64 x86_64-embedded x86_64-iphonesim x86_64-android x86_64-aros x86_64-dragonfly arm-linux arm-netbsd arm-palmos arm-wince arm-gba arm-nds arm-embedded arm-symbian arm-android arm-aros arm-freertos arm-ios powerpc64-linux powerpc64-darwin powerpc64-embedded powerpc64-aix powerpc64-freebsd avr-embedded armeb-linux armeb-embedded mips-linux mipsel-linux mipsel-embedded mipsel-android mipsel-ps1 mips64-linux mips64el-linux jvm-java jvm-android i8086-embedded i8086-msdos i8086-win16 aarch64-linux aarch64-freebsd aarch64-darwin aarch64-win64 aarch64-embedded aarch64-iphonesim aarch64-android aarch64-ios wasm32-embedded wasm32-wasip1 wasm32-wasip1threads wasm32-wasip2 sparc64-linux riscv32-linux riscv32-embedded riscv32-freertos riscv64-linux riscv64-embedded xtensa-linux xtensa-embedded xtensa-freertos z80-embedded z80-zxspectrum z80-msxdos z80-amstradcpc loongarch64-linux
 BSDs = freebsd netbsd openbsd darwin dragonfly
 UNIXs = linux $(BSDs) solaris qnx haiku aix
 LIMIT83fs = go32v2 os2 emx watcom msdos win16 atari human68k
@@ -588,6 +588,9 @@ endif
 ifeq ($(CPU_OS_TARGET),powerpc64-aix)
 override TARGET_PROGRAMS+=busexample
 endif
+ifeq ($(CPU_OS_TARGET),powerpc64-freebsd)
+override TARGET_PROGRAMS+=busexample
+endif
 ifeq ($(CPU_OS_TARGET),avr-embedded)
 override TARGET_PROGRAMS+=busexample
 endif
@@ -1809,6 +1812,10 @@ ifeq ($(CPU_OS_TARGET),powerpc64-aix)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_DBUS=1
 endif
+ifeq ($(CPU_OS_TARGET),powerpc64-freebsd)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_DBUS=1
+endif
 ifeq ($(CPU_OS_TARGET),avr-embedded)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_DBUS=1

+ 16 - 1
packages/fcl-base/examples/Makefile

@@ -2,7 +2,7 @@
 # Don't edit, this file is generated by FPCMake Version 2.0.0
 #
 default: all
-MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim i386-android i386-aros m68k-linux m68k-netbsd m68k-amiga m68k-atari m68k-palmos m68k-macosclassic m68k-embedded m68k-sinclairql m68k-human68k powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macosclassic powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii powerpc-aix sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-haiku x86_64-netbsd x86_64-solaris x86_64-openbsd x86_64-darwin x86_64-win64 x86_64-embedded x86_64-iphonesim x86_64-android x86_64-aros x86_64-dragonfly arm-linux arm-netbsd arm-palmos arm-wince arm-gba arm-nds arm-embedded arm-symbian arm-android arm-aros arm-freertos arm-ios powerpc64-linux powerpc64-darwin powerpc64-embedded powerpc64-aix avr-embedded armeb-linux armeb-embedded mips-linux mipsel-linux mipsel-embedded mipsel-android mipsel-ps1 mips64-linux mips64el-linux jvm-java jvm-android i8086-embedded i8086-msdos i8086-win16 aarch64-linux aarch64-freebsd aarch64-darwin aarch64-win64 aarch64-embedded aarch64-iphonesim aarch64-android aarch64-ios wasm32-embedded wasm32-wasip1 wasm32-wasip1threads wasm32-wasip2 sparc64-linux riscv32-linux riscv32-embedded riscv32-freertos riscv64-linux riscv64-embedded xtensa-linux xtensa-embedded xtensa-freertos z80-embedded z80-zxspectrum z80-msxdos z80-amstradcpc loongarch64-linux
+MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim i386-android i386-aros m68k-linux m68k-netbsd m68k-amiga m68k-atari m68k-palmos m68k-macosclassic m68k-embedded m68k-sinclairql m68k-human68k powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macosclassic powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii powerpc-aix sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-haiku x86_64-netbsd x86_64-solaris x86_64-openbsd x86_64-darwin x86_64-win64 x86_64-embedded x86_64-iphonesim x86_64-android x86_64-aros x86_64-dragonfly arm-linux arm-netbsd arm-palmos arm-wince arm-gba arm-nds arm-embedded arm-symbian arm-android arm-aros arm-freertos arm-ios powerpc64-linux powerpc64-darwin powerpc64-embedded powerpc64-aix powerpc64-freebsd avr-embedded armeb-linux armeb-embedded mips-linux mipsel-linux mipsel-embedded mipsel-android mipsel-ps1 mips64-linux mips64el-linux jvm-java jvm-android i8086-embedded i8086-msdos i8086-win16 aarch64-linux aarch64-freebsd aarch64-darwin aarch64-win64 aarch64-embedded aarch64-iphonesim aarch64-android aarch64-ios wasm32-embedded wasm32-wasip1 wasm32-wasip1threads wasm32-wasip2 sparc64-linux riscv32-linux riscv32-embedded riscv32-freertos riscv64-linux riscv64-embedded xtensa-linux xtensa-embedded xtensa-freertos z80-embedded z80-zxspectrum z80-msxdos z80-amstradcpc loongarch64-linux
 BSDs = freebsd netbsd openbsd darwin dragonfly
 UNIXs = linux $(BSDs) solaris qnx haiku aix
 LIMIT83fs = go32v2 os2 emx watcom msdos win16 atari human68k
@@ -588,6 +588,9 @@ endif
 ifeq ($(CPU_OS_TARGET),powerpc64-aix)
 override TARGET_PROGRAMS+=stringl dparser fstream mstream list threads testrtf cfgtest xmldump htdump testez tidea b64test b64test2 b64enc b64dec restest testz testz2 istream doecho testol testcont txmlreg testreg tstelcmd testapp testcgi testbs testbf cachetest poolmm1 poolmm2 tarmakercons tarmakerconsgzip avltreetest testmime decodeascii85 encodeascii85
 endif
+ifeq ($(CPU_OS_TARGET),powerpc64-freebsd)
+override TARGET_PROGRAMS+=stringl dparser fstream mstream list threads testrtf cfgtest xmldump htdump testez tidea b64test b64test2 b64enc b64dec restest testz testz2 istream doecho testol testcont txmlreg testreg tstelcmd testapp testcgi testbs testbf cachetest poolmm1 poolmm2 tarmakercons tarmakerconsgzip avltreetest testmime decodeascii85 encodeascii85
+endif
 ifeq ($(CPU_OS_TARGET),avr-embedded)
 override TARGET_PROGRAMS+=stringl dparser fstream mstream list threads testrtf cfgtest xmldump htdump testez tidea b64test b64test2 b64enc b64dec restest testz testz2 istream doecho testol testcont txmlreg testreg tstelcmd testapp testcgi testbs testbf cachetest poolmm1 poolmm2 tarmakercons tarmakerconsgzip avltreetest testmime decodeascii85 encodeascii85
 endif
@@ -2401,6 +2404,18 @@ REQUIRE_PACKAGES_FCL-REGISTRY=1
 REQUIRE_PACKAGES_FCL-WEB=1
 REQUIRE_PACKAGES_FCL-XML=1
 endif
+ifeq ($(CPU_OS_TARGET),powerpc64-freebsd)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
+REQUIRE_PACKAGES_FCL-DB=1
+REQUIRE_PACKAGES_FCL-FPCUNIT=1
+REQUIRE_PACKAGES_FCL-IMAGE=1
+REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_FCL-PASSRC=1
+REQUIRE_PACKAGES_FCL-REGISTRY=1
+REQUIRE_PACKAGES_FCL-WEB=1
+REQUIRE_PACKAGES_FCL-XML=1
+endif
 ifeq ($(CPU_OS_TARGET),avr-embedded)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_FCL-BASE=1

+ 18 - 1
packages/fcl-db/src/base/Makefile

@@ -2,7 +2,7 @@
 # Don't edit, this file is generated by FPCMake Version 2.0.0
 #
 default: all
-MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim i386-android i386-aros m68k-linux m68k-netbsd m68k-amiga m68k-atari m68k-palmos m68k-macosclassic m68k-embedded m68k-sinclairql m68k-human68k powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macosclassic powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii powerpc-aix sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-haiku x86_64-netbsd x86_64-solaris x86_64-openbsd x86_64-darwin x86_64-win64 x86_64-embedded x86_64-iphonesim x86_64-android x86_64-aros x86_64-dragonfly arm-linux arm-netbsd arm-palmos arm-wince arm-gba arm-nds arm-embedded arm-symbian arm-android arm-aros arm-freertos arm-ios powerpc64-linux powerpc64-darwin powerpc64-embedded powerpc64-aix avr-embedded armeb-linux armeb-embedded mips-linux mipsel-linux mipsel-embedded mipsel-android mipsel-ps1 mips64-linux mips64el-linux jvm-java jvm-android i8086-embedded i8086-msdos i8086-win16 aarch64-linux aarch64-freebsd aarch64-darwin aarch64-win64 aarch64-embedded aarch64-iphonesim aarch64-android aarch64-ios wasm32-embedded wasm32-wasip1 wasm32-wasip1threads wasm32-wasip2 sparc64-linux riscv32-linux riscv32-embedded riscv32-freertos riscv64-linux riscv64-embedded xtensa-linux xtensa-embedded xtensa-freertos z80-embedded z80-zxspectrum z80-msxdos z80-amstradcpc loongarch64-linux
+MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim i386-android i386-aros m68k-linux m68k-netbsd m68k-amiga m68k-atari m68k-palmos m68k-macosclassic m68k-embedded m68k-sinclairql m68k-human68k powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macosclassic powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii powerpc-aix sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-haiku x86_64-netbsd x86_64-solaris x86_64-openbsd x86_64-darwin x86_64-win64 x86_64-embedded x86_64-iphonesim x86_64-android x86_64-aros x86_64-dragonfly arm-linux arm-netbsd arm-palmos arm-wince arm-gba arm-nds arm-embedded arm-symbian arm-android arm-aros arm-freertos arm-ios powerpc64-linux powerpc64-darwin powerpc64-embedded powerpc64-aix powerpc64-freebsd avr-embedded armeb-linux armeb-embedded mips-linux mipsel-linux mipsel-embedded mipsel-android mipsel-ps1 mips64-linux mips64el-linux jvm-java jvm-android i8086-embedded i8086-msdos i8086-win16 aarch64-linux aarch64-freebsd aarch64-darwin aarch64-win64 aarch64-embedded aarch64-iphonesim aarch64-android aarch64-ios wasm32-embedded wasm32-wasip1 wasm32-wasip1threads wasm32-wasip2 sparc64-linux riscv32-linux riscv32-embedded riscv32-freertos riscv64-linux riscv64-embedded xtensa-linux xtensa-embedded xtensa-freertos z80-embedded z80-zxspectrum z80-msxdos z80-amstradcpc loongarch64-linux
 BSDs = freebsd netbsd openbsd darwin dragonfly
 UNIXs = linux $(BSDs) solaris qnx haiku aix
 LIMIT83fs = go32v2 os2 emx watcom msdos win16 atari human68k
@@ -591,6 +591,9 @@ endif
 ifeq ($(CPU_OS_TARGET),powerpc64-aix)
 override TARGET_UNITS+=dbconst db dbwhtml bufdataset_parser bufdataset dbcoll sqlscript xmldatapacketreader
 endif
+ifeq ($(CPU_OS_TARGET),powerpc64-freebsd)
+override TARGET_UNITS+=dbconst db dbwhtml bufdataset_parser bufdataset dbcoll sqlscript xmldatapacketreader
+endif
 ifeq ($(CPU_OS_TARGET),avr-embedded)
 override TARGET_UNITS+=dbconst db dbwhtml bufdataset_parser bufdataset dbcoll sqlscript xmldatapacketreader
 endif
@@ -936,6 +939,9 @@ endif
 ifeq ($(CPU_OS_TARGET),powerpc64-aix)
 override TARGET_RSTS+=dbconst dbcoll sqlscript xmldatapacketreader
 endif
+ifeq ($(CPU_OS_TARGET),powerpc64-freebsd)
+override TARGET_RSTS+=dbconst dbcoll sqlscript xmldatapacketreader
+endif
 ifeq ($(CPU_OS_TARGET),avr-embedded)
 override TARGET_RSTS+=dbconst dbcoll sqlscript xmldatapacketreader
 endif
@@ -1282,6 +1288,9 @@ endif
 ifeq ($(CPU_OS_TARGET),powerpc64-aix)
 override COMPILER_OPTIONS+=-S2h
 endif
+ifeq ($(CPU_OS_TARGET),powerpc64-freebsd)
+override COMPILER_OPTIONS+=-S2h
+endif
 ifeq ($(CPU_OS_TARGET),avr-embedded)
 override COMPILER_OPTIONS+=-S2h
 endif
@@ -1627,6 +1636,9 @@ endif
 ifeq ($(CPU_OS_TARGET),powerpc64-aix)
 override COMPILER_UNITDIR+=../dbase
 endif
+ifeq ($(CPU_OS_TARGET),powerpc64-freebsd)
+override COMPILER_UNITDIR+=../dbase
+endif
 ifeq ($(CPU_OS_TARGET),avr-embedded)
 override COMPILER_UNITDIR+=../dbase
 endif
@@ -2921,6 +2933,11 @@ REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_FCL-BASE=1
 REQUIRE_PACKAGES_FCL-XML=1
 endif
+ifeq ($(CPU_OS_TARGET),powerpc64-freebsd)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
+REQUIRE_PACKAGES_FCL-XML=1
+endif
 ifeq ($(CPU_OS_TARGET),avr-embedded)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_FCL-BASE=1

+ 14 - 1
packages/fcl-db/src/codegen/Makefile

@@ -2,7 +2,7 @@
 # Don't edit, this file is generated by FPCMake Version 2.0.0
 #
 default: all
-MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim i386-android i386-aros m68k-linux m68k-netbsd m68k-amiga m68k-atari m68k-palmos m68k-macosclassic m68k-embedded m68k-sinclairql m68k-human68k powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macosclassic powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii powerpc-aix sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-haiku x86_64-netbsd x86_64-solaris x86_64-openbsd x86_64-darwin x86_64-win64 x86_64-embedded x86_64-iphonesim x86_64-android x86_64-aros x86_64-dragonfly arm-linux arm-netbsd arm-palmos arm-wince arm-gba arm-nds arm-embedded arm-symbian arm-android arm-aros arm-freertos arm-ios powerpc64-linux powerpc64-darwin powerpc64-embedded powerpc64-aix avr-embedded armeb-linux armeb-embedded mips-linux mipsel-linux mipsel-embedded mipsel-android mipsel-ps1 mips64-linux mips64el-linux jvm-java jvm-android i8086-embedded i8086-msdos i8086-win16 aarch64-linux aarch64-freebsd aarch64-darwin aarch64-win64 aarch64-embedded aarch64-iphonesim aarch64-android aarch64-ios wasm32-embedded wasm32-wasip1 wasm32-wasip1threads wasm32-wasip2 sparc64-linux riscv32-linux riscv32-embedded riscv32-freertos riscv64-linux riscv64-embedded xtensa-linux xtensa-embedded xtensa-freertos z80-embedded z80-zxspectrum z80-msxdos z80-amstradcpc loongarch64-linux
+MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim i386-android i386-aros m68k-linux m68k-netbsd m68k-amiga m68k-atari m68k-palmos m68k-macosclassic m68k-embedded m68k-sinclairql m68k-human68k powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macosclassic powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii powerpc-aix sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-haiku x86_64-netbsd x86_64-solaris x86_64-openbsd x86_64-darwin x86_64-win64 x86_64-embedded x86_64-iphonesim x86_64-android x86_64-aros x86_64-dragonfly arm-linux arm-netbsd arm-palmos arm-wince arm-gba arm-nds arm-embedded arm-symbian arm-android arm-aros arm-freertos arm-ios powerpc64-linux powerpc64-darwin powerpc64-embedded powerpc64-aix powerpc64-freebsd avr-embedded armeb-linux armeb-embedded mips-linux mipsel-linux mipsel-embedded mipsel-android mipsel-ps1 mips64-linux mips64el-linux jvm-java jvm-android i8086-embedded i8086-msdos i8086-win16 aarch64-linux aarch64-freebsd aarch64-darwin aarch64-win64 aarch64-embedded aarch64-iphonesim aarch64-android aarch64-ios wasm32-embedded wasm32-wasip1 wasm32-wasip1threads wasm32-wasip2 sparc64-linux riscv32-linux riscv32-embedded riscv32-freertos riscv64-linux riscv64-embedded xtensa-linux xtensa-embedded xtensa-freertos z80-embedded z80-zxspectrum z80-msxdos z80-amstradcpc loongarch64-linux
 BSDs = freebsd netbsd openbsd darwin dragonfly
 UNIXs = linux $(BSDs) solaris qnx haiku aix
 LIMIT83fs = go32v2 os2 emx watcom msdos win16 atari human68k
@@ -590,6 +590,9 @@ endif
 ifeq ($(CPU_OS_TARGET),powerpc64-aix)
 override TARGET_UNITS+=fpddcodegen fpcgcreatedbf fpcgdbcoll fpcgsqlconst fpcgtiopf fpddpopcode
 endif
+ifeq ($(CPU_OS_TARGET),powerpc64-freebsd)
+override TARGET_UNITS+=fpddcodegen fpcgcreatedbf fpcgdbcoll fpcgsqlconst fpcgtiopf fpddpopcode
+endif
 ifeq ($(CPU_OS_TARGET),avr-embedded)
 override TARGET_UNITS+=fpddcodegen fpcgcreatedbf fpcgdbcoll fpcgsqlconst fpcgtiopf fpddpopcode
 endif
@@ -935,6 +938,9 @@ endif
 ifeq ($(CPU_OS_TARGET),powerpc64-aix)
 override TARGET_RSTS+=fpddcodegen fpcgsqlconst fpddpopcode
 endif
+ifeq ($(CPU_OS_TARGET),powerpc64-freebsd)
+override TARGET_RSTS+=fpddcodegen fpcgsqlconst fpddpopcode
+endif
 ifeq ($(CPU_OS_TARGET),avr-embedded)
 override TARGET_RSTS+=fpddcodegen fpcgsqlconst fpddpopcode
 endif
@@ -1281,6 +1287,9 @@ endif
 ifeq ($(CPU_OS_TARGET),powerpc64-aix)
 override COMPILER_OPTIONS+=-S2h
 endif
+ifeq ($(CPU_OS_TARGET),powerpc64-freebsd)
+override COMPILER_OPTIONS+=-S2h
+endif
 ifeq ($(CPU_OS_TARGET),avr-embedded)
 override COMPILER_OPTIONS+=-S2h
 endif
@@ -2501,6 +2510,10 @@ ifeq ($(CPU_OS_TARGET),powerpc64-aix)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_FCL-BASE=1
 endif
+ifeq ($(CPU_OS_TARGET),powerpc64-freebsd)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
+endif
 ifeq ($(CPU_OS_TARGET),avr-embedded)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_FCL-BASE=1

+ 21 - 1
packages/fcl-db/src/datadict/Makefile

@@ -2,7 +2,7 @@
 # Don't edit, this file is generated by FPCMake Version 2.0.0
 #
 default: all
-MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim i386-android i386-aros m68k-linux m68k-netbsd m68k-amiga m68k-atari m68k-palmos m68k-macosclassic m68k-embedded m68k-sinclairql m68k-human68k powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macosclassic powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii powerpc-aix sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-haiku x86_64-netbsd x86_64-solaris x86_64-openbsd x86_64-darwin x86_64-win64 x86_64-embedded x86_64-iphonesim x86_64-android x86_64-aros x86_64-dragonfly arm-linux arm-netbsd arm-palmos arm-wince arm-gba arm-nds arm-embedded arm-symbian arm-android arm-aros arm-freertos arm-ios powerpc64-linux powerpc64-darwin powerpc64-embedded powerpc64-aix avr-embedded armeb-linux armeb-embedded mips-linux mipsel-linux mipsel-embedded mipsel-android mipsel-ps1 mips64-linux mips64el-linux jvm-java jvm-android i8086-embedded i8086-msdos i8086-win16 aarch64-linux aarch64-freebsd aarch64-darwin aarch64-win64 aarch64-embedded aarch64-iphonesim aarch64-android aarch64-ios wasm32-embedded wasm32-wasip1 wasm32-wasip1threads wasm32-wasip2 sparc64-linux riscv32-linux riscv32-embedded riscv32-freertos riscv64-linux riscv64-embedded xtensa-linux xtensa-embedded xtensa-freertos z80-embedded z80-zxspectrum z80-msxdos z80-amstradcpc loongarch64-linux
+MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim i386-android i386-aros m68k-linux m68k-netbsd m68k-amiga m68k-atari m68k-palmos m68k-macosclassic m68k-embedded m68k-sinclairql m68k-human68k powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macosclassic powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii powerpc-aix sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-haiku x86_64-netbsd x86_64-solaris x86_64-openbsd x86_64-darwin x86_64-win64 x86_64-embedded x86_64-iphonesim x86_64-android x86_64-aros x86_64-dragonfly arm-linux arm-netbsd arm-palmos arm-wince arm-gba arm-nds arm-embedded arm-symbian arm-android arm-aros arm-freertos arm-ios powerpc64-linux powerpc64-darwin powerpc64-embedded powerpc64-aix powerpc64-freebsd avr-embedded armeb-linux armeb-embedded mips-linux mipsel-linux mipsel-embedded mipsel-android mipsel-ps1 mips64-linux mips64el-linux jvm-java jvm-android i8086-embedded i8086-msdos i8086-win16 aarch64-linux aarch64-freebsd aarch64-darwin aarch64-win64 aarch64-embedded aarch64-iphonesim aarch64-android aarch64-ios wasm32-embedded wasm32-wasip1 wasm32-wasip1threads wasm32-wasip2 sparc64-linux riscv32-linux riscv32-embedded riscv32-freertos riscv64-linux riscv64-embedded xtensa-linux xtensa-embedded xtensa-freertos z80-embedded z80-zxspectrum z80-msxdos z80-amstradcpc loongarch64-linux
 BSDs = freebsd netbsd openbsd darwin dragonfly
 UNIXs = linux $(BSDs) solaris qnx haiku aix
 LIMIT83fs = go32v2 os2 emx watcom msdos win16 atari human68k
@@ -590,6 +590,9 @@ endif
 ifeq ($(CPU_OS_TARGET),powerpc64-aix)
 override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
 endif
+ifeq ($(CPU_OS_TARGET),powerpc64-freebsd)
+override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
+endif
 ifeq ($(CPU_OS_TARGET),avr-embedded)
 override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb
 endif
@@ -935,6 +938,9 @@ endif
 ifeq ($(CPU_OS_TARGET),powerpc64-aix)
 override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
 endif
+ifeq ($(CPU_OS_TARGET),powerpc64-freebsd)
+override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
+endif
 ifeq ($(CPU_OS_TARGET),avr-embedded)
 override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff
 endif
@@ -1281,6 +1287,9 @@ endif
 ifeq ($(CPU_OS_TARGET),powerpc64-aix)
 override COMPILER_OPTIONS+=-S2h
 endif
+ifeq ($(CPU_OS_TARGET),powerpc64-freebsd)
+override COMPILER_OPTIONS+=-S2h
+endif
 ifeq ($(CPU_OS_TARGET),avr-embedded)
 override COMPILER_OPTIONS+=-S2h
 endif
@@ -2745,6 +2754,17 @@ REQUIRE_PACKAGES_SQLITE=1
 REQUIRE_PACKAGES_ODBC=1
 REQUIRE_PACKAGES_POSTGRES=1
 endif
+ifeq ($(CPU_OS_TARGET),powerpc64-freebsd)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
+REQUIRE_PACKAGES_FCL-XML=1
+REQUIRE_PACKAGES_IBASE=1
+REQUIRE_PACKAGES_MYSQL=1
+REQUIRE_PACKAGES_ORACLE=1
+REQUIRE_PACKAGES_SQLITE=1
+REQUIRE_PACKAGES_ODBC=1
+REQUIRE_PACKAGES_POSTGRES=1
+endif
 ifeq ($(CPU_OS_TARGET),avr-embedded)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_FCL-BASE=1

+ 20 - 1
packages/fcl-db/src/dbase/Makefile

@@ -2,7 +2,7 @@
 # Don't edit, this file is generated by FPCMake Version 2.0.0
 #
 default: all
-MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim i386-android i386-aros m68k-linux m68k-netbsd m68k-amiga m68k-atari m68k-palmos m68k-macosclassic m68k-embedded m68k-sinclairql m68k-human68k powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macosclassic powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii powerpc-aix sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-haiku x86_64-netbsd x86_64-solaris x86_64-openbsd x86_64-darwin x86_64-win64 x86_64-embedded x86_64-iphonesim x86_64-android x86_64-aros x86_64-dragonfly arm-linux arm-netbsd arm-palmos arm-wince arm-gba arm-nds arm-embedded arm-symbian arm-android arm-aros arm-freertos arm-ios powerpc64-linux powerpc64-darwin powerpc64-embedded powerpc64-aix avr-embedded armeb-linux armeb-embedded mips-linux mipsel-linux mipsel-embedded mipsel-android mipsel-ps1 mips64-linux mips64el-linux jvm-java jvm-android i8086-embedded i8086-msdos i8086-win16 aarch64-linux aarch64-freebsd aarch64-darwin aarch64-win64 aarch64-embedded aarch64-iphonesim aarch64-android aarch64-ios wasm32-embedded wasm32-wasip1 wasm32-wasip1threads wasm32-wasip2 sparc64-linux riscv32-linux riscv32-embedded riscv32-freertos riscv64-linux riscv64-embedded xtensa-linux xtensa-embedded xtensa-freertos z80-embedded z80-zxspectrum z80-msxdos z80-amstradcpc loongarch64-linux
+MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim i386-android i386-aros m68k-linux m68k-netbsd m68k-amiga m68k-atari m68k-palmos m68k-macosclassic m68k-embedded m68k-sinclairql m68k-human68k powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macosclassic powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii powerpc-aix sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-haiku x86_64-netbsd x86_64-solaris x86_64-openbsd x86_64-darwin x86_64-win64 x86_64-embedded x86_64-iphonesim x86_64-android x86_64-aros x86_64-dragonfly arm-linux arm-netbsd arm-palmos arm-wince arm-gba arm-nds arm-embedded arm-symbian arm-android arm-aros arm-freertos arm-ios powerpc64-linux powerpc64-darwin powerpc64-embedded powerpc64-aix powerpc64-freebsd avr-embedded armeb-linux armeb-embedded mips-linux mipsel-linux mipsel-embedded mipsel-android mipsel-ps1 mips64-linux mips64el-linux jvm-java jvm-android i8086-embedded i8086-msdos i8086-win16 aarch64-linux aarch64-freebsd aarch64-darwin aarch64-win64 aarch64-embedded aarch64-iphonesim aarch64-android aarch64-ios wasm32-embedded wasm32-wasip1 wasm32-wasip1threads wasm32-wasip2 sparc64-linux riscv32-linux riscv32-embedded riscv32-freertos riscv64-linux riscv64-embedded xtensa-linux xtensa-embedded xtensa-freertos z80-embedded z80-zxspectrum z80-msxdos z80-amstradcpc loongarch64-linux
 BSDs = freebsd netbsd openbsd darwin dragonfly
 UNIXs = linux $(BSDs) solaris qnx haiku aix
 LIMIT83fs = go32v2 os2 emx watcom msdos win16 atari human68k
@@ -598,6 +598,9 @@ endif
 ifeq ($(CPU_OS_TARGET),powerpc64-aix)
 override TARGET_UNITS+=dbf
 endif
+ifeq ($(CPU_OS_TARGET),powerpc64-freebsd)
+override TARGET_UNITS+=dbf
+endif
 ifeq ($(CPU_OS_TARGET),avr-embedded)
 override TARGET_UNITS+=dbf
 endif
@@ -943,6 +946,9 @@ endif
 ifeq ($(CPU_OS_TARGET),powerpc64-aix)
 override TARGET_EXAMPLES+=testdbf
 endif
+ifeq ($(CPU_OS_TARGET),powerpc64-freebsd)
+override TARGET_EXAMPLES+=testdbf
+endif
 ifeq ($(CPU_OS_TARGET),avr-embedded)
 override TARGET_EXAMPLES+=testdbf
 endif
@@ -1288,6 +1294,9 @@ endif
 ifeq ($(CPU_OS_TARGET),powerpc64-aix)
 override CLEAN_UNITS+=dbf_collate dbf_common dbf_cursor dbf_dbffile dbf_fields dbf_idxcur dbf_idxfile dbf_lang dbf_memo dbf_parser dbf_pgfile dbf_prscore dbf_prsdef dbf_prssupp dbf_str
 endif
+ifeq ($(CPU_OS_TARGET),powerpc64-freebsd)
+override CLEAN_UNITS+=dbf_collate dbf_common dbf_cursor dbf_dbffile dbf_fields dbf_idxcur dbf_idxfile dbf_lang dbf_memo dbf_parser dbf_pgfile dbf_prscore dbf_prsdef dbf_prssupp dbf_str
+endif
 ifeq ($(CPU_OS_TARGET),avr-embedded)
 override CLEAN_UNITS+=dbf_collate dbf_common dbf_cursor dbf_dbffile dbf_fields dbf_idxcur dbf_idxfile dbf_lang dbf_memo dbf_parser dbf_pgfile dbf_prscore dbf_prsdef dbf_prssupp dbf_str
 endif
@@ -1633,6 +1642,9 @@ endif
 ifeq ($(CPU_OS_TARGET),powerpc64-aix)
 override INSTALL_UNITS+=dbf_collate dbf_common dbf_cursor dbf_dbffile dbf_fields dbf_idxcur dbf_idxfile dbf_lang dbf_memo dbf_parser dbf_pgfile dbf_prscore dbf_prsdef dbf_prssupp dbf_str
 endif
+ifeq ($(CPU_OS_TARGET),powerpc64-freebsd)
+override INSTALL_UNITS+=dbf_collate dbf_common dbf_cursor dbf_dbffile dbf_fields dbf_idxcur dbf_idxfile dbf_lang dbf_memo dbf_parser dbf_pgfile dbf_prscore dbf_prsdef dbf_prssupp dbf_str
+endif
 ifeq ($(CPU_OS_TARGET),avr-embedded)
 override INSTALL_UNITS+=dbf_collate dbf_common dbf_cursor dbf_dbffile dbf_fields dbf_idxcur dbf_idxfile dbf_lang dbf_memo dbf_parser dbf_pgfile dbf_prscore dbf_prsdef dbf_prssupp dbf_str
 endif
@@ -1979,6 +1991,9 @@ endif
 ifeq ($(CPU_OS_TARGET),powerpc64-aix)
 override COMPILER_OPTIONS+=-S2 -Sh
 endif
+ifeq ($(CPU_OS_TARGET),powerpc64-freebsd)
+override COMPILER_OPTIONS+=-S2 -Sh
+endif
 ifeq ($(CPU_OS_TARGET),avr-embedded)
 override COMPILER_OPTIONS+=-S2 -Sh
 endif
@@ -3199,6 +3214,10 @@ ifeq ($(CPU_OS_TARGET),powerpc64-aix)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_FCL-BASE=1
 endif
+ifeq ($(CPU_OS_TARGET),powerpc64-freebsd)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
+endif
 ifeq ($(CPU_OS_TARGET),avr-embedded)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_FCL-BASE=1

+ 13 - 1
packages/fcl-db/tests/Makefile

@@ -2,7 +2,7 @@
 # Don't edit, this file is generated by FPCMake Version 2.0.0
 #
 default: all
-MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim i386-android i386-aros m68k-linux m68k-netbsd m68k-amiga m68k-atari m68k-palmos m68k-macosclassic m68k-embedded m68k-sinclairql m68k-human68k powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macosclassic powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii powerpc-aix sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-haiku x86_64-netbsd x86_64-solaris x86_64-openbsd x86_64-darwin x86_64-win64 x86_64-embedded x86_64-iphonesim x86_64-android x86_64-aros x86_64-dragonfly arm-linux arm-netbsd arm-palmos arm-wince arm-gba arm-nds arm-embedded arm-symbian arm-android arm-aros arm-freertos arm-ios powerpc64-linux powerpc64-darwin powerpc64-embedded powerpc64-aix avr-embedded armeb-linux armeb-embedded mips-linux mipsel-linux mipsel-embedded mipsel-android mipsel-ps1 mips64-linux mips64el-linux jvm-java jvm-android i8086-embedded i8086-msdos i8086-win16 aarch64-linux aarch64-freebsd aarch64-darwin aarch64-win64 aarch64-embedded aarch64-iphonesim aarch64-android aarch64-ios wasm32-embedded wasm32-wasip1 wasm32-wasip1threads wasm32-wasip2 sparc64-linux riscv32-linux riscv32-embedded riscv32-freertos riscv64-linux riscv64-embedded xtensa-linux xtensa-embedded xtensa-freertos z80-embedded z80-zxspectrum z80-msxdos z80-amstradcpc loongarch64-linux
+MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim i386-android i386-aros m68k-linux m68k-netbsd m68k-amiga m68k-atari m68k-palmos m68k-macosclassic m68k-embedded m68k-sinclairql m68k-human68k powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macosclassic powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii powerpc-aix sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-haiku x86_64-netbsd x86_64-solaris x86_64-openbsd x86_64-darwin x86_64-win64 x86_64-embedded x86_64-iphonesim x86_64-android x86_64-aros x86_64-dragonfly arm-linux arm-netbsd arm-palmos arm-wince arm-gba arm-nds arm-embedded arm-symbian arm-android arm-aros arm-freertos arm-ios powerpc64-linux powerpc64-darwin powerpc64-embedded powerpc64-aixpowerpc64-freebsd avr-embedded armeb-linux armeb-embedded mips-linux mipsel-linux mipsel-embedded mipsel-android mipsel-ps1 mips64-linux mips64el-linux jvm-java jvm-android i8086-embedded i8086-msdos i8086-win16 aarch64-linux aarch64-freebsd aarch64-darwin aarch64-win64 aarch64-embedded aarch64-iphonesim aarch64-android aarch64-ios wasm32-embedded wasm32-wasip1 wasm32-wasip1threads wasm32-wasip2 sparc64-linux riscv32-linux riscv32-embedded riscv32-freertos riscv64-linux riscv64-embedded xtensa-linux xtensa-embedded xtensa-freertos z80-embedded z80-zxspectrum z80-msxdos z80-amstradcpc loongarch64-linux
 BSDs = freebsd netbsd openbsd darwin dragonfly
 UNIXs = linux $(BSDs) solaris qnx haiku aix
 LIMIT83fs = go32v2 os2 emx watcom msdos win16 atari human68k
@@ -590,6 +590,9 @@ endif
 ifeq ($(CPU_OS_TARGET),powerpc64-aix)
 override TARGET_UNITS+=toolsunit dbftoolsunit memdstoolsunit sqldbtoolsunit sdfdstoolsunit
 endif
+ifeq ($(CPU_OS_TARGET),powerpc64-freebsd)
+override TARGET_UNITS+=toolsunit dbftoolsunit memdstoolsunit sqldbtoolsunit sdfdstoolsunit
+endif
 ifeq ($(CPU_OS_TARGET),avr-embedded)
 override TARGET_UNITS+=toolsunit dbftoolsunit memdstoolsunit sqldbtoolsunit sdfdstoolsunit
 endif
@@ -935,6 +938,9 @@ endif
 ifeq ($(CPU_OS_TARGET),powerpc64-aix)
 override TARGET_EXAMPLES+=dbtestframework testsqlfiles
 endif
+ifeq ($(CPU_OS_TARGET),powerpc64-freebsd)
+override TARGET_EXAMPLES+=dbtestframework testsqlfiles
+endif
 ifeq ($(CPU_OS_TARGET),avr-embedded)
 override TARGET_EXAMPLES+=dbtestframework testsqlfiles
 endif
@@ -2304,6 +2310,12 @@ REQUIRE_PACKAGES_FCL-FPCUNIT=1
 REQUIRE_PACKAGES_FCL-DB=1
 REQUIRE_PACKAGES_PASZLIB=1
 endif
+ifeq ($(CPU_OS_TARGET),powerpc64-freebsd)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-FPCUNIT=1
+REQUIRE_PACKAGES_FCL-DB=1
+REQUIRE_PACKAGES_PASZLIB=1
+endif
 ifeq ($(CPU_OS_TARGET),avr-embedded)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_FCL-FPCUNIT=1

+ 8 - 1
packages/fpmkunit/Makefile

@@ -2,7 +2,7 @@
 # Don't edit, this file is generated by FPCMake Version 2.0.0
 #
 default: all
-MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim i386-android i386-aros m68k-linux m68k-netbsd m68k-amiga m68k-atari m68k-palmos m68k-macosclassic m68k-embedded m68k-sinclairql m68k-human68k powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macosclassic powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii powerpc-aix sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-haiku x86_64-netbsd x86_64-solaris x86_64-openbsd x86_64-darwin x86_64-win64 x86_64-embedded x86_64-iphonesim x86_64-android x86_64-aros x86_64-dragonfly arm-linux arm-netbsd arm-palmos arm-wince arm-gba arm-nds arm-embedded arm-symbian arm-android arm-aros arm-freertos arm-ios powerpc64-linux powerpc64-darwin powerpc64-embedded powerpc64-aix avr-embedded armeb-linux armeb-embedded mips-linux mipsel-linux mipsel-embedded mipsel-android mipsel-ps1 mips64-linux mips64el-linux jvm-java jvm-android i8086-embedded i8086-msdos i8086-win16 aarch64-linux aarch64-freebsd aarch64-darwin aarch64-win64 aarch64-embedded aarch64-iphonesim aarch64-android aarch64-ios wasm32-embedded wasm32-wasip1 wasm32-wasip1threads wasm32-wasip2 sparc64-linux riscv32-linux riscv32-embedded riscv32-freertos riscv64-linux riscv64-embedded xtensa-linux xtensa-embedded xtensa-freertos z80-embedded z80-zxspectrum z80-msxdos z80-amstradcpc loongarch64-linux
+MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim i386-android i386-aros m68k-linux m68k-netbsd m68k-amiga m68k-atari m68k-palmos m68k-macosclassic m68k-embedded m68k-sinclairql m68k-human68k powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macosclassic powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii powerpc-aix sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-haiku x86_64-netbsd x86_64-solaris x86_64-openbsd x86_64-darwin x86_64-win64 x86_64-embedded x86_64-iphonesim x86_64-android x86_64-aros x86_64-dragonfly arm-linux arm-netbsd arm-palmos arm-wince arm-gba arm-nds arm-embedded arm-symbian arm-android arm-aros arm-freertos arm-ios powerpc64-linux powerpc64-darwin powerpc64-embedded powerpc64-aix powerpc64-freebsd avr-embedded armeb-linux armeb-embedded mips-linux mipsel-linux mipsel-embedded mipsel-android mipsel-ps1 mips64-linux mips64el-linux jvm-java jvm-android i8086-embedded i8086-msdos i8086-win16 aarch64-linux aarch64-freebsd aarch64-darwin aarch64-win64 aarch64-embedded aarch64-iphonesim aarch64-android aarch64-ios wasm32-embedded wasm32-wasip1 wasm32-wasip1threads wasm32-wasip2 sparc64-linux riscv32-linux riscv32-embedded riscv32-freertos riscv64-linux riscv64-embedded xtensa-linux xtensa-embedded xtensa-freertos z80-embedded z80-zxspectrum z80-msxdos z80-amstradcpc loongarch64-linux
 BSDs = freebsd netbsd openbsd darwin dragonfly
 UNIXs = linux $(BSDs) solaris qnx haiku aix
 LIMIT83fs = go32v2 os2 emx watcom msdos win16 atari human68k
@@ -1746,6 +1746,13 @@ REQUIRE_PACKAGES_FCL-PROCESS=1
 REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_LIBTAR=1
 endif
+ifeq ($(CPU_OS_TARGET),powerpc64-freebsd)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_LIBTAR=1
+endif
 ifeq ($(CPU_OS_TARGET),avr-embedded)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PASZLIB=1

+ 1 - 1
packages/fpmkunit/src/fpmkunit.pp

@@ -252,7 +252,7 @@ Const
     { go32v2 }  ( false, true,  false, false, false, false, false, false, false, false, false, false, false, false,   false, false, false, false, false,  false,  false,   false, false, false),
     { win32 }   ( false, true,  false, false, false, false, false, false, false, false, false, false, false, false,   false, false, false, false, false,  false,  false,   false, false, false),
     { os2 }     ( false, true,  false, false, false, false, false, false, false, false, false, false, false, false,   false, false, false, false, false,  false,  false,   false, false, false),
-    { freebsd } ( false, true,  false, false, false, true,  false, false, false, false, false, false, false, false,   false, false, true , false, false,  false,  false,   false, false, false),
+    { freebsd } ( false, true,  false, false, false, true,  false, true,  false, false, false, false, false, false,   false, false, true , false, false,  false,  false,   false, false, false),
     { beos }    ( false, true,  false, false, false, false, false, false, false, false, false, false, false, false,   false, false, false, false, false,  false,  false,   false, false, false),
     { netbsd }  ( false, true,  true,  true,  true,  true,  true,  false, false, false, false, false, false, false,   false, false, false, false, false,  false,  false,   false, false, false),
     { amiga }   ( false, false, true,  true,  false, false, false, false, false, false, false, false, false, false,   false, false, false, false, false,  false,  false,   false, false, false),

+ 7 - 1
rtl/Makefile

@@ -2,7 +2,7 @@
 # Don't edit, this file is generated by FPCMake Version 2.0.0
 #
 default: all
-MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim i386-android i386-aros m68k-linux m68k-netbsd m68k-amiga m68k-atari m68k-palmos m68k-macosclassic m68k-embedded m68k-sinclairql m68k-human68k powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macosclassic powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii powerpc-aix sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-haiku x86_64-netbsd x86_64-solaris x86_64-openbsd x86_64-darwin x86_64-win64 x86_64-embedded x86_64-iphonesim x86_64-android x86_64-aros x86_64-dragonfly arm-linux arm-netbsd arm-palmos arm-wince arm-gba arm-nds arm-embedded arm-symbian arm-android arm-aros arm-freertos arm-ios powerpc64-linux powerpc64-darwin powerpc64-embedded powerpc64-aix avr-embedded armeb-linux armeb-embedded mips-linux mipsel-linux mipsel-embedded mipsel-android mipsel-ps1 mips64-linux mips64el-linux jvm-java jvm-android i8086-embedded i8086-msdos i8086-win16 aarch64-linux aarch64-freebsd aarch64-darwin aarch64-win64 aarch64-embedded aarch64-iphonesim aarch64-android aarch64-ios wasm32-embedded wasm32-wasip1 wasm32-wasip1threads wasm32-wasip2 sparc64-linux riscv32-linux riscv32-embedded riscv32-freertos riscv64-linux riscv64-embedded xtensa-linux xtensa-embedded xtensa-freertos z80-embedded z80-zxspectrum z80-msxdos z80-amstradcpc loongarch64-linux
+MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim i386-android i386-aros m68k-linux m68k-netbsd m68k-amiga m68k-atari m68k-palmos m68k-macosclassic m68k-embedded m68k-sinclairql m68k-human68k powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macosclassic powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii powerpc-aix sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-haiku x86_64-netbsd x86_64-solaris x86_64-openbsd x86_64-darwin x86_64-win64 x86_64-embedded x86_64-iphonesim x86_64-android x86_64-aros x86_64-dragonfly arm-linux arm-netbsd arm-palmos arm-wince arm-gba arm-nds arm-embedded arm-symbian arm-android arm-aros arm-freertos arm-ios powerpc64-linux powerpc64-darwin powerpc64-embedded powerpc64-aix powerpc64-freebsd avr-embedded armeb-linux armeb-embedded mips-linux mipsel-linux mipsel-embedded mipsel-android mipsel-ps1 mips64-linux mips64el-linux jvm-java jvm-android i8086-embedded i8086-msdos i8086-win16 aarch64-linux aarch64-freebsd aarch64-darwin aarch64-win64 aarch64-embedded aarch64-iphonesim aarch64-android aarch64-ios wasm32-embedded wasm32-wasip1 wasm32-wasip1threads wasm32-wasip2 sparc64-linux riscv32-linux riscv32-embedded riscv32-freertos riscv64-linux riscv64-embedded xtensa-linux xtensa-embedded xtensa-freertos z80-embedded z80-zxspectrum z80-msxdos z80-amstradcpc loongarch64-linux
 BSDs = freebsd netbsd openbsd darwin dragonfly
 UNIXs = linux $(BSDs) solaris qnx haiku aix
 LIMIT83fs = go32v2 os2 emx watcom msdos win16 atari human68k
@@ -590,6 +590,9 @@ endif
 ifeq ($(CPU_OS_TARGET),powerpc64-aix)
 override TARGET_DIRS+=aix
 endif
+ifeq ($(CPU_OS_TARGET),powerpc64-freebsd)
+override TARGET_DIRS+=freebsd
+endif
 ifeq ($(CPU_OS_TARGET),avr-embedded)
 override TARGET_DIRS+=embedded
 endif
@@ -2282,6 +2285,9 @@ endif
 ifeq ($(CPU_OS_TARGET),powerpc64-aix)
 TARGET_DIRS_AIX=1
 endif
+ifeq ($(CPU_OS_TARGET),powerpc64-freebsd)
+TARGET_DIRS_FREEBSD=1
+endif
 ifeq ($(CPU_OS_TARGET),avr-embedded)
 TARGET_DIRS_EMBEDDED=1
 endif

+ 25 - 1
rtl/freebsd/Makefile

@@ -2,7 +2,7 @@
 # Don't edit, this file is generated by FPCMake Version 2.0.0
 #
 default: all
-MAKEFILETARGETS=i386-freebsd x86_64-freebsd aarch64-freebsd
+MAKEFILETARGETS=i386-freebsd x86_64-freebsd aarch64-freebsd powerpc64-freebsd
 BSDs = freebsd netbsd openbsd darwin dragonfly
 UNIXs = linux $(BSDs) solaris qnx haiku aix
 LIMIT83fs = go32v2 os2 emx watcom msdos win16 atari human68k
@@ -943,6 +943,12 @@ ifeq ($(ARCH),x86_64)
 CPU_UNITS=$(X86UNIT) $(PORTSUNIT) $(CPUUNIT)
 ASTARGET=--64
 endif
+ifeq ($(ARCH),powerpc64)
+ASTARGET=-a64
+endif
+ifdef RELEASE
+override FPCOPT+=-Ur
+endif
 OBJPASDIR=$(RTL)/objpas
 ifeq ($(CPU_OS_TARGET),i386-freebsd)
 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) $(FREEBSDUNIT) $(CONSOLEUNIT) $(SYSCONSTUNIT) $(CTHREADSUNIT) $(DOSUNIT) $(CWSTRINGUNIT) $(FPINTRESUNIT) $(UNIXCPUNIT) $(FPWIDESTRINGUNIT) $(SOFTFPUUNIT) $(SFPUX80UNIT) $(UFLOATX80UNIT) $(SFPU128UNIT) $(UFLOAT128UNIT) $(UNIX98PTYUNIT)
@@ -953,6 +959,9 @@ endif
 ifeq ($(CPU_OS_TARGET),aarch64-freebsd)
 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) $(FREEBSDUNIT) $(CONSOLEUNIT) $(SYSCONSTUNIT) $(CTHREADSUNIT) $(DOSUNIT) $(CWSTRINGUNIT) $(FPINTRESUNIT) $(UNIXCPUNIT) $(FPWIDESTRINGUNIT) $(SOFTFPUUNIT) $(SFPUX80UNIT) $(UFLOATX80UNIT) $(SFPU128UNIT) $(UFLOAT128UNIT) $(UNIX98PTYUNIT)
 endif
+ifeq ($(CPU_OS_TARGET),powerpc64-freebsd)
+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) $(FREEBSDUNIT) $(CONSOLEUNIT) $(SYSCONSTUNIT) $(CTHREADSUNIT) $(DOSUNIT) $(CWSTRINGUNIT) $(FPINTRESUNIT) $(UNIXCPUNIT) $(FPWIDESTRINGUNIT) $(SOFTFPUUNIT) $(SFPUX80UNIT) $(UFLOATX80UNIT) $(SFPU128UNIT) $(UFLOAT128UNIT) $(UNIX98PTYUNIT)
+endif
 ifeq ($(CPU_OS_TARGET),i386-freebsd)
 override TARGET_IMPLICITUNITS+=$(EXEINFOUNIT) $(CP_UNITS) $(UNICODEDATAUNIT)
 endif
@@ -962,6 +971,9 @@ endif
 ifeq ($(CPU_OS_TARGET),aarch64-freebsd)
 override TARGET_IMPLICITUNITS+=$(EXEINFOUNIT) $(CP_UNITS) $(UNICODEDATAUNIT)
 endif
+ifeq ($(CPU_OS_TARGET),powerpc64-freebsd)
+override TARGET_IMPLICITUNITS+=$(EXEINFOUNIT) $(CP_UNITS) $(UNICODEDATAUNIT)
+endif
 ifeq ($(CPU_OS_TARGET),i386-freebsd)
 override TARGET_LOADERS+=prt0 cprt0 gprt0 dllprt0
 endif
@@ -971,6 +983,9 @@ endif
 ifeq ($(CPU_OS_TARGET),aarch64-freebsd)
 override TARGET_LOADERS+=prt0 cprt0 gprt0 dllprt0
 endif
+ifeq ($(CPU_OS_TARGET),powerpc64-freebsd)
+override TARGET_LOADERS+=prt0 cprt0 gprt0 dllprt0
+endif
 ifeq ($(CPU_OS_TARGET),i386-freebsd)
 override TARGET_RSTS+=$(MATHUNIT) $(TYPINFOUNIT) $(CLASSESUNIT) $(SYSCONSTUNIT) $(UNICODEDATAUNIT)
 endif
@@ -980,6 +995,9 @@ endif
 ifeq ($(CPU_OS_TARGET),aarch64-freebsd)
 override TARGET_RSTS+=$(MATHUNIT) $(TYPINFOUNIT) $(CLASSESUNIT) $(SYSCONSTUNIT) $(UNICODEDATAUNIT)
 endif
+ifeq ($(CPU_OS_TARGET),powerpc64-freebsd)
+override TARGET_RSTS+=$(MATHUNIT) $(TYPINFOUNIT) $(CLASSESUNIT) $(SYSCONSTUNIT) $(UNICODEDATAUNIT)
+endif
 override INSTALL_FPCPACKAGE=y y y
 ifeq ($(CPU_OS_TARGET),i386-freebsd)
 override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(BSDINC) $(BSDPROCINC) $(OSPROCINC)
@@ -990,6 +1008,9 @@ endif
 ifeq ($(CPU_OS_TARGET),aarch64-freebsd)
 override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(BSDINC) $(BSDPROCINC) $(OSPROCINC)
 endif
+ifeq ($(CPU_OS_TARGET),powerpc64-freebsd)
+override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(BSDINC) $(BSDPROCINC) $(OSPROCINC)
+endif
 ifeq ($(CPU_OS_TARGET),i386-freebsd)
 override COMPILER_SOURCEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(BSDINC) $(COMMON)
 endif
@@ -999,6 +1020,9 @@ endif
 ifeq ($(CPU_OS_TARGET),aarch64-freebsd)
 override COMPILER_SOURCEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(BSDINC) $(COMMON)
 endif
+ifeq ($(CPU_OS_TARGET),powerpc64-freebsd)
+override COMPILER_SOURCEDIR+=$(INC) $(PROCINC) $(UNIXINC) $(BSDINC) $(COMMON)
+endif
 ifdef REQUIRE_UNITSDIR
 override UNITSDIR+=$(REQUIRE_UNITSDIR)
 endif

+ 14 - 0
rtl/freebsd/powerpc64/bsyscall.inc

@@ -0,0 +1,14 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2005 by Michael Van Canneyt,
+    member of the Free Pascal development team.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+

+ 115 - 0
rtl/freebsd/powerpc64/cprt0.as

@@ -0,0 +1,115 @@
+        .file   "cprt0.as"
+
+        .machine        power8
+        .abiversion     2
+
+        .section .rodata
+.LC0:
+        .asciz  ""
+
+        .globl  __progname
+        .section .data
+        .p2align 3
+        .type   __progname, @object
+        .size   __progname, 8
+__progname:
+        .quad   .LC0
+
+		.comm	environ,8,8
+        # libc provides 'environ'
+        .globl  environ
+        .type   environ, @object
+
+        # Optional weak reference: nonzero if dynamically linked, 0 for static
+        .weak   _DYNAMIC
+
+        # Expose OS parameter slots (matching your layout)
+        .globl  operatingsystem_parameter_argc
+        .globl  operatingsystem_parameter_argv
+        .globl  operatingsystem_parameter_envp
+        .p2align 3
+operatingsystem_parameter_argc:
+        .quad   0
+operatingsystem_parameter_argv:
+        .quad   0
+operatingsystem_parameter_envp:
+        .quad   0
+
+        .text
+        .p2align 2
+        .globl  _start
+        .type   _start, @function
+_start:
+        # ELFv2 process entry: r12 holds entry address; set up TOC in r2
+        addis   2,12,.TOC.-_start@ha
+        addi    2,2,.TOC.-_start@l
+        .localentry _start, .-_start
+
+        # Minimal frame (not strictly needed, but harmless)
+        stdu    1,-32(1)
+        std     0,16(1)
+
+        # r3=argc, r4=argv, r5=envp (ELFv2 entry convention)
+
+        # Store argc (32-bit) / argv / envp into your globals (TOC-relative)
+        addis   9,2,operatingsystem_parameter_argc@toc@ha
+        addi    9,9,operatingsystem_parameter_argc@toc@l
+        stw     3,0(9)
+
+        addis   10,2,operatingsystem_parameter_argv@toc@ha
+        addi    10,10,operatingsystem_parameter_argv@toc@l
+        std     4,0(10)
+
+        addis   11,2,operatingsystem_parameter_envp@toc@ha
+        addi    11,11,operatingsystem_parameter_envp@toc@l
+        std     5,0(11)
+
+        # environ = envp
+        addis   12,2,environ@toc@ha
+        addi    12,12,environ@toc@l
+        std     5,0(12)
+
+        # if (argc > 0 && argv[0] != NULL) { __progname = argv[0]; scan for last '/' }
+        cmpdi   3,0
+        ble     1f
+
+        ld      6,0(4)                  # r6 = argv[0]
+        cmpdi   6,0
+        beq     1f
+
+        # __progname = argv[0]
+        addis   7,2,__progname@toc@ha
+        addi    7,7,__progname@toc@l
+        std     6,0(7)
+
+        # Scan for last '/' to set __progname past it
+        mr      8,6
+0:      lbz     9,0(8)
+        cmpdi   9,0
+        beq     1f
+        cmpdi   9,47                    # '/'
+        bne     2f
+        addi    10,8,1
+        std     10,0(7)
+2:      addi    8,8,1
+        b       0b
+
+1:
+        # Call main(argc, argv, envp)
+        # r3,r4,r5 already set appropriately
+        bl      main
+        nop
+
+        # exit(main_ret)
+        mr      3,3
+        bl      exit
+        nop
+
+        # Should not return; just in case, trap.
+        trap
+
+        .size   _start, .-_start
+
+        .section .comment
+        .ascii  "FreeBSD PowerPC64 ELFv2 crt1 (minimal)\0"
+

+ 115 - 0
rtl/freebsd/powerpc64/dllprt0.as

@@ -0,0 +1,115 @@
+/*
+ * Free Pascal RTL — Shared library startup (FreeBSD, PowerPC64 ELFv2)
+ */
+
+        .machine        power8
+        .abiversion     2
+
+/* --- helpers ------------------------------------------------------------ */
+
+.macro LOAD_64BIT_VAL ra, value
+    lis       \ra,\value@highest
+    ori       \ra,\ra,\value@higher
+    sldi      \ra,\ra,32
+    oris      \ra,\ra,\value@h
+    ori       \ra,\ra,\value@l
+.endm
+
+/* ELFv2: no function descriptors; establish TOC from r12 at entry */
+.macro FUNCTION_PROLOG fn
+    .text
+    .align    4
+    .globl    \fn
+    .type     \fn, @function
+\fn:
+    addis     2,12,.TOC.-\fn@ha
+    addi      2,2,.TOC.-\fn@l
+    .localentry \fn, .-\fn
+.endm
+
+/* --- code --------------------------------------------------------------- */
+
+        .section ".text"
+
+/*
+ * Entry called by the loader for the shared object.
+ * ELFv2 process/linker conventions: r3=argc, r4=argv, r5=envp.
+ */
+FUNCTION_PROLOG FPC_SHARED_LIB_START
+    /* standard small frame */
+    mflr    0
+    stdu    1,-144(1)
+    std     0,16(1)
+
+    /* store argc/argv/envp to RTL slots */
+    addis   10,2,operatingsystem_parameter_argc@toc@ha
+    addi    10,10,operatingsystem_parameter_argc@toc@l
+    stw     3,0(10)
+
+    addis   10,2,operatingsystem_parameter_argv@toc@ha
+    addi    10,10,operatingsystem_parameter_argv@toc@l
+    std     4,0(10)
+
+    addis   10,2,operatingsystem_parameter_envp@toc@ha
+    addi    10,10,operatingsystem_parameter_envp@toc@l
+    std     5,0(10)
+
+    /* stash initial SP */
+    addis   8,2,__stkptr@toc@ha
+    addi    8,8,__stkptr@toc@l
+    std     1,0(8)
+
+    /* call library initialization */
+    bl      PASCALMAIN
+    nop
+
+    /* epilogue / return to caller */
+    ld      0,16(1)
+    addi    1,1,144
+    mtlr    0
+    blr
+.size FPC_SHARED_LIB_START, .-FPC_SHARED_LIB_START
+
+/*
+ * Called when the RTL in the shared library performs halt().
+ * FreeBSD: no exit_group; just exit(status).
+ */
+FUNCTION_PROLOG _haltproc
+    /* r3 = operatingsystem_result */
+    addis   3,2,operatingsystem_result@toc@ha
+    addi    3,3,operatingsystem_result@toc@l
+    lwz     3,0(3)
+    bl      exit
+    nop
+    /* should not return */
+    trap
+.size _haltproc, .-_haltproc
+
+/* --- data/bss ----------------------------------------------------------- */
+
+        /* first piece of initialized data (optional marker) */
+        .section ".data"
+        .globl  __data_start
+__data_start:
+data_start:
+
+        .section ".bss"
+
+        .type   __stkptr, @object
+        .size   __stkptr, 8
+        .globl  __stkptr
+__stkptr:
+        .skip   8
+
+        .type   operatingsystem_parameters, @object
+        .size   operatingsystem_parameters, 24
+operatingsystem_parameters:
+        .skip   3*8
+
+        .globl  operatingsystem_parameter_argc
+        .globl  operatingsystem_parameter_argv
+        .globl  operatingsystem_parameter_envp
+        .set    operatingsystem_parameter_argc, operatingsystem_parameters+0
+        .set    operatingsystem_parameter_argv, operatingsystem_parameters+8
+        .set    operatingsystem_parameter_envp, operatingsystem_parameters+16
+

+ 106 - 0
rtl/freebsd/powerpc64/gprt0.as

@@ -0,0 +1,106 @@
+/* FreeBSD/FPC startup for PowerPC64 ELFv2
+ * Derived from glibc crt0 but stripped of ELFv1 .opd/ptrgl.
+ */
+
+        .section .text
+        .align 2
+        .globl _start
+        .type  _start,@function
+_start:
+        # r3=argc, r4=argv, r5=envp (ELFv2)
+        mr      9,1                  # save SP
+
+        clrrdi  1,1,4                # align SP
+        li      0,0
+        stdu    1,-128(1)
+        mtlr    0
+        std     0,16(1)
+
+        # Save argc/argv/envp for Pascal RTL
+        lis     8, operatingsystem_parameter_argc@highest
+        ori     8,8,operatingsystem_parameter_argc@higher
+        sldi    8,8,32
+        oris    8,8,operatingsystem_parameter_argc@h
+        ori     8,8,operatingsystem_parameter_argc@l
+        stw     3,0(8)
+
+        lis     8, operatingsystem_parameter_argv@highest
+        ori     8,8,operatingsystem_parameter_argv@higher
+        sldi    8,8,32
+        oris    8,8,operatingsystem_parameter_argv@h
+        ori     8,8,operatingsystem_parameter_argv@l
+        std     4,0(8)
+
+        lis     8, operatingsystem_parameter_envp@highest
+        ori     8,8,operatingsystem_parameter_envp@higher
+        sldi    8,8,32
+        oris    8,8,operatingsystem_parameter_envp@h
+        ori     8,8,operatingsystem_parameter_envp@l
+        std     5,0(8)
+
+        lis     8, __stkptr@highest
+        ori     8,8,__stkptr@higher
+        sldi    8,8,32
+        oris    8,8,__stkptr@h
+        ori     8,8,__stkptr@l
+        std     1,0(8)
+
+        # Call Pascal entry
+        bl      PASCALMAIN
+        nop
+
+        b       _haltproc
+
+        .size _start, .-_start
+
+        .globl _haltproc
+        .type  _haltproc,@function
+_haltproc:
+        lis     8, ___fpc_ret@highest
+        ori     8,8,___fpc_ret@higher
+        sldi    8,8,32
+        oris    8,8,___fpc_ret@h
+        ori     8,8,___fpc_ret@l
+        ld      1,0(8)
+        addi    1,1,128
+        ld      0,16(1)
+        mtlr    0
+        blr
+		nop
+        .size _haltproc, .-_haltproc
+
+        .section .data
+        .globl __data_start
+__data_start:
+data_start:
+
+___fpc_ret:
+        .quad 0
+
+        .section .bss
+        .type __stkptr,@object
+        .size __stkptr,8
+        .globl __stkptr
+__stkptr:
+        .skip 8
+
+        .type operatingsystem_parameters,@object
+        .size operatingsystem_parameters,24
+        .globl operatingsystem_parameters
+operatingsystem_parameters:
+        .skip 24
+        .globl operatingsystem_parameter_argc
+        .globl operatingsystem_parameter_argv
+        .globl operatingsystem_parameter_envp
+        .set operatingsystem_parameter_argc,operatingsystem_parameters+0
+        .set operatingsystem_parameter_argv,operatingsystem_parameters+8
+        .set operatingsystem_parameter_envp,operatingsystem_parameters+16
+
+        .section .note.ABI-tag,"a",@progbits
+        .p2align 2
+        .long 8,4,1              # name size, desc size, tag
+        .string "FreeBSD"        # ABI name
+        .p2align 2
+        .long 0,0,0              # version fields
+
+        .section .note.GNU-stack,"",%progbits

+ 101 - 0
rtl/freebsd/powerpc64/prt0.as

@@ -0,0 +1,101 @@
+/*
+ * FreeBSD PowerPC64 (ELFv2) startup code for Free Pascal
+ */
+
+.macro LOAD_64BIT_VAL ra, value
+    lis       \ra,\value@highest
+    ori       \ra,\ra,\value@higher
+    sldi      \ra,\ra,32
+    oris      \ra,\ra,\value@h
+    ori       \ra,\ra,\value@l
+.endm
+
+.macro FUNCTION_PROLOG fn
+    .text
+    .align  2
+    .globl  \fn
+    .type   \fn,@function
+\fn:
+.endm
+
+/* Entry point for dynamic executables */
+FUNCTION_PROLOG _dynamic_start
+    /* r3 = argc, r4 = argv, r5 = envp */
+
+    LOAD_64BIT_VAL 10, operatingsystem_parameter_argc
+    stw     3,0(10)
+
+    LOAD_64BIT_VAL 10, operatingsystem_parameter_argv
+    std     4,0(10)
+
+    LOAD_64BIT_VAL 10, operatingsystem_parameter_envp
+    std     5,0(10)
+
+    LOAD_64BIT_VAL 8,__stkptr
+    std     1,0(8)
+
+    mffs    0
+    mtfsb1  31          # ensure NANQ bit (optional safety)
+    mtfsf   0xff,0
+
+    bl      PASCALMAIN
+    nop
+
+    trap  /* should never return */
+
+/* Entry point for static executables */
+FUNCTION_PROLOG _start
+    /* FreeBSD ELFv2: r3=argc, r4=argv, r5=envp already valid */
+
+    LOAD_64BIT_VAL 10, operatingsystem_parameter_argc
+    stw     3,0(10)
+
+    LOAD_64BIT_VAL 10, operatingsystem_parameter_argv
+    std     4,0(10)
+
+    LOAD_64BIT_VAL 10, operatingsystem_parameter_envp
+    std     5,0(10)
+
+    LOAD_64BIT_VAL 8,__stkptr
+    std     1,0(8)
+
+    mffs    0
+    mtfsb1  31          # ensure NANQ bit (optional safety)
+    mtfsf   0xff,0
+
+    bl      PASCALMAIN
+    nop
+
+    trap
+
+FUNCTION_PROLOG _haltproc
+    /* just call FreeBSD exit() */
+    LOAD_64BIT_VAL 3, operatingsystem_result
+    lwz     3,0(3)    /* r3 = exit code */
+    li      0,1       /* syscall: exit */
+    sc
+    trap
+
+/* BSS globals */
+    .data
+    .globl __data_start
+__data_start:
+data_start:
+
+    .bss
+    .type __stkptr,@object
+    .size __stkptr,8
+    .globl __stkptr
+__stkptr:
+    .skip 8
+
+    .type operatingsystem_parameters,@object
+    .size operatingsystem_parameters,24
+operatingsystem_parameters:
+    .skip 3*8
+    .globl operatingsystem_parameter_argc
+    .globl operatingsystem_parameter_argv
+    .globl operatingsystem_parameter_envp
+    .set operatingsystem_parameter_argc,operatingsystem_parameters+0
+    .set operatingsystem_parameter_argv,operatingsystem_parameters+8
+    .set operatingsystem_parameter_envp,operatingsystem_parameters+16

+ 88 - 0
rtl/freebsd/powerpc64/si_c.inc

@@ -0,0 +1,88 @@
+
+Type
+    TCleanup = procedure; cdecl;
+
+var
+  environ : PPAnsiChar; cvar; public  name '__environ';
+  progname: PAnsiChar = #0#0; cvar; public name '__progname';
+  dynamic : PAnsiChar;  external name '_DYNAMIC'; // #pragma weak
+
+procedure atexit(prc:TCleanup); cdecl external name 'atexit';
+procedure cleanup(prc:TCleanup); cdecl external name 'cleanup';
+procedure init_tls; cdecl; external name 'init_tls';
+procedure fini; cdecl; external name '_fini';
+procedure init; cdecl; external name '_init';
+procedure libc_exit(exitcode:longint);cdecl; external name 'exit';
+function  main(nrarg:longint;pp:PPAnsiChar;env:PPAnsiChar):longint; cdecl; external name 'main';
+
+{$ifdef gcrt}
+ procedure cmcleanup; cdecl; external name '_mcleanup';
+ procedure monstratup(p,p2:pointer); cdecl; external name 'monstartup';
+
+var
+ eprol:longint; external name 'eprol';
+ etext:longint; external name 'etext';
+{$endif}
+
+procedure start(ap:PPAnsiChar;cleanup:TCleanup);
+
+var argc: longint;
+    argv: PPAnsiChar;
+    env : PPAnsiChar;
+    s   : PAnsiChar;
+begin
+  argc:=plongint(ap)^;
+  argv:=PPAnsiChar(ap[1]);
+  env:=	PPAnsiChar(ap[2+argc]);
+  environ:=env;
+  if (argc>0) and (argv[0]<>#0) Then
+   begin
+     progname:=argv[0];
+     s:=progname;
+     while s^<>#0 do
+        begin
+          if s^='/' then
+            progname:=@s[1];
+          inc(s);
+	end;
+    end;
+  if assigned(PAnsiChar(@dynamic)) then // I suspect this is a trick to find
+				    // out runtime if we are shared
+				    // linking, so the same code can be used
+				    // for static and shared linking
+    atexit(cleanup)
+  else
+    init_tls;
+  {$ifdef GCRT}
+    atexit(@_mcleanup);
+  {$endif}
+  atexit(@fini);
+  {$ifdef GCRT}
+    monstartup(@eprol,@etext);
+   asm
+    eprol:
+   end;
+  {$endif}
+  init;
+  libc_exit(main(argc,argv,env)); // doesn't return
+ asm
+     { We need this stuff to make gdb behave itself, otherwise
+      gdb will chokes with SIGILL when trying to debug apps.
+    }
+    .section ".note.ABI-tag", "a"
+    .align 4
+    .long 8
+    .long 4
+    .long  1
+    .asciz "FreeBSD"
+    .align 4
+    .long	900044
+    .align 4
+    .section	.note.GNU-stack,"",@progbits
+  end;
+end;
+
+
+
+begin
+end.

+ 56 - 0
rtl/freebsd/powerpc64/sighnd.inc

@@ -0,0 +1,56 @@
+{
+   This file is part of the Free Pascal run time library.
+   (c) 2000-2003 by Marco van de Voort
+   (c) 2025 adapted for FreeBSD/PowerPC64 ELFv2
+
+   See the file COPYING.FPC, included in this distribution,
+   for details about the copyright.
+
+   Signalhandler for FreeBSD/PowerPC64
+
+   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.
+}
+
+procedure SignalToRunerror(sig: cint; info: psiginfo; sigcontext: PSigContext);
+  public name '_FPC_DEFAULTSIGHANDLER'; cdecl;
+
+var
+  res: word;
+
+begin
+  res := 0;
+  case sig of
+    SIGFPE:
+      begin
+        case info^.si_code of
+          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 := 208;              { generic coprocessor error }
+        end;
+        sysResetFPU;               { reset FPSCR on PowerPC64 }
+      end;
+    SIGILL,
+    SIGBUS,
+    SIGSEGV:
+      res := 216;
+    SIGINT:
+      res := 217;
+    SIGQUIT:
+      res := 233;
+  end;
+
+  {$ifdef FPC_USE_SIGPROCMASK}
+  reenable_signal(sig);
+  {$endif}
+
+  { give runtime error at the position where the signal was raised }
+  if res <> 0 then
+    HandleError(res);
+end;
+

+ 291 - 0
rtl/freebsd/powerpc64/syscall.inc

@@ -0,0 +1,291 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2005 by Thomas Schatzl,
+    member of the Free Pascal development team.
+
+    Linux powerpc syscall wrapper implementation 
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+
+{ This variable is needed in syscall.inc assembler code }
+var
+  fpc_threadvar_relocate_proc : TRelocateThreadVarHandler; public name 'FPC_THREADVAR_RELOCATE';
+{$define THREADVAR_RELOCATED_ALREADY_DEFINED}
+
+{*****************************************************************************
+                     --- Main:The System Call Self ---
+*****************************************************************************}
+
+function FpSysCall(sysnr:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL0'];
+{
+  This function puts the registers in place, does the call, and then
+  copies back the registers as they are after the SysCall.
+}
+var
+  { workaround for incomplete linkage area reservation by FPC 3.0.0 and earlier,
+    remove after 3.0.2 is the minimum bootstrap version }
+  dummy: array[1..4] of ptruint;
+  retaddress: ptruint;
+asm
+  mr r0, r3
+  sc
+  bns .LDone
+  mflr r4
+  std r4, retaddress
+  bl seterrno
+  nop
+  ld r4, retaddress
+  li r3, -1
+  mtlr r4
+.LDone:
+end;
+
+function FpSysCall(sysnr,param1:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL1'];
+{
+  This function puts the registers in place, does the call, and then
+  copies back the registers as they are after the SysCall.
+}
+var
+  { workaround for incomplete linkage area reservation by FPC 3.0.0 and earlier,
+    remove after 3.0.2 is the minimum bootstrap version }
+  dummy: array[1..4] of ptruint;
+  retaddress: ptruint;
+asm
+  mr r0, r3
+  mr r3, r4
+  sc
+  bns .LDone
+  mflr r4
+  std r4, retaddress
+  bl seterrno
+  nop
+  ld r4, retaddress
+  li r3, -1
+  mtlr r4
+.LDone:
+end;
+
+function FpSysCall(sysnr,param1,param2:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL2'];
+{
+  This function puts the registers in place, does the call, and then
+  copies back the registers as they are after the SysCall.
+}
+var
+  { workaround for incomplete linkage area reservation by FPC 3.0.0 and earlier,
+    remove after 3.0.2 is the minimum bootstrap version }
+  dummy: array[1..4] of ptruint;
+  retaddress: ptruint;
+asm
+  mr r0, r3
+  mr r3, r4
+  mr r4, r5
+  sc
+  bns .LDone
+  mflr r4
+  std r4, retaddress
+  bl seterrno
+  nop
+  ld r4, retaddress
+  li r3, -1
+  mtlr r4
+.LDone:
+end;
+
+
+function FpSysCall(sysnr,param1,param2,param3:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL3'];
+{
+  This function puts the registers in place, does the call, and then
+  copies back the registers as they are after the SysCall.
+}
+var
+  { workaround for incomplete linkage area reservation by FPC 3.0.0 and earlier,
+    remove after 3.0.2 is the minimum bootstrap version }
+  dummy: array[1..4] of ptruint;
+  retaddress: ptruint;
+asm
+  mr r0, r3
+  mr r3, r4
+  mr r4, r5
+  mr r5, r6
+  sc
+  bns .LDone
+  mflr r4
+  std r4, retaddress
+  bl seterrno
+  nop
+  ld r4, retaddress
+  li r3, -1
+  mtlr r4
+.LDone:
+end;
+
+
+function FpSysCall(sysnr,param1,param2,param3,param4:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL4'];
+{
+  This function puts the registers in place, does the call, and then
+  copies back the registers as they are after the SysCall.
+}
+var
+  { workaround for incomplete linkage area reservation by FPC 3.0.0 and earlier,
+    remove after 3.0.2 is the minimum bootstrap version }
+  dummy: array[1..4] of ptruint;
+  retaddress: ptruint;
+asm
+  mr r0, r3
+  mr r3, r4
+  mr r4, r5
+  mr r5, r6
+  mr r6, r7
+  sc
+  bns .LDone
+  mflr r4
+  std r4, retaddress
+  bl seterrno
+  nop
+  ld r4, retaddress
+  li r3, -1
+  mtlr r4
+.LDone:
+end;
+
+
+function FpSysCall(sysnr,param1,param2,param3,param4,param5:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL5'];
+{
+  This function puts the registers in place, does the call, and then
+  copies back the registers as they are after the SysCall.
+}
+var
+  { workaround for incomplete linkage area reservation by FPC 3.0.0 and earlier,
+    remove after 3.0.2 is the minimum bootstrap version }
+  dummy: array[1..4] of ptruint;
+  retaddress: ptruint;
+asm
+  mr r0, r3
+  mr r3, r4
+  mr r4, r5
+  mr r5, r6
+  mr r6, r7
+  mr r7, r8
+  sc
+  bns .LDone
+  mflr r4
+  std r4, retaddress
+  bl seterrno
+  nop
+  ld r4, retaddress
+  li r3, -1
+  mtlr r4
+.LDone:
+end;
+
+
+function FpSysCall(sysnr,param1,param2,param3,param4,param5,param6:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL6'];
+{
+  This function puts the registers in place, does the call, and then
+  copies back the registers as they are after the SysCall.
+}
+var
+  { workaround for incomplete linkage area reservation by FPC 3.0.0 and earlier,
+    remove after 3.0.2 is the minimum bootstrap version }
+  dummy: array[1..4] of ptruint;
+  retaddress: ptruint;
+asm
+  mr r0, r3
+  mr r3, r4
+  mr r4, r5
+  mr r5, r6
+  mr r6, r7
+  mr r7, r8
+  mr r8, r9
+  sc
+  bns .LDone
+  mflr r4
+  std r4, retaddress
+  bl seterrno
+  nop
+  ld r4, retaddress
+  li r3, -1
+  mtlr r4
+.LDone:
+end;
+
+function FpSysCall(sysnr,param1,param2,param3,param4,param5,param6,param7:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL7'];
+{
+  This function puts the registers in place, does the call, and then
+  copies back the registers as they are after the SysCall.
+}
+asm
+  mr  r0,r3
+  mr  r3,r4
+  mr  r4,r5
+  mr  r5,r6
+  mr  r6,r7
+  mr  r7,r8
+  mr  r8,r9
+  mr  r9,r10
+  sc
+  bnslr
+  lis   r4,Errno@ha
+  stw   r3,Errno@l(r4)
+  li    r3,-1
+  li    r4,-1
+end;
+
+function FpSysCall(sysnr,param1,param2,param3,param4,param5,param6,param7,param8:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL8'];
+{
+  This function puts the registers in place, does the call, and then
+  copies back the registers as they are after the SysCall.
+}
+asm
+  mr  r0,r3
+  mr  r3,r4
+  mr  r4,r5
+  mr  r5,r6
+  mr  r6,r7
+  mr  r7,r8
+  mr  r8,r9
+  mr  r9,r10
+  mr  r10,r11
+  sc
+  bnslr
+  lis   r4,Errno@ha
+  stw   r3,Errno@l(r4)
+  li    r3,-1
+  li    r4,-1
+  li    r5,-1
+end;
+
+function FpSysCall(sysnr,param1,param2,param3,param4,param5,param6,param7,param8,param9:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL9'];
+{
+  This function puts the registers in place, does the call, and then
+  copies back the registers as they are after the SysCall.
+}
+asm
+  mr  r0,r3
+  mr  r3,r4
+  mr  r4,r5
+  mr  r5,r6
+  mr  r6,r7
+  mr  r7,r8
+  mr  r8,r9
+  mr  r9,r10
+  mr  r10,r11
+  mr  r11,r12
+  sc
+  bnslr
+  lis   r4,Errno@ha
+  stw   r3,Errno@l(r4)
+  li    r3,-1
+  li    r4,-1
+  li    r5,-1
+  li    r6,-1
+end;
+
+

+ 35 - 0
rtl/freebsd/powerpc64/syscallh.inc

@@ -0,0 +1,35 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2002 Marco van de Voort
+    member of the Free Pascal development team.
+
+    powerpc64 syscall headers for FreeBSD 
+
+    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.
+
+ **********************************************************************}
+
+type
+  TSysResult = Int64;   // all platforms, cint=32-bit.
+                        // On platforms with off_t =64-bit, people should
+                        // use int64, and typecast all calls that don't
+                        // return off_t to cint.
+
+// I don't think this is going to work on several platforms
+// 64-bit machines don't have only 64-bit params.
+
+  TSysParam  = Int64;
+
+function Do_SysCall(sysnr:TSysParam):TSysResult;  external name 'FPC_SYSCALL0';
+function Do_SysCall(sysnr,param1:TSysParam):TSysResult; external name 'FPC_SYSCALL1';
+function Do_SysCall(sysnr,param1,param2:TSysParam):TSysResult;  external name 'FPC_SYSCALL2';
+function Do_SysCall(sysnr,param1,param2,param3:TSysParam):TSysResult; external name 'FPC_SYSCALL3';
+function Do_SysCall(sysnr,param1,param2,param3,param4:TSysParam):TSysResult; external name 'FPC_SYSCALL4';
+function Do_SysCall(sysnr,param1,param2,param3,param4,param5:TSysParam):TSysResult;  external name 'FPC_SYSCALL5';
+function Do_SysCall(sysnr,param1,param2,param3,param4,param5,param6:TSysParam):TSysResult;  external name 'FPC_SYSCALL6';
+function Do_SysCall(sysnr,param1,param2,param3,param4,param5,param6,param7:TSysParam):TSysResult;  external name 'FPC_SYSCALL7';

+ 6 - 0
rtl/freebsd/signal.inc

@@ -130,6 +130,12 @@ type sigset_t = array[0..3] of Longint;
         end;
 {$endif cpuaarch64}
 
+{$ifdef CPUPOWERPC64}
+    SigContextRec = record
+            _dummy : cint;
+       end;
+{$endif}
+
   Sigval = Record
             Case Boolean OF
         { Members as suggested by Annex C of POSIX 1003.1b. }

+ 30 - 0
rtl/freebsd/ucontexth.inc

@@ -83,6 +83,36 @@ type
   end;
 {$endif cpuaarch64}
 
+{$ifdef powerpc64}
+  gpregs = record
+    { General-purpose registers r0..r31 }
+    gp_r: array[0..31] of NativeUInt;  { 64-bit each }
+
+    { 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;
+
+  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;
+
+  mcontext_t = record
+    mc_gpregs: gpregs;
+    mc_fpregs: fpregs;
+    mc_flags: Int32;
+    mc_pad:   Int32;
+    mc_spare: array[0..7] of NativeInt;
+  end;
+{$endif}
+
   pucontext_t = ^ucontext_t;
   ucontext_t = record  // required for kse threads
     {*

+ 10 - 1
utils/Makefile

@@ -2,7 +2,7 @@
 # Don't edit, this file is generated by FPCMake Version 2.0.0
 #
 default: all
-MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim i386-android i386-aros m68k-linux m68k-netbsd m68k-amiga m68k-atari m68k-palmos m68k-macosclassic m68k-embedded m68k-sinclairql m68k-human68k powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macosclassic powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii powerpc-aix sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-haiku x86_64-netbsd x86_64-solaris x86_64-openbsd x86_64-darwin x86_64-win64 x86_64-embedded x86_64-iphonesim x86_64-android x86_64-aros x86_64-dragonfly arm-linux arm-netbsd arm-palmos arm-wince arm-gba arm-nds arm-embedded arm-symbian arm-android arm-aros arm-freertos arm-ios powerpc64-linux powerpc64-darwin powerpc64-embedded powerpc64-aix avr-embedded armeb-linux armeb-embedded mips-linux mipsel-linux mipsel-embedded mipsel-android mipsel-ps1 mips64-linux mips64el-linux jvm-java jvm-android i8086-embedded i8086-msdos i8086-win16 aarch64-linux aarch64-freebsd aarch64-darwin aarch64-win64 aarch64-embedded aarch64-iphonesim aarch64-android aarch64-ios wasm32-embedded wasm32-wasip1 wasm32-wasip1threads wasm32-wasip2 sparc64-linux riscv32-linux riscv32-embedded riscv32-freertos riscv64-linux riscv64-embedded xtensa-linux xtensa-embedded xtensa-freertos z80-embedded z80-zxspectrum z80-msxdos z80-amstradcpc loongarch64-linux
+MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim i386-android i386-aros m68k-linux m68k-netbsd m68k-amiga m68k-atari m68k-palmos m68k-macosclassic m68k-embedded m68k-sinclairql m68k-human68k powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macosclassic powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii powerpc-aix sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-haiku x86_64-netbsd x86_64-solaris x86_64-openbsd x86_64-darwin x86_64-win64 x86_64-embedded x86_64-iphonesim x86_64-android x86_64-aros x86_64-dragonfly arm-linux arm-netbsd arm-palmos arm-wince arm-gba arm-nds arm-embedded arm-symbian arm-android arm-aros arm-freertos arm-ios powerpc64-linux powerpc64-darwin powerpc64-embedded powerpc64-aix powerpc64-freebsd avr-embedded armeb-linux armeb-embedded mips-linux mipsel-linux mipsel-embedded mipsel-android mipsel-ps1 mips64-linux mips64el-linux jvm-java jvm-android i8086-embedded i8086-msdos i8086-win16 aarch64-linux aarch64-freebsd aarch64-darwin aarch64-win64 aarch64-embedded aarch64-iphonesim aarch64-android aarch64-ios wasm32-embedded wasm32-wasip1 wasm32-wasip1threads wasm32-wasip2 sparc64-linux riscv32-linux riscv32-embedded riscv32-freertos riscv64-linux riscv64-embedded xtensa-linux xtensa-embedded xtensa-freertos z80-embedded z80-zxspectrum z80-msxdos z80-amstradcpc loongarch64-linux
 BSDs = freebsd netbsd openbsd darwin dragonfly
 UNIXs = linux $(BSDs) solaris qnx haiku aix
 LIMIT83fs = go32v2 os2 emx watcom msdos win16 atari human68k
@@ -1853,6 +1853,15 @@ REQUIRE_PACKAGES_LIBTAR=1
 REQUIRE_PACKAGES_FPMKUNIT=1
 REQUIRE_PACKAGES_FCL-JSON=1
 endif
+ifeq ($(CPU_OS_TARGET),powerpc64-freebsd)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_LIBTAR=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_FCL-JSON=1
+endif
 ifeq ($(CPU_OS_TARGET),avr-embedded)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PASZLIB=1

+ 10 - 1
utils/build/Makefile.pkg

@@ -2,7 +2,7 @@
 # Don't edit, this file is generated by FPCMake Version 2.0.0
 #
 default: all
-MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim i386-android i386-aros m68k-linux m68k-netbsd m68k-amiga m68k-atari m68k-palmos m68k-macosclassic m68k-embedded m68k-sinclairql m68k-human68k powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macosclassic powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii powerpc-aix sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-haiku x86_64-netbsd x86_64-solaris x86_64-openbsd x86_64-darwin x86_64-win64 x86_64-embedded x86_64-iphonesim x86_64-android x86_64-aros x86_64-dragonfly arm-linux arm-netbsd arm-palmos arm-wince arm-gba arm-nds arm-embedded arm-symbian arm-android arm-aros arm-freertos arm-ios powerpc64-linux powerpc64-darwin powerpc64-embedded powerpc64-aix avr-embedded armeb-linux armeb-embedded mips-linux mipsel-linux mipsel-embedded mipsel-android mipsel-ps1 mips64-linux mips64el-linux jvm-java jvm-android i8086-embedded i8086-msdos i8086-win16 aarch64-linux aarch64-freebsd aarch64-darwin aarch64-win64 aarch64-embedded aarch64-iphonesim aarch64-android aarch64-ios wasm32-embedded wasm32-wasip1 wasm32-wasip1threads wasm32-wasip2 sparc64-linux riscv32-linux riscv32-embedded riscv32-freertos riscv64-linux riscv64-embedded xtensa-linux xtensa-embedded xtensa-freertos z80-embedded z80-zxspectrum z80-msxdos z80-amstradcpc loongarch64-linux
+MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim i386-android i386-aros m68k-linux m68k-netbsd m68k-amiga m68k-atari m68k-palmos m68k-macosclassic m68k-embedded m68k-sinclairql m68k-human68k powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macosclassic powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii powerpc-aix sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-haiku x86_64-netbsd x86_64-solaris x86_64-openbsd x86_64-darwin x86_64-win64 x86_64-embedded x86_64-iphonesim x86_64-android x86_64-aros x86_64-dragonfly arm-linux arm-netbsd arm-palmos arm-wince arm-gba arm-nds arm-embedded arm-symbian arm-android arm-aros arm-freertos arm-ios powerpc64-linux powerpc64-darwin powerpc64-embedded powerpc64-aix powerpc64-freebsd avr-embedded armeb-linux armeb-embedded mips-linux mipsel-linux mipsel-embedded mipsel-android mipsel-ps1 mips64-linux mips64el-linux jvm-java jvm-android i8086-embedded i8086-msdos i8086-win16 aarch64-linux aarch64-freebsd aarch64-darwin aarch64-win64 aarch64-embedded aarch64-iphonesim aarch64-android aarch64-ios wasm32-embedded wasm32-wasip1 wasm32-wasip1threads wasm32-wasip2 sparc64-linux riscv32-linux riscv32-embedded riscv32-freertos riscv64-linux riscv64-embedded xtensa-linux xtensa-embedded xtensa-freertos z80-embedded z80-zxspectrum z80-msxdos z80-amstradcpc loongarch64-linux
 BSDs = freebsd netbsd openbsd darwin dragonfly
 UNIXs = linux $(BSDs) solaris qnx haiku aix
 LIMIT83fs = go32v2 os2 emx watcom msdos win16 atari human68k
@@ -1837,6 +1837,15 @@ REQUIRE_PACKAGES_LIBTAR=1
 REQUIRE_PACKAGES_FPMKUNIT=1
 REQUIRE_PACKAGES_FCL-JSON=1
 endif
+ifeq ($(CPU_OS_TARGET),powerpc64-freebsd)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_LIBTAR=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_FCL-JSON=1
+endif
 ifeq ($(CPU_OS_TARGET),avr-embedded)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PASZLIB=1

+ 1 - 1
utils/fpcm/fpcmmain.pp

@@ -165,7 +165,7 @@ interface
         { go32v2 }  ( false, true,  false, false, false, false, false, false, false, false, false, false, false, false, false,   false, false, false,  false, false, false,  false,  false, false, false),
         { win32 }   ( false, true,  false, false, false, false, false, false, false, false, false, false, false, false, false,   false, false, false,  false, false, false,  false,  false, false, false),
         { os2 }     ( false, true,  false, false, false, false, false, false, false, false, false, false, false, false, false,   false, false, false,  false, false, false,  false,  false, false, false),
-        { freebsd } ( false, true,  false, false, false, true,  false, false, false, false, false, false, false, false, false,   false, false, true,   false, false, false,  false,  false, false, false),
+        { freebsd } ( false, true,  false, false, false, true,  false, true,  false, false, false, false, false, false, false,   false, false, true,   false, false, false,  false,  false, false, false),
         { beos }    ( false, true,  false, false, false, false, false, false, false, false, false, false, false, false, false,   false, false, false,  false, false, false,  false,  false, false, false),
         { haiku }   ( false, true,  false, false, false, true,  false, false, false, false, false, false, false, false, false,   false, false, false,  false, false, false,  false,  false, false, false),
         { netbsd }  ( false, true,  true,  true,  true,  true,  true,  false, false, false, false, false, false, false, false,   false, false, false,  false, false, false,  false,  false, false, false),