diff --git a/compiler/Makefile b/compiler/Makefile index 74f577f389..ec4da3878e 100644 --- a/compiler/Makefile +++ b/compiler/Makefile @@ -513,7 +513,7 @@ endif endif override LOCALOPT+=-d$(CPC_TARGET) -dGDB -dBROWSERLOG ifdef LLVM -ifeq ($(findstring $(PPC_TARGET),x86_64),) +ifeq ($(findstring $(PPC_TARGET),x86_64 aarch64),) $(error The $(PPC_TARGET) architecture is not (yet) support by the FPC/LLVM code generator) endif ifeq ($(findstring $(OS_TARGET),darwin iphonesim linux),) diff --git a/compiler/Makefile.fpc b/compiler/Makefile.fpc index 2466fe5237..a27284c1af 100644 --- a/compiler/Makefile.fpc +++ b/compiler/Makefile.fpc @@ -261,7 +261,7 @@ override LOCALOPT+=-d$(CPC_TARGET) -dGDB -dBROWSERLOG #include LLVM define/directory if requested ifdef LLVM -ifeq ($(findstring $(PPC_TARGET),x86_64),) +ifeq ($(findstring $(PPC_TARGET),x86_64 aarch64),) $(error The $(PPC_TARGET) architecture is not (yet) support by the FPC/LLVM code generator) endif diff --git a/compiler/aarch64/cpuinfo.pas b/compiler/aarch64/cpuinfo.pas index dcd0203fd2..17afbc786a 100644 --- a/compiler/aarch64/cpuinfo.pas +++ b/compiler/aarch64/cpuinfo.pas @@ -56,6 +56,10 @@ Type Const + fputypestrllvm : array[tfputype] of string[6] = ('', + '' + ); + { Is there support for dealing with multiple microcontrollers available } { for this platform? } ControllerSupport = false; (* Not yet at least ;-) *) diff --git a/compiler/aarch64/cpunode.pas b/compiler/aarch64/cpunode.pas index 19e146df5d..55ebc43b83 100644 --- a/compiler/aarch64/cpunode.pas +++ b/compiler/aarch64/cpunode.pas @@ -31,11 +31,14 @@ implementation uses ncgbas,ncgflw,ncgcal,ncgcnv,ncgld,ncgmem,ncgcon,ncgset,ncgobjc, - ncpuadd,ncpumat,ncpumem,ncpuinl,ncpucnv,ncpuset, - { this not really a node } - rgcpu, { symtable } symcpu, - aasmdef; + aasmdef, +{$ifndef llvm} + ncpuadd,ncpumat,ncpumem,ncpuinl,ncpucnv,ncpuset +{$else llvm} + llvmnode +{$endif llvm} + ; end. diff --git a/compiler/llvm/agllvm.pas b/compiler/llvm/agllvm.pas index 404646266f..ba643a324f 100644 --- a/compiler/llvm/agllvm.pas +++ b/compiler/llvm/agllvm.pas @@ -1576,7 +1576,7 @@ implementation idtxt : 'LLVM-LLC'; asmbin : 'llc'; asmcmd: '$OPT -o $OBJ $ASM'; - supported_targets : [system_x86_64_linux,system_x86_64_darwin]; + supported_targets : [system_x86_64_linux,system_x86_64_darwin,system_aarch64_linux]; flags : [af_smartlink_sections]; labelprefix : 'L'; comment : '; '; @@ -1590,7 +1590,7 @@ implementation idtxt : 'LLVM-CLANG'; asmbin : 'clang'; asmcmd: '$OPT -c -o $OBJ $ASM'; - supported_targets : [system_x86_64_linux,system_x86_64_darwin]; + supported_targets : [system_x86_64_linux,system_x86_64_darwin,system_aarch64_linux]; flags : [af_smartlink_sections]; labelprefix : 'L'; comment : '; '; diff --git a/compiler/symconst.pas b/compiler/symconst.pas index bc738463a7..7c401d762b 100644 --- a/compiler/symconst.pas +++ b/compiler/symconst.pas @@ -122,16 +122,17 @@ const and will increase with 10 for each parameter. The high parameters will be inserted with n+1 } paranr_blockselfpara = 1; - paranr_parentfp = 2; paranr_parentfp_delphi_cc_leftright = 2; {$if defined(aarch64) and defined(llvm)} { for AArch64 on LLVM, the "sret" parameter must always be the first -> give it a higher number; can't do it for other platforms, because that would change the register assignment/parameter order and the current one is presumably Delphi-compatible } - paranr_result = 3; + paranr_result = 2; + paranr_parentfp = 3; paranr_self = 4; {$else} + paranr_parentfp = 2; paranr_self = 3; paranr_result = 4; {$endif} diff --git a/compiler/systems/i_linux.pas b/compiler/systems/i_linux.pas index a8b2d3e74a..124b813114 100644 --- a/compiler/systems/i_linux.pas +++ b/compiler/systems/i_linux.pas @@ -880,7 +880,11 @@ unit i_linux; tf_files_case_sensitive, tf_requires_proper_alignment, tf_smartlink_sections,tf_pic_uses_got, - tf_has_winlike_resources]; + tf_has_winlike_resources +{$ifdef llvm} + ,tf_use_psabieh +{$endif llvm} + ]; cpu : cpu_aarch64; unit_env : 'LINUXUNITS'; extradefines : 'UNIX;HASUNIX';