View Issue Details

IDProjectCategoryView StatusLast Update
0038441FPC-public2021-04-10 10:20
ReporterMikaël Urankar Assigned ToJonas Maebe  
PrioritynormalSeverityminorReproducibilityN/A
Status resolvedResolutionfixed 
Product Version3.3.1 
Fixed in Version3.3.1 
Summary0038441: port to FreeBSD aarch64
Descriptionport to FreeBSD aarch64
TagsNo tags attached.
Fixed in Revision49159
FPCOldBugId
FPCTarget-
Attached Files

Activities

Mikaël Urankar

2021-02-05 14:25

reporter  

freepascal.patch (36,911 bytes)   
From 7f4ce679c994069cd2d8c319c1f2213462700415 Mon Sep 17 00:00:00 2001
From: MikaelUrankar <mikael.urankar@gmail.com>
Date: Tue, 26 Jan 2021 15:05:33 +0100
Subject: [PATCH] Port to FreeBSD aarch64

---
 compiler/aarch64/a64att.inc        |   1 +
 compiler/aarch64/a64atts.inc       |   1 +
 compiler/aarch64/a64ins.dat        |   2 +
 compiler/aarch64/a64op.inc         |   1 +
 compiler/aarch64/agcpugas.pas      |   2 +-
 compiler/aarch64/cpubase.pas       |   2 +-
 compiler/aarch64/cputarg.pas       |   3 +
 compiler/systems.inc               |   3 +-
 compiler/systems.pas               |   9 +-
 compiler/systems/i_bsd.pas         |  81 ++++++++++++++
 compiler/systems/t_bsd.pas         |   5 +
 compiler/utils/ppuutils/ppudump.pp |   3 +-
 rtl/bsd/aarch64/syscall.inc        | 140 ++++++++++++++++++++++++
 rtl/bsd/aarch64/syscallh.inc       |  38 +++++++
 rtl/bsd/bunxsysc.inc               |   2 +-
 rtl/freebsd/aarch64/bsyscall.inc   |   1 +
 rtl/freebsd/aarch64/cprt0.as       | 157 +++++++++++++++++++++++++++
 rtl/freebsd/aarch64/dllprt0.as     | 138 ++++++++++++++++++++++++
 rtl/freebsd/aarch64/gprt0.as       | 166 +++++++++++++++++++++++++++++
 rtl/freebsd/aarch64/prt0.as        | 147 +++++++++++++++++++++++++
 rtl/freebsd/aarch64/si_c.inc       |  89 ++++++++++++++++
 rtl/freebsd/aarch64/sighnd.inc     |  43 ++++++++
 rtl/freebsd/signal.inc             |   7 ++
 rtl/freebsd/ucontexth.inc          |  28 +++++
 utils/fpcm/fpcmmain.pp             |   2 +-
 25 files changed, 1063 insertions(+), 8 deletions(-)
 create mode 100644 rtl/bsd/aarch64/syscall.inc
 create mode 100644 rtl/bsd/aarch64/syscallh.inc
 create mode 100644 rtl/freebsd/aarch64/bsyscall.inc
 create mode 100644 rtl/freebsd/aarch64/cprt0.as
 create mode 100644 rtl/freebsd/aarch64/dllprt0.as
 create mode 100644 rtl/freebsd/aarch64/gprt0.as
 create mode 100644 rtl/freebsd/aarch64/prt0.as
 create mode 100644 rtl/freebsd/aarch64/si_c.inc
 create mode 100644 rtl/freebsd/aarch64/sighnd.inc

diff --git a/compiler/aarch64/a64att.inc b/compiler/aarch64/a64att.inc
index 599cd2a372..9917a494d5 100644
--- a/compiler/aarch64/a64att.inc
+++ b/compiler/aarch64/a64att.inc
@@ -2,6 +2,7 @@
 (
 'none',
 'b',
+'bcc',
 'cbz',
 'cbnz',
 'tbz',
diff --git a/compiler/aarch64/a64atts.inc b/compiler/aarch64/a64atts.inc
index 1b7f1f18ea..f75fb696d9 100644
--- a/compiler/aarch64/a64atts.inc
+++ b/compiler/aarch64/a64atts.inc
@@ -397,5 +397,6 @@ attsufNONE,
 attsufNONE,
 attsufNONE,
 attsufNONE,
+attsufNONE,
 attsufNONE
 );
diff --git a/compiler/aarch64/a64ins.dat b/compiler/aarch64/a64ins.dat
index 1e528be8b6..3564a5a396 100644
--- a/compiler/aarch64/a64ins.dat
+++ b/compiler/aarch64/a64ins.dat
@@ -3,6 +3,8 @@
 
 [B]
 
+[BCC]
+
 [CBZ]
 
 [CBNZ]
diff --git a/compiler/aarch64/a64op.inc b/compiler/aarch64/a64op.inc
index 55cf0ed0a4..a809195b07 100644
--- a/compiler/aarch64/a64op.inc
+++ b/compiler/aarch64/a64op.inc
@@ -2,6 +2,7 @@
 (
 A_NONE,
 A_B,
+A_BCC,
 A_CBZ,
 A_CBNZ,
 A_TBZ,
diff --git a/compiler/aarch64/agcpugas.pas b/compiler/aarch64/agcpugas.pas
index d6fd59ac76..00fd6aaf20 100644
--- a/compiler/aarch64/agcpugas.pas
+++ b/compiler/aarch64/agcpugas.pas
@@ -767,7 +767,7 @@       TAArch64ClangGASAssembler=class(TAArch64Assembler)
             idtxt  : 'AS';
             asmbin : 'as';
             asmcmd : '-o $OBJ $EXTRAOPT $ASM';
-            supported_targets : [system_aarch64_linux,system_aarch64_android];
+            supported_targets : [system_aarch64_freebsd,system_aarch64_linux,system_aarch64_android];
             flags : [af_needar,af_smartlink_sections];
             labelprefix : '.L';
             labelmaxlen : -1;
diff --git a/compiler/aarch64/cpubase.pas b/compiler/aarch64/cpubase.pas
index 92d5da84e4..1899e167ba 100644
--- a/compiler/aarch64/cpubase.pas
+++ b/compiler/aarch64/cpubase.pas
@@ -442,7 +442,7 @@       tshifterop = record
 
     function is_calljmp(o:tasmop):boolean;{$ifdef USEINLINE}inline;{$endif USEINLINE}
       begin
-        is_calljmp:=o in [A_B,A_BL,A_BLR,A_RET,A_CBNZ,A_CBZ,A_TBNZ,A_TBZ];
+        is_calljmp:=o in [A_B,A_BCC,A_BL,A_BLR,A_RET,A_CBNZ,A_CBZ,A_TBNZ,A_TBZ];
       end;
 
 
diff --git a/compiler/aarch64/cputarg.pas b/compiler/aarch64/cputarg.pas
index 06bd7547df..05af1c3e75 100644
--- a/compiler/aarch64/cputarg.pas
+++ b/compiler/aarch64/cputarg.pas
@@ -35,6 +35,9 @@ implementation
              Targets
 **************************************}
 
+    {$ifndef NOTARGETBSD}
+      ,t_bsd
+    {$endif}
     {$ifndef NOTARGETLINUX}
       ,t_linux
     {$endif}
diff --git a/compiler/systems.inc b/compiler/systems.inc
index d1e26ff70b..18b0c7de1d 100644
--- a/compiler/systems.inc
+++ b/compiler/systems.inc
@@ -202,7 +202,8 @@
              system_z80_msxdos,         { 110 }
              system_aarch64_darwin,     { 111 }
              system_z80_amstradcpc,     { 112 }
-             system_m68k_sinclairql     { 113 }
+             system_m68k_sinclairql,    { 113 }
+             system_aarch64_freebsd     { 114 }
        );
 
      type
diff --git a/compiler/systems.pas b/compiler/systems.pas
index a93a2f6c64..637d0a23ee 100644
--- a/compiler/systems.pas
+++ b/compiler/systems.pas
@@ -263,7 +263,8 @@     tabiinfo = record
                        system_x86_6432_linux,system_mipseb_linux,system_mipsel_linux,system_aarch64_linux,
                        system_riscv32_linux,system_riscv64_linux,system_xtensa_linux];
        systems_dragonfly = [system_x86_64_dragonfly];
-       systems_freebsd = [system_i386_freebsd,
+       systems_freebsd = [system_aarch64_freebsd,
+                          system_i386_freebsd,
                           system_x86_64_freebsd];
        systems_netbsd  = [system_i386_netbsd,
                           system_m68k_netbsd,
@@ -438,7 +439,7 @@     tabiinfo = record
 
        { all systems where a value parameter passed by reference must be copied
          on the caller side rather than on the callee side }
-       systems_caller_copy_addr_value_para = [system_aarch64_ios,system_aarch64_darwin,system_aarch64_linux];
+       systems_caller_copy_addr_value_para = [system_aarch64_freebsd,system_aarch64_ios,system_aarch64_darwin,system_aarch64_linux];
 
        { pointer checking (requires special code in FPC_CHECKPOINTER,
          and can never work for libc-based targets or any other program
@@ -1129,6 +1130,10 @@ procedure InitSystems;
   {$ifdef cpuaarch64}
     default_target(source_info.system);
   {$else cpuaarch64}
+    {$ifdef freebsd}
+      {$define default_target_set}
+      default_target(system_aarch64_freebsd);
+    {$endif freebsd}
     {$if defined(ios)}
       {$define default_target_set}
       default_target(system_aarch64_ios);
diff --git a/compiler/systems/i_bsd.pas b/compiler/systems/i_bsd.pas
index ca0ad0e3a0..99e92809fd 100644
--- a/compiler/systems/i_bsd.pas
+++ b/compiler/systems/i_bsd.pas
@@ -33,6 +33,82 @@
        systems;
 
     const
+       system_aarch64_freebsd_info : tsysteminfo =
+          (
+            system       : system_aarch64_freebsd;
+            name         : 'FreeBSD for aarch64';
+            shortname    : 'FreeBSD';
+            flags        : [tf_needs_symbol_size,
+                            tf_needs_symbol_type,
+                            tf_files_case_sensitive,
+                            tf_requires_proper_alignment,tf_safecall_exceptions,
+                            tf_smartlink_sections,tf_pic_uses_got,
+                            tf_has_winlike_resources
+{$ifdef llvm}
+                            ,tf_use_psabieh
+{$endif llvm}
+                            ,tf_supports_hidden_symbols
+                            ];
+            cpu          : cpu_aarch64;
+            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;            //dbg_stabs;
+            script       : script_unix;
+            endian       : endian_little;
+            alignment    :
+              (
+                procalign       : 8;
+                loopalign       : 4;
+                jumpalign       : 0;
+                jumpalignskipmax    : 0;
+                coalescealign   : 0;
+                coalescealignskipmax: 0;
+                constalignmin   : 0;
+                constalignmax   : 16;
+                varalignmin     : 0;
+                varalignmax     : 16;
+                localalignmin   : 4;
+                localalignmax   : 16;
+                recordalignmin  : 0;
+                recordalignmax  : 16;
+                maxCrecordalign : 16
+              );
+            first_parm_offset : 16;
+            stacksize    : 8*1024*1024;
+            stackalign   : 16;
+            abi          : abi_default;
+            llvmdatalayout : 'e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128'
+          );
+
        system_i386_freebsd_info : tsysteminfo =
           (
             system       : system_i386_FreeBSD;
@@ -726,6 +802,11 @@
   implementation
 
 initialization
+{$ifdef cpuaarch64}
+  {$ifdef FreeBSD}
+     set_source_info(system_aarch64_freebsd_info);
+  {$endif FreeBSD}
+{$endif cpuaarch64}
 {$ifdef cpui386}
   {$ifdef FreeBSD}
      set_source_info(system_i386_FreeBSD_info);
diff --git a/compiler/systems/t_bsd.pas b/compiler/systems/t_bsd.pas
index 3fafadece6..915e57be82 100644
--- a/compiler/systems/t_bsd.pas
+++ b/compiler/systems/t_bsd.pas
@@ -693,6 +693,11 @@ function TLinkerBSD.MakeExecutable:boolean;
 
 initialization
   RegisterLinker(ld_bsd,TLinkerBSD);
+{$ifdef aarch64}
+  RegisterImport(system_aarch64_freebsd,timportlibbsd);
+  RegisterExport(system_aarch64_freebsd,texportlibbsd);
+  RegisterTarget(system_aarch64_freebsd_info);
+{$endif aarch64}
 {$ifdef x86_64}
   RegisterImport(system_x86_64_dragonfly,timportlibbsd);
   RegisterExport(system_x86_64_dragonfly,texportlibbsd);
diff --git a/compiler/utils/ppuutils/ppudump.pp b/compiler/utils/ppuutils/ppudump.pp
index 50f708105c..4cb83621f7 100644
--- a/compiler/utils/ppuutils/ppudump.pp
+++ b/compiler/utils/ppuutils/ppudump.pp
@@ -233,7 +233,8 @@
   { 110 } 'MSX-DOS-Z80',
   { 111 } 'Darwin-AArch64',
   { 112 } 'AmstradCPC-Z80',
-  { 113 } 'SinclairQL-m68k'
+  { 113 } 'SinclairQL-m68k',
+  { 114 } 'FreeBSD-AArch64'
   );
 
 const
diff --git a/rtl/bsd/aarch64/syscall.inc b/rtl/bsd/aarch64/syscall.inc
new file mode 100644
index 0000000000..b4af7e664e
--- /dev/null
+++ b/rtl/bsd/aarch64/syscall.inc
@@ -0,0 +1,140 @@
+{
+  This file is part of the Free Pascal run time library.
+
+  Perform syscall with 0..6 arguments.
+  If syscall return value is negative, negate it, set errno, and return -1.
+
+  Written by Edmund Grimley Evans in 2015 and released into the public domain.
+}
+
+function FpSysCall(sysnr:TSysParam):TSysResult;
+assembler; nostackframe; [public,alias:'FPC_DOSYS0'];
+asm
+  mov w8,w0
+  svc #0
+  bcc .Ldone
+  str x30,[sp,#-16]!
+  bl seterrno
+  ldr x30,[sp],#16
+  mov x0,#-1
+.Ldone:
+end;
+
+function FpSysCall(sysnr,param1:TSysParam):TSysResult;
+assembler; nostackframe; [public,alias:'FPC_DOSYS1'];
+asm
+  mov w8,w0
+  mov x0,x1
+  svc #0
+  bcc .Ldone
+  str x30,[sp,#-16]!
+  bl seterrno
+  ldr x30,[sp],#16
+  mov x0,#-1
+.Ldone:
+end;
+
+function FpSysCall(sysnr,param1,param2:TSysParam):TSysResult;
+assembler; nostackframe; [public,alias:'FPC_DOSYS2'];
+asm
+  mov w8,w0
+  mov x0,x1
+  mov x1,x2
+  svc #0
+  bcc .Ldone
+  str x30,[sp,#-16]!
+  bl seterrno
+  ldr x30,[sp],#16
+  mov x0,#-1
+.Ldone:
+end;
+
+function FpSysCall(sysnr,param1,param2,param3:TSysParam):TSysResult;
+assembler; nostackframe; [public,alias:'FPC_DOSYS3'];
+asm
+  mov w8,w0
+  mov x0,x1
+  mov x1,x2
+  mov x2,x3
+  svc #0
+  bcc .Ldone
+  str x30,[sp,#-16]!
+  bl seterrno
+  ldr x30,[sp],#16
+  mov x0,#-1
+.Ldone:
+end;
+
+function FpSysCall(sysnr,param1,param2,param3,param4:TSysParam):TSysResult;
+assembler; nostackframe; [public,alias:'FPC_DOSYS4'];
+asm
+  mov w8,w0
+  mov x0,x1
+  mov x1,x2
+  mov x2,x3
+  mov x3,x4
+  svc #0
+  bcc .Ldone
+  str x30,[sp,#-16]!
+  bl seterrno
+  ldr x30,[sp],#16
+  mov x0,#-1
+.Ldone:
+end;
+
+function FpSysCall(sysnr,param1,param2,param3,param4,param5:TSysParam):TSysResult;
+assembler; nostackframe; [public,alias:'FPC_DOSYS5'];
+asm
+  mov w8,w0
+  mov x0,x1
+  mov x1,x2
+  mov x2,x3
+  mov x3,x4
+  mov x4,x5
+  svc #0
+  bcc .Ldone
+  str x30,[sp,#-16]!
+  bl seterrno
+  ldr x30,[sp],#16
+  mov x0,#-1
+.Ldone:
+end;
+
+function FpSysCall(sysnr,param1,param2,param3,param4,param5,param6:TSysParam):TSysResult;
+assembler; nostackframe; [public,alias:'FPC_DOSYS6'];
+asm
+  mov w8,w0
+  mov x0,x1
+  mov x1,x2
+  mov x2,x3
+  mov x3,x4
+  mov x4,x5
+  mov x5,x6
+  svc #0
+  bcc .Ldone
+  str x30,[sp,#-16]!
+  bl seterrno
+  ldr x30,[sp],#16
+  mov x0,#-1
+.Ldone:
+end;
+
+function FpSysCall(sysnr,param1,param2,param3,param4,param5,param6,param7:TSysParam):TSysResult;
+assembler; nostackframe; [public,alias:'FPC_DOSYS7'];
+asm
+  mov w8,w0
+  mov x0,x1
+  mov x1,x2
+  mov x2,x3
+  mov x3,x4
+  mov x4,x5
+  mov x5,x6
+  mov x6,x7
+  svc #0
+  bcc .Ldone
+  str x30,[sp,#-16]!
+  bl seterrno
+  ldr x30,[sp],#16
+  mov x0,#-1
+.Ldone:
+end;
diff --git a/rtl/bsd/aarch64/syscallh.inc b/rtl/bsd/aarch64/syscallh.inc
new file mode 100644
index 0000000000..de84a02fd2
--- /dev/null
+++ b/rtl/bsd/aarch64/syscallh.inc
@@ -0,0 +1,38 @@
+{
+    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.
+
+    aarch64 syscall headers for *BSD
+
+    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.
+
+ **********************************************************************}
+
+{$ifdef FPC_USE_SYSCALL}
+
+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.
+
+  TSysParam  = int64;
+
+function do_sysCall(sysnr:TSysParam):TSysResult; external name 'FPC_DOSYS0';
+function do_sysCall(sysnr,param1:TSysParam):TSysResult; external name 'FPC_DOSYS1';
+function do_sysCall(sysnr,param1,param2:TSysParam):TSysResult;  external name 'FPC_DOSYS2';
+function do_sysCall(sysnr,param1,param2,param3:TSysParam):TSysResult; external name 'FPC_DOSYS3';
+function do_sysCall(sysnr,param1,param2,param3,param4:TSysParam):TSysResult; external name 'FPC_DOSYS4';
+function do_sysCall(sysnr,param1,param2,param3,param4,param5:TSysParam):TSysResult; external name 'FPC_DOSYS5';
+function do_sysCall(sysnr,param1,param2,param3,param4,param5,param6:TSysParam):int64; external name 'FPC_DOSYS6';
+function do_sysCall(sysnr,param1,param2,param3,param4,param5,param6,param7:TSysParam):int64; external name 'FPC_DOSYS7';
+
+{$endif}
+
diff --git a/rtl/bsd/bunxsysc.inc b/rtl/bsd/bunxsysc.inc
index 9bc9ebf36c..6b0101325c 100644
--- a/rtl/bsd/bunxsysc.inc
+++ b/rtl/bsd/bunxsysc.inc
@@ -376,7 +376,7 @@ end;
 
 function __pipe_call(sysnr:TSysParam):TSysResult; {$ifdef cpui386}oldfpccall{$endif} external name 'FPC_DOSYS0';
 
-{$if defined(freebsd) or defined (dragonfly)}
+{$if (defined(freebsd) or defined (dragonfly)) and (defined(CPUi386) or defined(CPUX86_64))}
   {$define PIPE_RESULT_IN_EAX_AND_EDX}
 {$endif}
 Function FPpipe(var fildes : tfildes):cint;
diff --git a/rtl/freebsd/aarch64/bsyscall.inc b/rtl/freebsd/aarch64/bsyscall.inc
new file mode 100644
index 0000000000..c690ebeb2c
--- /dev/null
+++ b/rtl/freebsd/aarch64/bsyscall.inc
@@ -0,0 +1 @@
+{ nothing }
diff --git a/rtl/freebsd/aarch64/cprt0.as b/rtl/freebsd/aarch64/cprt0.as
new file mode 100644
index 0000000000..da2f2914d6
--- /dev/null
+++ b/rtl/freebsd/aarch64/cprt0.as
@@ -0,0 +1,157 @@
+/*
+   Start-up code for Free Pascal Compiler when linking with C library.
+
+*/
+
+	.text
+	.align 2
+#APP
+	.ident  "FreePascal 2.6.x/2.7.x series dynlinked to libc"
+#NO_APP
+	.section        .note.ABI-tag,"a",@progbits
+	.p2align 2
+	.type	abitag, @object
+	.size	abitag, 24
+abitag:
+	.long	8
+	.long	4
+	.long	1
+	.string	"FreeBSD"
+	.long	120000
+.globl __progname
+        .section        .rodata
+
+.LC0:
+	.string ""
+	.data
+	.p2align 3
+	.type	__progname, @object
+	.size	__progname, 8
+__progname:
+	.quad	.LC0
+	.text
+	.p2align 4,,15
+
+	.globl	_start
+	.type	_start,#function
+_start:
+	/* Initialise FP to zero */
+	mov	x29,#0
+
+	/* Get argc, argv, envp */
+	ldr	x1,[x0]
+	add	x2,x0,#8
+	add	x3,x1,#1
+	add	x3,x2,x3,lsl #3
+
+	/* Save argc, argv, envp, environ, __progname and initial stack pointer */
+	adrp	x10,:got:operatingsystem_parameter_argc
+	ldr	x10,[x10,#:got_lo12:operatingsystem_parameter_argc]
+	str	x1,[x10]
+	adrp	x10,:got:operatingsystem_parameter_argv
+	ldr	x10,[x10,#:got_lo12:operatingsystem_parameter_argv]
+	str	x2,[x10]
+	adrp	x10,:got:operatingsystem_parameter_envp
+	ldr	x10,[x10,#:got_lo12:operatingsystem_parameter_envp]
+	str	x3,[x10]
+
+	/* save environ */
+	adrp	x10,environ
+	ldr	x10,[x10,:lo12:environ]
+	cbnz	x10,.LBB0_2
+	ldr	x10,=environ
+	str	x3,[x10]
+.LBB0_2:
+	/* save __progname */
+        ldr     w8,=operatingsystem_parameter_argc
+        cmp     w8,#0
+        cset    w8,le
+        tbnz    w8,#0,.LBB0_9
+// %bb.1:
+	adrp	x8,operatingsystem_parameter_argv
+        ldr     x8,[x8,:lo12:operatingsystem_parameter_argv]
+        cbz     x8,.LBB0_9
+// %bb.2:
+	ldr	x2,[x2]
+	adrp	x9,__progname
+	adrp	x10,__progname
+	add	x10,x10,:lo12:__progname
+	str	x2,[x10]
+	ldr	x8,[x9,:lo12:__progname]
+	adrp	x9,s
+	add	x9,x9,:lo12:s
+	str	x8,[x9]
+.LBB0_3:
+	adrp	x8,s
+	ldr	x8,[x8,:lo12:s]
+	ldrb	w9,[x8]
+	cbz	w9,.LBB0_8
+// %bb.4:
+	adrp	x8,s
+	ldr	x8,[x8, :lo12:s]
+	ldrb	w9,[x8]
+	cmp	w9,#47
+	b.ne	.LBB0_6
+// %bb.5:
+	adrp	x8,s
+	ldr	x8,[x8,:lo12:s]
+	add	x8,x8,#1
+	adrp	x9,__progname
+	add	x9,x9,:lo12:__progname
+	str	x8,[x9]
+.LBB0_6:
+// %bb.7:
+	adrp	x8,s
+	adrp	x9,s
+	add	x9,x9,:lo12:s
+	ldr	x8,[x8,:lo12:s]
+	add	x8,x8,#1
+	str	x8,[x9]
+	b	.LBB0_3
+.LBB0_8:
+.LBB0_9:
+	/* save stack pointer */
+	adrp	x10,:got:__stkptr
+	ldr	x10,[x10,#:got_lo12:__stkptr]
+	mov	x6,sp
+	str	x6,[x10]
+
+	bl	PASCALMAIN
+
+	/* This should never happen */
+	b	abort
+
+	.globl	_haltproc
+	.type	_haltproc,#function
+_haltproc:
+	adrp	x0,:got:operatingsystem_result
+	ldr	x0,[x0,#:got_lo12:operatingsystem_result]
+	ldr	w0,[x0]
+	mov	w8,#1 // SYS_exit
+	svc	#0
+	b	_haltproc
+
+	/* Define a symbol for the first piece of initialized data. */
+	.data
+	.align 3
+	.globl __data_start
+__data_start:
+	.long 0
+	.weak data_start
+	data_start = __data_start
+
+	.bss
+	.align 3
+
+	.comm __stkptr,8
+
+	.comm operatingsystem_parameter_envp,8
+	.comm operatingsystem_parameter_argc,8
+	.comm operatingsystem_parameter_argv,8
+	.comm environ,8,8
+
+s:
+        .xword  0
+        .size   s, 8
+
+	.section .note.GNU-stack,"",%progbits
diff --git a/rtl/freebsd/aarch64/dllprt0.as b/rtl/freebsd/aarch64/dllprt0.as
new file mode 100644
index 0000000000..ce71bdd4e3
--- /dev/null
+++ b/rtl/freebsd/aarch64/dllprt0.as
@@ -0,0 +1,138 @@
+/*
+   Start-up code for Free Pascal Compiler in a shared library,
+   not linking with C library.
+
+*/
+
+	.text
+	.align 2
+
+	.globl	_startlib
+	.type	_startlib,#function
+_startlib:
+	.globl	FPC_SHARED_LIB_START
+	.type	FPC_SHARED_LIB_START,#function
+FPC_SHARED_LIB_START:
+	stp	x29,x30,[sp,#-16]!
+
+	/* Get argc, argv, envp */
+	ldr	x1,[x0]
+	add	x2,x0,#8
+	add	x3,x1,#1
+	add	x3,x2,x3,lsl #3
+
+	/* Save argc, argv and envp */
+	adrp	x9,:got:operatingsystem_parameter_argc
+	ldr	x9,[x9,#:got_lo12:operatingsystem_parameter_argc]
+	str	x1,[x9]
+	adrp	x9,:got:operatingsystem_parameter_argv
+	ldr	x9,[x9,#:got_lo12:operatingsystem_parameter_argv]
+	str	x2,[x9]
+	adrp	x9,:got:operatingsystem_parameter_envp
+	ldr	x9,[x9,#:got_lo12:operatingsystem_parameter_envp]
+	str	x3,[x9]
+
+	/* save environ */
+	adrp	x10,environ
+	ldr	x10,[x10,:lo12:environ]
+	cbnz	x10,.LBB0_2
+	adrp	x10,environ
+	add	x10,x9,:lo12:environ
+	str	x3,[x10]
+.LBB0_2:
+	/* save __progname */
+	adrp	x8,:got:operatingsystem_parameter_argc
+	ldr	x8,[x8,#:got_lo12:operatingsystem_parameter_argc]
+        cmp     x8,#0
+        cset    x8,le
+        tbnz    x8,#0,.LBB0_9
+// %bb.1:
+	adrp	x8,operatingsystem_parameter_argv
+        ldr     x8,[x8,:got_lo12:operatingsystem_parameter_argv]
+        cbz     x8,.LBB0_9
+// %bb.2:
+	ldr	x2,[x2]
+	adrp	x9,:got:__progname
+	adrp	x10,:got:__progname
+	add	x10,x10,:lo12:__progname
+	str	x2,[x10]
+	ldr	x8,[x9,:got_lo12:__progname]
+	adrp	x9,s
+	add	x9,x9,:lo12:s
+	str	x8,[x9]
+.LBB0_3:
+	adrp	x8,s
+	ldr	x8,[x8,:lo12:s]
+	ldrb	w9,[x8]
+	cbz	w9,.LBB0_8
+// %bb.4:
+	adrp	x8,s
+	ldr	x8,[x8, :lo12:s]
+	ldrb	w9,[x8]
+	cmp	w9,#47
+	b.ne	.LBB0_6
+// %bb.5:
+	adrp	x8,s
+	ldr	x8,[x8,:lo12:s]
+	add	x8,x8,#1
+	adrp	x9,:got:__progname
+	add	x9,x9,:lo12:__progname
+	str	x8,[x9]
+.LBB0_6:
+// %bb.7:
+	adrp	x8,s
+	adrp	x9,s
+	add	x9,x9,:lo12:s
+	ldr	x8,[x8,:lo12:s]
+	add	x8,x8,#1
+	str	x8,[x9]
+	b	.LBB0_3
+.LBB0_8:
+.LBB0_9:
+	/* Save initial stackpointer */
+	adrp	x9,:got:__stkptr
+	ldr	x9,[x9,#:got_lo12:__stkptr]
+	mov	x10,sp
+	str	x10,[x9]
+
+	/* Call main */
+	bl	PASCALMAIN
+
+	/* Return */
+	ldp	x29,x30,[sp],#16
+	ret
+
+	.globl	_haltproc
+	.type	_haltproc,#function
+_haltproc:
+	adrp	x0,:got:operatingsystem_result
+	ldr	x0,[x0,#:got_lo12:operatingsystem_result]
+	ldr	w0,[x0]
+	mov	w8,#1 // SYS_exit
+	svc	#0
+	b	_haltproc
+
+	/* Define a symbol for the first piece of initialized data. */
+	.data
+	.align 3
+	.globl __data_start
+__data_start:
+	.long 0
+	.weak data_start
+	data_start = __data_start
+
+	.bss
+	.align 3
+
+	.comm __stkptr,8
+
+	.comm operatingsystem_parameter_envp,8
+	.comm operatingsystem_parameter_argc,8
+	.comm operatingsystem_parameter_argv,8
+	.comm environ,8,8
+
+s:
+        .xword  0
+        .size   s, 8
+
+	.section .note.GNU-stack,"",%progbits
diff --git a/rtl/freebsd/aarch64/gprt0.as b/rtl/freebsd/aarch64/gprt0.as
new file mode 100644
index 0000000000..006479e9e7
--- /dev/null
+++ b/rtl/freebsd/aarch64/gprt0.as
@@ -0,0 +1,166 @@
+/*
+   Start-up code for Free Pascal Compiler when linking with C library
+   with profiling support.
+*/
+
+	.text
+	.align 2
+
+	.globl _start
+	.type _start,#function
+_start:
+	/* Initialise FP to zero */
+	mov	x29,#0
+
+	/* Get argc, argv, envp */
+	ldr	x1,[x0]
+	add	x2,x0,#8
+	add	x11,x1,#1
+	add	x11,x2,x11,lsl #3
+
+	/* Save argc, argv, envp, and initial stack pointer */
+	adrp	x10,:got:operatingsystem_parameter_argc
+	ldr	x10,[x10,#:got_lo12:operatingsystem_parameter_argc]
+	str	x1,[x10]
+	adrp	x10,:got:operatingsystem_parameter_argv
+	ldr	x10,[x10,#:got_lo12:operatingsystem_parameter_argv]
+	str	x2,[x10]
+	adrp	x10,:got:operatingsystem_parameter_envp
+	ldr	x10,[x10,#:got_lo12:operatingsystem_parameter_envp]
+	str	x3,[x10]
+
+	/* save environ */
+	adrp	x10,environ
+	ldr	x10,[x10,:lo12:environ]
+	cbnz	x10,.LBB0_2
+	ldr	x10,=environ
+	str	x3,[x10]
+.LBB0_2:
+	/* save __progname */
+        ldr     w8,=operatingsystem_parameter_argc
+        cmp     w8,#0
+        cset    w8,le
+        tbnz    w8,#0,.LBB0_9
+// %bb.1:
+	adrp	x8,operatingsystem_parameter_argv
+        ldr     x8,[x8,:lo12:operatingsystem_parameter_argv]
+        cbz     x8,.LBB0_9
+// %bb.2:
+	ldr	x2,[x2]
+	adrp	x9,__progname
+	adrp	x10,__progname
+	add	x10,x10,:lo12:__progname
+	str	x2,[x10]
+	ldr	x8,[x9,:lo12:__progname]
+	adrp	x9,s
+	add	x9,x9,:lo12:s
+	str	x8,[x9]
+.LBB0_3:
+	adrp	x8,s
+	ldr	x8,[x8,:lo12:s]
+	ldrb	w9,[x8]
+	cbz	w9,.LBB0_8
+// %bb.4:
+	adrp	x8,s
+	ldr	x8,[x8, :lo12:s]
+	ldrb	w9,[x8]
+	cmp	w9,#47
+	b.ne	.LBB0_6
+// %bb.5:
+	adrp	x8,s
+	ldr	x8,[x8,:lo12:s]
+	add	x8,x8,#1
+	adrp	x9,__progname
+	add	x9,x9,:lo12:__progname
+	str	x8,[x9]
+.LBB0_6:
+// %bb.7:
+	adrp	x8,s
+	adrp	x9,s
+	add	x9,x9,:lo12:s
+	ldr	x8,[x8,:lo12:s]
+	add	x8,x8,#1
+	str	x8,[x9]
+	b	.LBB0_3
+.LBB0_8:
+.LBB0_9:
+	adrp	x10,:got:__stkptr
+	ldr	x10,[x10,#:got_lo12:__stkptr]
+	mov	x6,sp
+	str	x6,[x10]
+
+	bl	main
+
+	/* This should never happen */
+	b	abort
+
+	.globl	_init_dummy
+	.type	_init_dummy,#function
+_init_dummy:
+	ret
+
+	.globl	_fini_dummy
+	.type	_fini_dummy,#function
+_fini_dummy:
+	ret
+
+	.globl	main_stub
+	.type	main_stub,#function
+main_stub:
+	stp	x29,x30,[sp,#-16]!
+
+	/* Save initial stackpointer */
+	mov	x0,sp
+	adrp	x1,:got:__stkptr
+	ldr	x1,[x1,#:got_lo12:__stkptr]
+	str	x0,[x1]
+
+	/* Initialize gmon */
+	adrp	x0,:got:_start
+	ldr	x0,[x0,#:got_lo12:_start]
+	adrp	x1,:got:_etext
+	ldr	x1,[x1,#:got_lo12:_etext]
+	bl	__monstartup
+	adrp	x0,:got:_mcleanup
+	ldr	x0,[x0,#:got_lo12:_mcleanup]
+	bl	atexit
+
+	/* Start the program */
+	bl	 PASCALMAIN
+	b	 abort
+
+	.globl	_haltproc
+	.type	_haltproc,#function
+_haltproc:
+	/* Return to libc */
+	adrp	x1,:got:__stkptr
+	ldr	x1,[x1,#:got_lo12:__stkptr]
+	ldr	x1,[x1]
+	mov	sp,x1
+	ldp	x29,x30,[sp],#16
+	ret
+
+	/* Define a symbol for the first piece of initialized data. */
+	.data
+	.align 3
+	.globl __data_start
+__data_start:
+	.long 0
+	.weak data_start
+	data_start = __data_start
+
+	.bss
+	.align 3
+
+	.comm __stkptr,8
+
+	.comm operatingsystem_parameter_envp,8
+	.comm operatingsystem_parameter_argc,8
+	.comm operatingsystem_parameter_argv,8
+	.comm environ,8,8
+
+s:
+        .xword  0
+        .size   s, 8
+
+	.section .note.GNU-stack,"",%progbits
diff --git a/rtl/freebsd/aarch64/prt0.as b/rtl/freebsd/aarch64/prt0.as
new file mode 100644
index 0000000000..cb5a5bc075
--- /dev/null
+++ b/rtl/freebsd/aarch64/prt0.as
@@ -0,0 +1,147 @@
+/*
+   Start-up code for Free Pascal Compiler, not in a shared library,
+   not linking with C library.
+*/
+
+	.text
+	.align 2
+
+#APP
+	.ident  "FreeBSD"
+#NO_APP
+	.section        .note.ABI-tag,"a",@progbits
+	.p2align 2
+	.type	abitag, @object
+	.size	abitag, 24
+abitag:
+	.long	8
+	.long	4
+	.long	1
+	.string	"FreeBSD"
+	.long	120000
+
+	.section        .rodata
+.LC0:
+	.string ""
+.globl __progname
+	.data
+	.p2align 3
+	.type	__progname, @object
+	.size	__progname, 8
+__progname:
+	.quad	.LC0
+	.text
+	.p2align 2,,3
+
+	.globl	_start
+	.type	_start,#function
+_start:
+	/* Initialise FP to zero */
+	mov	x29,#0
+
+	/* Get argc, argv, envp */
+	ldr	x1,[x0]
+	add	x2,x0,#8
+	add	x11,x1,#1
+	add	x11,x2,x11,lsl #3
+
+	/* Save argc, argv, envp, environ, __progname and initial stack pointer */
+	ldr	x10,=operatingsystem_parameter_argc
+	str	x1,[x10]
+	ldr	x10,=operatingsystem_parameter_argv
+	str	x2,[x10]
+	ldr	x10,=operatingsystem_parameter_envp
+	str	x11,[x10]
+
+	/* save environ */
+	adrp	x10,environ
+	ldr	x10,[x10,:lo12:environ]
+	cbnz	x10,.LBB0_2
+	ldr	x10,=environ
+	str	x11,[x10]
+.LBB0_2:
+	/* save __progname */
+        ldr     w8,=operatingsystem_parameter_argc
+        cmp     w8,#0
+        cset    w8,le
+        tbnz    w8,#0,.LBB0_9
+// %bb.1:
+	adrp	x8,operatingsystem_parameter_argv
+        ldr     x8,[x8,:lo12:operatingsystem_parameter_argv]
+        cbz     x8,.LBB0_9
+// %bb.2:
+	ldr	x2,[x2]
+	adrp	x9,__progname
+	adrp	x10,__progname
+	add	x10,x10,:lo12:__progname
+	str	x2,[x10]
+	ldr	x8,[x9,:lo12:__progname]
+	adrp	x9,s
+	add	x9,x9,:lo12:s
+	str	x8,[x9]
+.LBB0_3:
+	adrp	x8,s
+	ldr	x8,[x8,:lo12:s]
+	ldrb	w9,[x8]
+	cbz	w9,.LBB0_8
+// %bb.4:
+	adrp	x8,s
+	ldr	x8,[x8, :lo12:s]
+	ldrb	w9,[x8]
+	cmp	w9,#47
+	b.ne	.LBB0_6
+// %bb.5:
+	adrp	x8,s
+	ldr	x8,[x8,:lo12:s]
+	add	x8,x8,#1
+	adrp	x9,__progname
+	add	x9,x9,:lo12:__progname
+	str	x8,[x9]
+.LBB0_6:
+// %bb.7:
+	adrp	x8,s
+	adrp	x9,s
+	add	x9,x9,:lo12:s
+	ldr	x8,[x8,:lo12:s]
+	add	x8,x8,#1
+	str	x8,[x9]
+	b	.LBB0_3
+.LBB0_8:
+.LBB0_9:
+	/* save stack pointer */
+	ldr	x10,=__stkptr
+	mov	x6,sp
+	str	x6,[x10]
+
+	/* Call main */
+	bl	PASCALMAIN
+
+	ldr	x10,=operatingsystem_result
+	ldr	w0,[x10]
+	mov	w8,#1 // SYS_exit
+	svc	#0
+
+	/* Define a symbol for the first piece of initialized data. */
+	.data
+	.align 3
+	.globl __data_start
+__data_start:
+	.long 0
+	.weak data_start
+	data_start = __data_start
+
+	.bss
+	.align 3
+
+	.comm __stkptr,8
+
+	.comm operatingsystem_parameter_envp,8
+	.comm operatingsystem_parameter_argc,8
+	.comm operatingsystem_parameter_argv,8
+	.comm environ,8,8
+
+s:
+        .xword  0
+        .size   s, 8
+
+	.section .note.GNU-stack,"",%progbits
diff --git a/rtl/freebsd/aarch64/si_c.inc b/rtl/freebsd/aarch64/si_c.inc
new file mode 100644
index 0000000000..f629e50a4a
--- /dev/null
+++ b/rtl/freebsd/aarch64/si_c.inc
@@ -0,0 +1,89 @@
+
+Type
+    TCleanup = procedure; cdecl;
+
+var 
+  environ : ppchar; cvar; public  name '__environ';
+  progname: pchar = #0#0; cvar; public name '__progname';
+  dynamic : pchar;  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:ppchar;env:ppchar):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:ppchar;cleanup:TCleanup);
+
+var argc: longint;
+    argv: ppchar;
+    env : ppchar;
+    s   : pchar;
+begin
+  argc:=plongint(ap)^; 
+  argv:=ppchar(ap[1]);
+  env:=	ppchar(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(pchar(@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.
+
diff --git a/rtl/freebsd/aarch64/sighnd.inc b/rtl/freebsd/aarch64/sighnd.inc
new file mode 100644
index 0000000000..1d58896909
--- /dev/null
+++ b/rtl/freebsd/aarch64/sighnd.inc
@@ -0,0 +1,43 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 1999-2000 by Michael Van Canneyt,
+    member of the Free Pascal development team.
+
+    Signal handler is arch dependant due to processor to language
+    exception conversion.
+
+    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.
+
+ **********************************************************************}
+
+{ procedure SignalToRunerror(Sig: longint; SigInfo: PSigInfo; UContext: PUContext); public name '_FPC_DEFAULTSIGHANDLER'; cdecl; }
+procedure SignalToRunerror(Sig: cint; info : psiginfo;  SigContext:PSigContext); public name '_FPC_DEFAULTSIGHANDLER'; cdecl;
+
+var
+  res : word;
+begin
+  res:=0;
+  case sig of
+    SIGFPE:
+        res:=207;
+    SIGILL:
+        res:=216;
+    SIGSEGV :
+        res:=216;
+    SIGBUS:
+        res:=214;
+    SIGINT:
+        res:=217;
+    SIGQUIT:
+        res:=233;
+  end;
+  reenable_signal(sig);
+  { give runtime error at the position where the signal was raised }
+  if res<>0 then
+    HandleError(res);
+end;
diff --git a/rtl/freebsd/signal.inc b/rtl/freebsd/signal.inc
index a978ea5f04..eeddb2e550 100644
--- a/rtl/freebsd/signal.inc
+++ b/rtl/freebsd/signal.inc
@@ -80,6 +80,7 @@ type sigset_t = array[0..3] of Longint;
 
     psigcontext = ^sigcontextrec;
     PSigContextRec = ^SigContextRec;
+{$if (defined(CPUi386) or defined(CPUX86_64))}
     SigContextRec = record
        sc_mask      : sigset_t;          { signal mask to restore }
        sc_onstack   : longint;              { sigstack state to restore }
@@ -120,8 +121,14 @@ type sigset_t = array[0..3] of Longint;
        fpr_ex_sw    : cardinal;
        fpr_pad      : array[0..63] of char;
        end;
+{$endif def x86}
 
 
+{$ifdef CPUAARCH64}
+        SigContextRec = record
+            _dummy : cint;
+        end;
+{$endif cpuaarch64}
 
   Sigval = Record
             Case Boolean OF
diff --git a/rtl/freebsd/ucontexth.inc b/rtl/freebsd/ucontexth.inc
index aec4d8c69d..05cb11bcb0 100644
--- a/rtl/freebsd/ucontexth.inc
+++ b/rtl/freebsd/ucontexth.inc
@@ -20,6 +20,7 @@ type
   end;
   {$packrecords C}
 
+{$if (defined(CPUi386) or defined(CPUX86_64))}
   mcontext_t = record
     {*
      * The first 20 fields must match the definition of
@@ -53,7 +54,34 @@ type
     mc_fpstate: TMCFPStateArray;
     mc_spare2: array[0..7] of cInt;
   end;
+{$endif def x86}
 
+{$ifdef CPUAARCH64}
+  gpregs = record
+    gp_x: array[0..30] of cInt; { __register_t gp_x[30]; }
+    gp_lr: cInt;
+    gp_sp: cInt;
+    gp_elr: cInt;
+    gp_spsr: cuint32;
+    gp_pad: cInt;
+  end;
+
+  fpregs = record
+    fp_q: array[0..64] of cInt; { __uint128_t fp_q[32] }
+    fp_sr: cuint32;
+    fp_cr: cuint32;
+    fp_flags: cInt;
+    fp_pad: cInt;
+  end;
+
+  mcontext_t = record
+    mc_gpregs: gpregs;
+    mc_fpregs: fpregs;
+    mc_flags: cint32;
+    mc_pad: cint32;
+    mc_spare: array[0..8] of cInt;
+  end;
+{$endif cpuaarch64}
 
   pucontext_t = ^ucontext_t;
   ucontext_t = record  // required for kse threads
diff --git a/utils/fpcm/fpcmmain.pp b/utils/fpcm/fpcmmain.pp
index ae342f002c..03f34c0eba 100644
--- a/utils/fpcm/fpcmmain.pp
+++ b/utils/fpcm/fpcmmain.pp
@@ -123,7 +123,7 @@ interface
         { go32v2 }  ( true,  false, false, false, false, false, false, false, false, false, false, false, false, false,   false, false, false, false, false, false,  false,  false, false),
         { win32 }   ( true,  false, false, false, false, false, false, false, false, false, false, false, false, false,   false, false, false, false, false, false,  false,  false, false),
         { os2 }     ( true,  false, false, false, false, false, false, false, false, false, false, false, false, false,   false, false, false, false, false, false,  false,  false, false),
-        { freebsd } ( true,  false, false, false, true,  false, false, false, false, false, false, false, false, false,   false, false, false, false, false, false,  false,  false, false),
+        { freebsd } ( true,  false, false, false, true,  false, false, false, false, false, false, false, false, false,   false, false, true,  false, false, false,  false,  false, false),
         { beos }    ( true,  false, false, false, false, false, false, false, false, false, false, false, false, false,   false, false, false, false, false, false,  false,  false, false),
         { haiku }   ( true,  false, false, false, true,  false, false, false, false, false, false, false, false, false,   false, false, false, false, false, false,  false,  false, false),
         { netbsd }  ( true,  true,  true,  true,  true,  true,  false, false, false, false, false, false, false, false,   false, false, false, false, false, false,  false,  false, false),
freepascal.patch (36,911 bytes)   

Sven Barth

2021-02-05 15:18

manager   ~0128783

Oh, nice. :D

Would you please provide the addition of the BCC instruction as a separate issue?

Jonas Maebe

2021-02-06 12:44

manager   ~0128794

I can't find any bcc instruction in the ARMv8 reference manual. Shouldn't that be b.cc?

Sven Barth

2021-02-06 16:55

manager   ~0128798

It seems that at least LLVM supports both ( https://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20140428/215072.html ) though the official one indeed should be b.cc

Jonas Maebe

2021-02-06 17:09

manager   ~0128799

Either we support all of that extension, or nothing. And if we do, they should simply be translated into the canonical b.XX opcodes, so e.g. the peephole optimizer will automatically handle them correctly.

Mikaël Urankar

2021-03-03 13:26

reporter   ~0129350

use b.cc instr.
freepascal-3.patch (35,212 bytes)   
From 7f4ce679c994069cd2d8c319c1f2213462700415 Mon Sep 17 00:00:00 2001
From: MikaelUrankar <mikael.urankar@gmail.com>
Date: Tue, 26 Jan 2021 15:05:33 +0100
Subject: [PATCH] Port to FreeBSD aarch64

---
 compiler/aarch64/agcpugas.pas      |   2 +-
 compiler/aarch64/cputarg.pas       |   3 +
 compiler/systems.inc               |   3 +-
 compiler/systems.pas               |   9 +-
 compiler/systems/i_bsd.pas         |  81 ++++++++++++++
 compiler/systems/t_bsd.pas         |   5 +
 compiler/utils/ppuutils/ppudump.pp |   3 +-
 rtl/bsd/aarch64/syscall.inc        | 140 ++++++++++++++++++++++++
 rtl/bsd/aarch64/syscallh.inc       |  38 +++++++
 rtl/bsd/bunxsysc.inc               |   2 +-
 rtl/freebsd/aarch64/bsyscall.inc   |   1 +
 rtl/freebsd/aarch64/cprt0.as       | 157 +++++++++++++++++++++++++++
 rtl/freebsd/aarch64/dllprt0.as     | 138 ++++++++++++++++++++++++
 rtl/freebsd/aarch64/gprt0.as       | 166 +++++++++++++++++++++++++++++
 rtl/freebsd/aarch64/prt0.as        | 147 +++++++++++++++++++++++++
 rtl/freebsd/aarch64/si_c.inc       |  89 ++++++++++++++++
 rtl/freebsd/aarch64/sighnd.inc     |  43 ++++++++
 rtl/freebsd/signal.inc             |   7 ++
 rtl/freebsd/ucontexth.inc          |  28 +++++
 utils/fpcm/fpcmmain.pp             |   2 +-
 25 files changed, 1063 insertions(+), 8 deletions(-)
 create mode 100644 rtl/bsd/aarch64/syscall.inc
 create mode 100644 rtl/bsd/aarch64/syscallh.inc
 create mode 100644 rtl/freebsd/aarch64/bsyscall.inc
 create mode 100644 rtl/freebsd/aarch64/cprt0.as
 create mode 100644 rtl/freebsd/aarch64/dllprt0.as
 create mode 100644 rtl/freebsd/aarch64/gprt0.as
 create mode 100644 rtl/freebsd/aarch64/prt0.as
 create mode 100644 rtl/freebsd/aarch64/si_c.inc
 create mode 100644 rtl/freebsd/aarch64/sighnd.inc

diff --git a/compiler/aarch64/agcpugas.pas b/compiler/aarch64/agcpugas.pas
index d6fd59ac76..00fd6aaf20 100644
--- a/compiler/aarch64/agcpugas.pas
+++ b/compiler/aarch64/agcpugas.pas
@@ -767,7 +767,7 @@       TAArch64ClangGASAssembler=class(TAArch64Assembler)
             idtxt  : 'AS';
             asmbin : 'as';
             asmcmd : '-o $OBJ $EXTRAOPT $ASM';
-            supported_targets : [system_aarch64_linux,system_aarch64_android];
+            supported_targets : [system_aarch64_freebsd,system_aarch64_linux,system_aarch64_android];
             flags : [af_needar,af_smartlink_sections];
             labelprefix : '.L';
             labelmaxlen : -1;
diff --git a/compiler/aarch64/cputarg.pas b/compiler/aarch64/cputarg.pas
index 06bd7547df..05af1c3e75 100644
--- a/compiler/aarch64/cputarg.pas
+++ b/compiler/aarch64/cputarg.pas
@@ -35,6 +35,9 @@ implementation
              Targets
 **************************************}
 
+    {$ifndef NOTARGETBSD}
+      ,t_bsd
+    {$endif}
     {$ifndef NOTARGETLINUX}
       ,t_linux
     {$endif}
diff --git a/compiler/systems.inc b/compiler/systems.inc
index d1e26ff70b..18b0c7de1d 100644
--- a/compiler/systems.inc
+++ b/compiler/systems.inc
@@ -202,7 +202,8 @@
              system_z80_msxdos,         { 110 }
              system_aarch64_darwin,     { 111 }
              system_z80_amstradcpc,     { 112 }
-             system_m68k_sinclairql     { 113 }
+             system_m68k_sinclairql,    { 113 }
+             system_aarch64_freebsd     { 114 }
        );
 
      type
diff --git a/compiler/systems.pas b/compiler/systems.pas
index a93a2f6c64..637d0a23ee 100644
--- a/compiler/systems.pas
+++ b/compiler/systems.pas
@@ -263,7 +263,8 @@     tabiinfo = record
                        system_x86_6432_linux,system_mipseb_linux,system_mipsel_linux,system_aarch64_linux,
                        system_riscv32_linux,system_riscv64_linux,system_xtensa_linux];
        systems_dragonfly = [system_x86_64_dragonfly];
-       systems_freebsd = [system_i386_freebsd,
+       systems_freebsd = [system_aarch64_freebsd,
+                          system_i386_freebsd,
                           system_x86_64_freebsd];
        systems_netbsd  = [system_i386_netbsd,
                           system_m68k_netbsd,
@@ -438,7 +439,7 @@     tabiinfo = record
 
        { all systems where a value parameter passed by reference must be copied
          on the caller side rather than on the callee side }
-       systems_caller_copy_addr_value_para = [system_aarch64_ios,system_aarch64_darwin,system_aarch64_linux];
+       systems_caller_copy_addr_value_para = [system_aarch64_freebsd,system_aarch64_ios,system_aarch64_darwin,system_aarch64_linux];
 
        { pointer checking (requires special code in FPC_CHECKPOINTER,
          and can never work for libc-based targets or any other program
@@ -1129,6 +1130,10 @@ procedure InitSystems;
   {$ifdef cpuaarch64}
     default_target(source_info.system);
   {$else cpuaarch64}
+    {$ifdef freebsd}
+      {$define default_target_set}
+      default_target(system_aarch64_freebsd);
+    {$endif freebsd}
     {$if defined(ios)}
       {$define default_target_set}
       default_target(system_aarch64_ios);
diff --git a/compiler/systems/i_bsd.pas b/compiler/systems/i_bsd.pas
index ca0ad0e3a0..99e92809fd 100644
--- a/compiler/systems/i_bsd.pas
+++ b/compiler/systems/i_bsd.pas
@@ -33,6 +33,82 @@
        systems;
 
     const
+       system_aarch64_freebsd_info : tsysteminfo =
+          (
+            system       : system_aarch64_freebsd;
+            name         : 'FreeBSD for aarch64';
+            shortname    : 'FreeBSD';
+            flags        : [tf_needs_symbol_size,
+                            tf_needs_symbol_type,
+                            tf_files_case_sensitive,
+                            tf_requires_proper_alignment,tf_safecall_exceptions,
+                            tf_smartlink_sections,tf_pic_uses_got,
+                            tf_has_winlike_resources
+{$ifdef llvm}
+                            ,tf_use_psabieh
+{$endif llvm}
+                            ,tf_supports_hidden_symbols
+                            ];
+            cpu          : cpu_aarch64;
+            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;            //dbg_stabs;
+            script       : script_unix;
+            endian       : endian_little;
+            alignment    :
+              (
+                procalign       : 8;
+                loopalign       : 4;
+                jumpalign       : 0;
+                jumpalignskipmax    : 0;
+                coalescealign   : 0;
+                coalescealignskipmax: 0;
+                constalignmin   : 0;
+                constalignmax   : 16;
+                varalignmin     : 0;
+                varalignmax     : 16;
+                localalignmin   : 4;
+                localalignmax   : 16;
+                recordalignmin  : 0;
+                recordalignmax  : 16;
+                maxCrecordalign : 16
+              );
+            first_parm_offset : 16;
+            stacksize    : 8*1024*1024;
+            stackalign   : 16;
+            abi          : abi_default;
+            llvmdatalayout : 'e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128'
+          );
+
        system_i386_freebsd_info : tsysteminfo =
           (
             system       : system_i386_FreeBSD;
@@ -726,6 +802,11 @@
   implementation
 
 initialization
+{$ifdef cpuaarch64}
+  {$ifdef FreeBSD}
+     set_source_info(system_aarch64_freebsd_info);
+  {$endif FreeBSD}
+{$endif cpuaarch64}
 {$ifdef cpui386}
   {$ifdef FreeBSD}
      set_source_info(system_i386_FreeBSD_info);
diff --git a/compiler/systems/t_bsd.pas b/compiler/systems/t_bsd.pas
index 3fafadece6..915e57be82 100644
--- a/compiler/systems/t_bsd.pas
+++ b/compiler/systems/t_bsd.pas
@@ -693,6 +693,11 @@ function TLinkerBSD.MakeExecutable:boolean;
 
 initialization
   RegisterLinker(ld_bsd,TLinkerBSD);
+{$ifdef aarch64}
+  RegisterImport(system_aarch64_freebsd,timportlibbsd);
+  RegisterExport(system_aarch64_freebsd,texportlibbsd);
+  RegisterTarget(system_aarch64_freebsd_info);
+{$endif aarch64}
 {$ifdef x86_64}
   RegisterImport(system_x86_64_dragonfly,timportlibbsd);
   RegisterExport(system_x86_64_dragonfly,texportlibbsd);
diff --git a/compiler/utils/ppuutils/ppudump.pp b/compiler/utils/ppuutils/ppudump.pp
index 50f708105c..4cb83621f7 100644
--- a/compiler/utils/ppuutils/ppudump.pp
+++ b/compiler/utils/ppuutils/ppudump.pp
@@ -233,7 +233,8 @@
   { 110 } 'MSX-DOS-Z80',
   { 111 } 'Darwin-AArch64',
   { 112 } 'AmstradCPC-Z80',
-  { 113 } 'SinclairQL-m68k'
+  { 113 } 'SinclairQL-m68k',
+  { 114 } 'FreeBSD-AArch64'
   );
 
 const
diff --git a/rtl/bsd/aarch64/syscall.inc b/rtl/bsd/aarch64/syscall.inc
new file mode 100644
index 0000000000..b4af7e664e
--- /dev/null
+++ b/rtl/bsd/aarch64/syscall.inc
@@ -0,0 +1,140 @@
+{
+  This file is part of the Free Pascal run time library.
+
+  Perform syscall with 0..6 arguments.
+  If syscall return value is negative, negate it, set errno, and return -1.
+
+  Written by Edmund Grimley Evans in 2015 and released into the public domain.
+}
+
+function FpSysCall(sysnr:TSysParam):TSysResult;
+assembler; nostackframe; [public,alias:'FPC_DOSYS0'];
+asm
+  mov w8,w0
+  svc #0
+  b.cc .Ldone
+  str x30,[sp,#-16]!
+  bl seterrno
+  ldr x30,[sp],#16
+  mov x0,#-1
+.Ldone:
+end;
+
+function FpSysCall(sysnr,param1:TSysParam):TSysResult;
+assembler; nostackframe; [public,alias:'FPC_DOSYS1'];
+asm
+  mov w8,w0
+  mov x0,x1
+  svc #0
+  b.cc .Ldone
+  str x30,[sp,#-16]!
+  bl seterrno
+  ldr x30,[sp],#16
+  mov x0,#-1
+.Ldone:
+end;
+
+function FpSysCall(sysnr,param1,param2:TSysParam):TSysResult;
+assembler; nostackframe; [public,alias:'FPC_DOSYS2'];
+asm
+  mov w8,w0
+  mov x0,x1
+  mov x1,x2
+  svc #0
+  b.cc .Ldone
+  str x30,[sp,#-16]!
+  bl seterrno
+  ldr x30,[sp],#16
+  mov x0,#-1
+.Ldone:
+end;
+
+function FpSysCall(sysnr,param1,param2,param3:TSysParam):TSysResult;
+assembler; nostackframe; [public,alias:'FPC_DOSYS3'];
+asm
+  mov w8,w0
+  mov x0,x1
+  mov x1,x2
+  mov x2,x3
+  svc #0
+  b.cc .Ldone
+  str x30,[sp,#-16]!
+  bl seterrno
+  ldr x30,[sp],#16
+  mov x0,#-1
+.Ldone:
+end;
+
+function FpSysCall(sysnr,param1,param2,param3,param4:TSysParam):TSysResult;
+assembler; nostackframe; [public,alias:'FPC_DOSYS4'];
+asm
+  mov w8,w0
+  mov x0,x1
+  mov x1,x2
+  mov x2,x3
+  mov x3,x4
+  svc #0
+  b.cc .Ldone
+  str x30,[sp,#-16]!
+  bl seterrno
+  ldr x30,[sp],#16
+  mov x0,#-1
+.Ldone:
+end;
+
+function FpSysCall(sysnr,param1,param2,param3,param4,param5:TSysParam):TSysResult;
+assembler; nostackframe; [public,alias:'FPC_DOSYS5'];
+asm
+  mov w8,w0
+  mov x0,x1
+  mov x1,x2
+  mov x2,x3
+  mov x3,x4
+  mov x4,x5
+  svc #0
+  b.cc .Ldone
+  str x30,[sp,#-16]!
+  bl seterrno
+  ldr x30,[sp],#16
+  mov x0,#-1
+.Ldone:
+end;
+
+function FpSysCall(sysnr,param1,param2,param3,param4,param5,param6:TSysParam):TSysResult;
+assembler; nostackframe; [public,alias:'FPC_DOSYS6'];
+asm
+  mov w8,w0
+  mov x0,x1
+  mov x1,x2
+  mov x2,x3
+  mov x3,x4
+  mov x4,x5
+  mov x5,x6
+  svc #0
+  b.cc .Ldone
+  str x30,[sp,#-16]!
+  bl seterrno
+  ldr x30,[sp],#16
+  mov x0,#-1
+.Ldone:
+end;
+
+function FpSysCall(sysnr,param1,param2,param3,param4,param5,param6,param7:TSysParam):TSysResult;
+assembler; nostackframe; [public,alias:'FPC_DOSYS7'];
+asm
+  mov w8,w0
+  mov x0,x1
+  mov x1,x2
+  mov x2,x3
+  mov x3,x4
+  mov x4,x5
+  mov x5,x6
+  mov x6,x7
+  svc #0
+  b.cc .Ldone
+  str x30,[sp,#-16]!
+  bl seterrno
+  ldr x30,[sp],#16
+  mov x0,#-1
+.Ldone:
+end;
diff --git a/rtl/bsd/aarch64/syscallh.inc b/rtl/bsd/aarch64/syscallh.inc
new file mode 100644
index 0000000000..de84a02fd2
--- /dev/null
+++ b/rtl/bsd/aarch64/syscallh.inc
@@ -0,0 +1,38 @@
+{
+    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.
+
+    aarch64 syscall headers for *BSD
+
+    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.
+
+ **********************************************************************}
+
+{$ifdef FPC_USE_SYSCALL}
+
+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.
+
+  TSysParam  = int64;
+
+function do_sysCall(sysnr:TSysParam):TSysResult; external name 'FPC_DOSYS0';
+function do_sysCall(sysnr,param1:TSysParam):TSysResult; external name 'FPC_DOSYS1';
+function do_sysCall(sysnr,param1,param2:TSysParam):TSysResult;  external name 'FPC_DOSYS2';
+function do_sysCall(sysnr,param1,param2,param3:TSysParam):TSysResult; external name 'FPC_DOSYS3';
+function do_sysCall(sysnr,param1,param2,param3,param4:TSysParam):TSysResult; external name 'FPC_DOSYS4';
+function do_sysCall(sysnr,param1,param2,param3,param4,param5:TSysParam):TSysResult; external name 'FPC_DOSYS5';
+function do_sysCall(sysnr,param1,param2,param3,param4,param5,param6:TSysParam):int64; external name 'FPC_DOSYS6';
+function do_sysCall(sysnr,param1,param2,param3,param4,param5,param6,param7:TSysParam):int64; external name 'FPC_DOSYS7';
+
+{$endif}
+
diff --git a/rtl/bsd/bunxsysc.inc b/rtl/bsd/bunxsysc.inc
index 9bc9ebf36c..6b0101325c 100644
--- a/rtl/bsd/bunxsysc.inc
+++ b/rtl/bsd/bunxsysc.inc
@@ -376,7 +376,7 @@ end;
 
 function __pipe_call(sysnr:TSysParam):TSysResult; {$ifdef cpui386}oldfpccall{$endif} external name 'FPC_DOSYS0';
 
-{$if defined(freebsd) or defined (dragonfly)}
+{$if (defined(freebsd) or defined (dragonfly)) and (defined(CPUi386) or defined(CPUX86_64))}
   {$define PIPE_RESULT_IN_EAX_AND_EDX}
 {$endif}
 Function FPpipe(var fildes : tfildes):cint;
diff --git a/rtl/freebsd/aarch64/bsyscall.inc b/rtl/freebsd/aarch64/bsyscall.inc
new file mode 100644
index 0000000000..c690ebeb2c
--- /dev/null
+++ b/rtl/freebsd/aarch64/bsyscall.inc
@@ -0,0 +1 @@
+{ nothing }
diff --git a/rtl/freebsd/aarch64/cprt0.as b/rtl/freebsd/aarch64/cprt0.as
new file mode 100644
index 0000000000..da2f2914d6
--- /dev/null
+++ b/rtl/freebsd/aarch64/cprt0.as
@@ -0,0 +1,157 @@
+/*
+   Start-up code for Free Pascal Compiler when linking with C library.
+
+*/
+
+	.text
+	.align 2
+#APP
+	.ident  "FreePascal 2.6.x/2.7.x series dynlinked to libc"
+#NO_APP
+	.section        .note.ABI-tag,"a",@progbits
+	.p2align 2
+	.type	abitag, @object
+	.size	abitag, 24
+abitag:
+	.long	8
+	.long	4
+	.long	1
+	.string	"FreeBSD"
+	.long	120000
+.globl __progname
+        .section        .rodata
+
+.LC0:
+	.string ""
+	.data
+	.p2align 3
+	.type	__progname, @object
+	.size	__progname, 8
+__progname:
+	.quad	.LC0
+	.text
+	.p2align 4,,15
+
+	.globl	_start
+	.type	_start,#function
+_start:
+	/* Initialise FP to zero */
+	mov	x29,#0
+
+	/* Get argc, argv, envp */
+	ldr	x1,[x0]
+	add	x2,x0,#8
+	add	x3,x1,#1
+	add	x3,x2,x3,lsl #3
+
+	/* Save argc, argv, envp, environ, __progname and initial stack pointer */
+	adrp	x10,:got:operatingsystem_parameter_argc
+	ldr	x10,[x10,#:got_lo12:operatingsystem_parameter_argc]
+	str	x1,[x10]
+	adrp	x10,:got:operatingsystem_parameter_argv
+	ldr	x10,[x10,#:got_lo12:operatingsystem_parameter_argv]
+	str	x2,[x10]
+	adrp	x10,:got:operatingsystem_parameter_envp
+	ldr	x10,[x10,#:got_lo12:operatingsystem_parameter_envp]
+	str	x3,[x10]
+
+	/* save environ */
+	adrp	x10,environ
+	ldr	x10,[x10,:lo12:environ]
+	cbnz	x10,.LBB0_2
+	ldr	x10,=environ
+	str	x3,[x10]
+.LBB0_2:
+	/* save __progname */
+        ldr     w8,=operatingsystem_parameter_argc
+        cmp     w8,#0
+        cset    w8,le
+        tbnz    w8,#0,.LBB0_9
+// %bb.1:
+	adrp	x8,operatingsystem_parameter_argv
+        ldr     x8,[x8,:lo12:operatingsystem_parameter_argv]
+        cbz     x8,.LBB0_9
+// %bb.2:
+	ldr	x2,[x2]
+	adrp	x9,__progname
+	adrp	x10,__progname
+	add	x10,x10,:lo12:__progname
+	str	x2,[x10]
+	ldr	x8,[x9,:lo12:__progname]
+	adrp	x9,s
+	add	x9,x9,:lo12:s
+	str	x8,[x9]
+.LBB0_3:
+	adrp	x8,s
+	ldr	x8,[x8,:lo12:s]
+	ldrb	w9,[x8]
+	cbz	w9,.LBB0_8
+// %bb.4:
+	adrp	x8,s
+	ldr	x8,[x8, :lo12:s]
+	ldrb	w9,[x8]
+	cmp	w9,#47
+	b.ne	.LBB0_6
+// %bb.5:
+	adrp	x8,s
+	ldr	x8,[x8,:lo12:s]
+	add	x8,x8,#1
+	adrp	x9,__progname
+	add	x9,x9,:lo12:__progname
+	str	x8,[x9]
+.LBB0_6:
+// %bb.7:
+	adrp	x8,s
+	adrp	x9,s
+	add	x9,x9,:lo12:s
+	ldr	x8,[x8,:lo12:s]
+	add	x8,x8,#1
+	str	x8,[x9]
+	b	.LBB0_3
+.LBB0_8:
+.LBB0_9:
+	/* save stack pointer */
+	adrp	x10,:got:__stkptr
+	ldr	x10,[x10,#:got_lo12:__stkptr]
+	mov	x6,sp
+	str	x6,[x10]
+
+	bl	PASCALMAIN
+
+	/* This should never happen */
+	b	abort
+
+	.globl	_haltproc
+	.type	_haltproc,#function
+_haltproc:
+	adrp	x0,:got:operatingsystem_result
+	ldr	x0,[x0,#:got_lo12:operatingsystem_result]
+	ldr	w0,[x0]
+	mov	w8,#1 // SYS_exit
+	svc	#0
+	b	_haltproc
+
+	/* Define a symbol for the first piece of initialized data. */
+	.data
+	.align 3
+	.globl __data_start
+__data_start:
+	.long 0
+	.weak data_start
+	data_start = __data_start
+
+	.bss
+	.align 3
+
+	.comm __stkptr,8
+
+	.comm operatingsystem_parameter_envp,8
+	.comm operatingsystem_parameter_argc,8
+	.comm operatingsystem_parameter_argv,8
+	.comm environ,8,8
+
+s:
+        .xword  0
+        .size   s, 8
+
+	.section .note.GNU-stack,"",%progbits
diff --git a/rtl/freebsd/aarch64/dllprt0.as b/rtl/freebsd/aarch64/dllprt0.as
new file mode 100644
index 0000000000..ce71bdd4e3
--- /dev/null
+++ b/rtl/freebsd/aarch64/dllprt0.as
@@ -0,0 +1,138 @@
+/*
+   Start-up code for Free Pascal Compiler in a shared library,
+   not linking with C library.
+
+*/
+
+	.text
+	.align 2
+
+	.globl	_startlib
+	.type	_startlib,#function
+_startlib:
+	.globl	FPC_SHARED_LIB_START
+	.type	FPC_SHARED_LIB_START,#function
+FPC_SHARED_LIB_START:
+	stp	x29,x30,[sp,#-16]!
+
+	/* Get argc, argv, envp */
+	ldr	x1,[x0]
+	add	x2,x0,#8
+	add	x3,x1,#1
+	add	x3,x2,x3,lsl #3
+
+	/* Save argc, argv and envp */
+	adrp	x9,:got:operatingsystem_parameter_argc
+	ldr	x9,[x9,#:got_lo12:operatingsystem_parameter_argc]
+	str	x1,[x9]
+	adrp	x9,:got:operatingsystem_parameter_argv
+	ldr	x9,[x9,#:got_lo12:operatingsystem_parameter_argv]
+	str	x2,[x9]
+	adrp	x9,:got:operatingsystem_parameter_envp
+	ldr	x9,[x9,#:got_lo12:operatingsystem_parameter_envp]
+	str	x3,[x9]
+
+	/* save environ */
+	adrp	x10,environ
+	ldr	x10,[x10,:lo12:environ]
+	cbnz	x10,.LBB0_2
+	adrp	x10,environ
+	add	x10,x9,:lo12:environ
+	str	x3,[x10]
+.LBB0_2:
+	/* save __progname */
+	adrp	x8,:got:operatingsystem_parameter_argc
+	ldr	x8,[x8,#:got_lo12:operatingsystem_parameter_argc]
+        cmp     x8,#0
+        cset    x8,le
+        tbnz    x8,#0,.LBB0_9
+// %bb.1:
+	adrp	x8,operatingsystem_parameter_argv
+        ldr     x8,[x8,:got_lo12:operatingsystem_parameter_argv]
+        cbz     x8,.LBB0_9
+// %bb.2:
+	ldr	x2,[x2]
+	adrp	x9,:got:__progname
+	adrp	x10,:got:__progname
+	add	x10,x10,:lo12:__progname
+	str	x2,[x10]
+	ldr	x8,[x9,:got_lo12:__progname]
+	adrp	x9,s
+	add	x9,x9,:lo12:s
+	str	x8,[x9]
+.LBB0_3:
+	adrp	x8,s
+	ldr	x8,[x8,:lo12:s]
+	ldrb	w9,[x8]
+	cbz	w9,.LBB0_8
+// %bb.4:
+	adrp	x8,s
+	ldr	x8,[x8, :lo12:s]
+	ldrb	w9,[x8]
+	cmp	w9,#47
+	b.ne	.LBB0_6
+// %bb.5:
+	adrp	x8,s
+	ldr	x8,[x8,:lo12:s]
+	add	x8,x8,#1
+	adrp	x9,:got:__progname
+	add	x9,x9,:lo12:__progname
+	str	x8,[x9]
+.LBB0_6:
+// %bb.7:
+	adrp	x8,s
+	adrp	x9,s
+	add	x9,x9,:lo12:s
+	ldr	x8,[x8,:lo12:s]
+	add	x8,x8,#1
+	str	x8,[x9]
+	b	.LBB0_3
+.LBB0_8:
+.LBB0_9:
+	/* Save initial stackpointer */
+	adrp	x9,:got:__stkptr
+	ldr	x9,[x9,#:got_lo12:__stkptr]
+	mov	x10,sp
+	str	x10,[x9]
+
+	/* Call main */
+	bl	PASCALMAIN
+
+	/* Return */
+	ldp	x29,x30,[sp],#16
+	ret
+
+	.globl	_haltproc
+	.type	_haltproc,#function
+_haltproc:
+	adrp	x0,:got:operatingsystem_result
+	ldr	x0,[x0,#:got_lo12:operatingsystem_result]
+	ldr	w0,[x0]
+	mov	w8,#1 // SYS_exit
+	svc	#0
+	b	_haltproc
+
+	/* Define a symbol for the first piece of initialized data. */
+	.data
+	.align 3
+	.globl __data_start
+__data_start:
+	.long 0
+	.weak data_start
+	data_start = __data_start
+
+	.bss
+	.align 3
+
+	.comm __stkptr,8
+
+	.comm operatingsystem_parameter_envp,8
+	.comm operatingsystem_parameter_argc,8
+	.comm operatingsystem_parameter_argv,8
+	.comm environ,8,8
+
+s:
+        .xword  0
+        .size   s, 8
+
+	.section .note.GNU-stack,"",%progbits
diff --git a/rtl/freebsd/aarch64/gprt0.as b/rtl/freebsd/aarch64/gprt0.as
new file mode 100644
index 0000000000..006479e9e7
--- /dev/null
+++ b/rtl/freebsd/aarch64/gprt0.as
@@ -0,0 +1,166 @@
+/*
+   Start-up code for Free Pascal Compiler when linking with C library
+   with profiling support.
+*/
+
+	.text
+	.align 2
+
+	.globl _start
+	.type _start,#function
+_start:
+	/* Initialise FP to zero */
+	mov	x29,#0
+
+	/* Get argc, argv, envp */
+	ldr	x1,[x0]
+	add	x2,x0,#8
+	add	x11,x1,#1
+	add	x11,x2,x11,lsl #3
+
+	/* Save argc, argv, envp, and initial stack pointer */
+	adrp	x10,:got:operatingsystem_parameter_argc
+	ldr	x10,[x10,#:got_lo12:operatingsystem_parameter_argc]
+	str	x1,[x10]
+	adrp	x10,:got:operatingsystem_parameter_argv
+	ldr	x10,[x10,#:got_lo12:operatingsystem_parameter_argv]
+	str	x2,[x10]
+	adrp	x10,:got:operatingsystem_parameter_envp
+	ldr	x10,[x10,#:got_lo12:operatingsystem_parameter_envp]
+	str	x3,[x10]
+
+	/* save environ */
+	adrp	x10,environ
+	ldr	x10,[x10,:lo12:environ]
+	cbnz	x10,.LBB0_2
+	ldr	x10,=environ
+	str	x3,[x10]
+.LBB0_2:
+	/* save __progname */
+        ldr     w8,=operatingsystem_parameter_argc
+        cmp     w8,#0
+        cset    w8,le
+        tbnz    w8,#0,.LBB0_9
+// %bb.1:
+	adrp	x8,operatingsystem_parameter_argv
+        ldr     x8,[x8,:lo12:operatingsystem_parameter_argv]
+        cbz     x8,.LBB0_9
+// %bb.2:
+	ldr	x2,[x2]
+	adrp	x9,__progname
+	adrp	x10,__progname
+	add	x10,x10,:lo12:__progname
+	str	x2,[x10]
+	ldr	x8,[x9,:lo12:__progname]
+	adrp	x9,s
+	add	x9,x9,:lo12:s
+	str	x8,[x9]
+.LBB0_3:
+	adrp	x8,s
+	ldr	x8,[x8,:lo12:s]
+	ldrb	w9,[x8]
+	cbz	w9,.LBB0_8
+// %bb.4:
+	adrp	x8,s
+	ldr	x8,[x8, :lo12:s]
+	ldrb	w9,[x8]
+	cmp	w9,#47
+	b.ne	.LBB0_6
+// %bb.5:
+	adrp	x8,s
+	ldr	x8,[x8,:lo12:s]
+	add	x8,x8,#1
+	adrp	x9,__progname
+	add	x9,x9,:lo12:__progname
+	str	x8,[x9]
+.LBB0_6:
+// %bb.7:
+	adrp	x8,s
+	adrp	x9,s
+	add	x9,x9,:lo12:s
+	ldr	x8,[x8,:lo12:s]
+	add	x8,x8,#1
+	str	x8,[x9]
+	b	.LBB0_3
+.LBB0_8:
+.LBB0_9:
+	adrp	x10,:got:__stkptr
+	ldr	x10,[x10,#:got_lo12:__stkptr]
+	mov	x6,sp
+	str	x6,[x10]
+
+	bl	main
+
+	/* This should never happen */
+	b	abort
+
+	.globl	_init_dummy
+	.type	_init_dummy,#function
+_init_dummy:
+	ret
+
+	.globl	_fini_dummy
+	.type	_fini_dummy,#function
+_fini_dummy:
+	ret
+
+	.globl	main_stub
+	.type	main_stub,#function
+main_stub:
+	stp	x29,x30,[sp,#-16]!
+
+	/* Save initial stackpointer */
+	mov	x0,sp
+	adrp	x1,:got:__stkptr
+	ldr	x1,[x1,#:got_lo12:__stkptr]
+	str	x0,[x1]
+
+	/* Initialize gmon */
+	adrp	x0,:got:_start
+	ldr	x0,[x0,#:got_lo12:_start]
+	adrp	x1,:got:_etext
+	ldr	x1,[x1,#:got_lo12:_etext]
+	bl	__monstartup
+	adrp	x0,:got:_mcleanup
+	ldr	x0,[x0,#:got_lo12:_mcleanup]
+	bl	atexit
+
+	/* Start the program */
+	bl	 PASCALMAIN
+	b	 abort
+
+	.globl	_haltproc
+	.type	_haltproc,#function
+_haltproc:
+	/* Return to libc */
+	adrp	x1,:got:__stkptr
+	ldr	x1,[x1,#:got_lo12:__stkptr]
+	ldr	x1,[x1]
+	mov	sp,x1
+	ldp	x29,x30,[sp],#16
+	ret
+
+	/* Define a symbol for the first piece of initialized data. */
+	.data
+	.align 3
+	.globl __data_start
+__data_start:
+	.long 0
+	.weak data_start
+	data_start = __data_start
+
+	.bss
+	.align 3
+
+	.comm __stkptr,8
+
+	.comm operatingsystem_parameter_envp,8
+	.comm operatingsystem_parameter_argc,8
+	.comm operatingsystem_parameter_argv,8
+	.comm environ,8,8
+
+s:
+        .xword  0
+        .size   s, 8
+
+	.section .note.GNU-stack,"",%progbits
diff --git a/rtl/freebsd/aarch64/prt0.as b/rtl/freebsd/aarch64/prt0.as
new file mode 100644
index 0000000000..cb5a5bc075
--- /dev/null
+++ b/rtl/freebsd/aarch64/prt0.as
@@ -0,0 +1,147 @@
+/*
+   Start-up code for Free Pascal Compiler, not in a shared library,
+   not linking with C library.
+*/
+
+	.text
+	.align 2
+
+#APP
+	.ident  "FreeBSD"
+#NO_APP
+	.section        .note.ABI-tag,"a",@progbits
+	.p2align 2
+	.type	abitag, @object
+	.size	abitag, 24
+abitag:
+	.long	8
+	.long	4
+	.long	1
+	.string	"FreeBSD"
+	.long	120000
+
+	.section        .rodata
+.LC0:
+	.string ""
+.globl __progname
+	.data
+	.p2align 3
+	.type	__progname, @object
+	.size	__progname, 8
+__progname:
+	.quad	.LC0
+	.text
+	.p2align 2,,3
+
+	.globl	_start
+	.type	_start,#function
+_start:
+	/* Initialise FP to zero */
+	mov	x29,#0
+
+	/* Get argc, argv, envp */
+	ldr	x1,[x0]
+	add	x2,x0,#8
+	add	x11,x1,#1
+	add	x11,x2,x11,lsl #3
+
+	/* Save argc, argv, envp, environ, __progname and initial stack pointer */
+	ldr	x10,=operatingsystem_parameter_argc
+	str	x1,[x10]
+	ldr	x10,=operatingsystem_parameter_argv
+	str	x2,[x10]
+	ldr	x10,=operatingsystem_parameter_envp
+	str	x11,[x10]
+
+	/* save environ */
+	adrp	x10,environ
+	ldr	x10,[x10,:lo12:environ]
+	cbnz	x10,.LBB0_2
+	ldr	x10,=environ
+	str	x11,[x10]
+.LBB0_2:
+	/* save __progname */
+        ldr     w8,=operatingsystem_parameter_argc
+        cmp     w8,#0
+        cset    w8,le
+        tbnz    w8,#0,.LBB0_9
+// %bb.1:
+	adrp	x8,operatingsystem_parameter_argv
+        ldr     x8,[x8,:lo12:operatingsystem_parameter_argv]
+        cbz     x8,.LBB0_9
+// %bb.2:
+	ldr	x2,[x2]
+	adrp	x9,__progname
+	adrp	x10,__progname
+	add	x10,x10,:lo12:__progname
+	str	x2,[x10]
+	ldr	x8,[x9,:lo12:__progname]
+	adrp	x9,s
+	add	x9,x9,:lo12:s
+	str	x8,[x9]
+.LBB0_3:
+	adrp	x8,s
+	ldr	x8,[x8,:lo12:s]
+	ldrb	w9,[x8]
+	cbz	w9,.LBB0_8
+// %bb.4:
+	adrp	x8,s
+	ldr	x8,[x8, :lo12:s]
+	ldrb	w9,[x8]
+	cmp	w9,#47
+	b.ne	.LBB0_6
+// %bb.5:
+	adrp	x8,s
+	ldr	x8,[x8,:lo12:s]
+	add	x8,x8,#1
+	adrp	x9,__progname
+	add	x9,x9,:lo12:__progname
+	str	x8,[x9]
+.LBB0_6:
+// %bb.7:
+	adrp	x8,s
+	adrp	x9,s
+	add	x9,x9,:lo12:s
+	ldr	x8,[x8,:lo12:s]
+	add	x8,x8,#1
+	str	x8,[x9]
+	b	.LBB0_3
+.LBB0_8:
+.LBB0_9:
+	/* save stack pointer */
+	ldr	x10,=__stkptr
+	mov	x6,sp
+	str	x6,[x10]
+
+	/* Call main */
+	bl	PASCALMAIN
+
+	ldr	x10,=operatingsystem_result
+	ldr	w0,[x10]
+	mov	w8,#1 // SYS_exit
+	svc	#0
+
+	/* Define a symbol for the first piece of initialized data. */
+	.data
+	.align 3
+	.globl __data_start
+__data_start:
+	.long 0
+	.weak data_start
+	data_start = __data_start
+
+	.bss
+	.align 3
+
+	.comm __stkptr,8
+
+	.comm operatingsystem_parameter_envp,8
+	.comm operatingsystem_parameter_argc,8
+	.comm operatingsystem_parameter_argv,8
+	.comm environ,8,8
+
+s:
+        .xword  0
+        .size   s, 8
+
+	.section .note.GNU-stack,"",%progbits
diff --git a/rtl/freebsd/aarch64/si_c.inc b/rtl/freebsd/aarch64/si_c.inc
new file mode 100644
index 0000000000..f629e50a4a
--- /dev/null
+++ b/rtl/freebsd/aarch64/si_c.inc
@@ -0,0 +1,89 @@
+
+Type
+    TCleanup = procedure; cdecl;
+
+var 
+  environ : ppchar; cvar; public  name '__environ';
+  progname: pchar = #0#0; cvar; public name '__progname';
+  dynamic : pchar;  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:ppchar;env:ppchar):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:ppchar;cleanup:TCleanup);
+
+var argc: longint;
+    argv: ppchar;
+    env : ppchar;
+    s   : pchar;
+begin
+  argc:=plongint(ap)^; 
+  argv:=ppchar(ap[1]);
+  env:=	ppchar(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(pchar(@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.
+
diff --git a/rtl/freebsd/aarch64/sighnd.inc b/rtl/freebsd/aarch64/sighnd.inc
new file mode 100644
index 0000000000..1d58896909
--- /dev/null
+++ b/rtl/freebsd/aarch64/sighnd.inc
@@ -0,0 +1,43 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 1999-2000 by Michael Van Canneyt,
+    member of the Free Pascal development team.
+
+    Signal handler is arch dependant due to processor to language
+    exception conversion.
+
+    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.
+
+ **********************************************************************}
+
+{ procedure SignalToRunerror(Sig: longint; SigInfo: PSigInfo; UContext: PUContext); public name '_FPC_DEFAULTSIGHANDLER'; cdecl; }
+procedure SignalToRunerror(Sig: cint; info : psiginfo;  SigContext:PSigContext); public name '_FPC_DEFAULTSIGHANDLER'; cdecl;
+
+var
+  res : word;
+begin
+  res:=0;
+  case sig of
+    SIGFPE:
+        res:=207;
+    SIGILL:
+        res:=216;
+    SIGSEGV :
+        res:=216;
+    SIGBUS:
+        res:=214;
+    SIGINT:
+        res:=217;
+    SIGQUIT:
+        res:=233;
+  end;
+  reenable_signal(sig);
+  { give runtime error at the position where the signal was raised }
+  if res<>0 then
+    HandleError(res);
+end;
diff --git a/rtl/freebsd/signal.inc b/rtl/freebsd/signal.inc
index a978ea5f04..eeddb2e550 100644
--- a/rtl/freebsd/signal.inc
+++ b/rtl/freebsd/signal.inc
@@ -80,6 +80,7 @@ type sigset_t = array[0..3] of Longint;
 
     psigcontext = ^sigcontextrec;
     PSigContextRec = ^SigContextRec;
+{$if (defined(CPUi386) or defined(CPUX86_64))}
     SigContextRec = record
        sc_mask      : sigset_t;          { signal mask to restore }
        sc_onstack   : longint;              { sigstack state to restore }
@@ -120,8 +121,14 @@ type sigset_t = array[0..3] of Longint;
        fpr_ex_sw    : cardinal;
        fpr_pad      : array[0..63] of char;
        end;
+{$endif def x86}
 
 
+{$ifdef CPUAARCH64}
+        SigContextRec = record
+            _dummy : cint;
+        end;
+{$endif cpuaarch64}
 
   Sigval = Record
             Case Boolean OF
diff --git a/rtl/freebsd/ucontexth.inc b/rtl/freebsd/ucontexth.inc
index aec4d8c69d..05cb11bcb0 100644
--- a/rtl/freebsd/ucontexth.inc
+++ b/rtl/freebsd/ucontexth.inc
@@ -20,6 +20,7 @@ type
   end;
   {$packrecords C}
 
+{$if (defined(CPUi386) or defined(CPUX86_64))}
   mcontext_t = record
     {*
      * The first 20 fields must match the definition of
@@ -53,7 +54,34 @@ type
     mc_fpstate: TMCFPStateArray;
     mc_spare2: array[0..7] of cInt;
   end;
+{$endif def x86}
 
+{$ifdef CPUAARCH64}
+  gpregs = record
+    gp_x: array[0..30] of cInt; { __register_t gp_x[30]; }
+    gp_lr: cInt;
+    gp_sp: cInt;
+    gp_elr: cInt;
+    gp_spsr: cuint32;
+    gp_pad: cInt;
+  end;
+
+  fpregs = record
+    fp_q: array[0..64] of cInt; { __uint128_t fp_q[32] }
+    fp_sr: cuint32;
+    fp_cr: cuint32;
+    fp_flags: cInt;
+    fp_pad: cInt;
+  end;
+
+  mcontext_t = record
+    mc_gpregs: gpregs;
+    mc_fpregs: fpregs;
+    mc_flags: cint32;
+    mc_pad: cint32;
+    mc_spare: array[0..8] of cInt;
+  end;
+{$endif cpuaarch64}
 
   pucontext_t = ^ucontext_t;
   ucontext_t = record  // required for kse threads
diff --git a/utils/fpcm/fpcmmain.pp b/utils/fpcm/fpcmmain.pp
index ae342f002c..03f34c0eba 100644
--- a/utils/fpcm/fpcmmain.pp
+++ b/utils/fpcm/fpcmmain.pp
@@ -123,7 +123,7 @@ interface
         { go32v2 }  ( true,  false, false, false, false, false, false, false, false, false, false, false, false, false,   false, false, false, false, false, false,  false,  false, false),
         { win32 }   ( true,  false, false, false, false, false, false, false, false, false, false, false, false, false,   false, false, false, false, false, false,  false,  false, false),
         { os2 }     ( true,  false, false, false, false, false, false, false, false, false, false, false, false, false,   false, false, false, false, false, false,  false,  false, false),
-        { freebsd } ( true,  false, false, false, true,  false, false, false, false, false, false, false, false, false,   false, false, false, false, false, false,  false,  false, false),
+        { freebsd } ( true,  false, false, false, true,  false, false, false, false, false, false, false, false, false,   false, false, true,  false, false, false,  false,  false, false),
         { beos }    ( true,  false, false, false, false, false, false, false, false, false, false, false, false, false,   false, false, false, false, false, false,  false,  false, false),
         { haiku }   ( true,  false, false, false, true,  false, false, false, false, false, false, false, false, false,   false, false, false, false, false, false,  false,  false, false),
         { netbsd }  ( true,  true,  true,  true,  true,  true,  false, false, false, false, false, false, false, false,   false, false, false, false, false, false,  false,  false, false),
freepascal-3.patch (35,212 bytes)   

Jonas Maebe

2021-04-10 10:20

manager   ~0130215

Thanks, applied with one small change (also added system_aarch64_freebsd to systems_caller_copy_addr_value_para, as the AArch64 ABI mandates this).

Issue History

Date Modified Username Field Change
2021-02-05 14:25 Mikaël Urankar New Issue
2021-02-05 14:25 Mikaël Urankar File Added: freepascal.patch
2021-02-05 15:18 Sven Barth Note Added: 0128783
2021-02-06 12:44 Jonas Maebe Note Added: 0128794
2021-02-06 16:55 Sven Barth Note Added: 0128798
2021-02-06 17:09 Jonas Maebe Note Added: 0128799
2021-03-03 13:26 Mikaël Urankar Note Added: 0129350
2021-03-03 13:26 Mikaël Urankar File Added: freepascal-3.patch
2021-04-10 10:20 Jonas Maebe Assigned To => Jonas Maebe
2021-04-10 10:20 Jonas Maebe Status new => resolved
2021-04-10 10:20 Jonas Maebe Resolution open => fixed
2021-04-10 10:20 Jonas Maebe Fixed in Version => 3.3.1
2021-04-10 10:20 Jonas Maebe Fixed in Revision => 49159
2021-04-10 10:20 Jonas Maebe FPCTarget => -
2021-04-10 10:20 Jonas Maebe Note Added: 0130215