[fpc-devel] New Target Announcement: Windows on ARM64

Sven Barth pascaldragon at googlemail.com
Tue Apr 21 08:10:38 CEST 2020


Hello together!

I'm happy to announce initial support for the Windows on ARM64 target, 
aka aarch64-win64.

Simple programs work already and the compiler is at least able to 
display its help message (when trying to compiler something it silently 
crashes, I've not yet found out why that is the case). Optimizations 
don't work yet, so please use -O- when building (especially when 
building the compiler/RTL).

Just in case anyone thinks that: no, this does not mean that 
Metro/WinRT/UWP apps are supported.

Currently a clang installation is required as we use clang for the 
external assembler, because GNU AS does not yet support COFF for 
Aarch64. And we don't support Microsoft's arm64asm.exe yet...
Thus you should either have clang in your PATH or you need to use -FD… 
or CROSSBINDIR=… to point the compiler to the directory containing the 
clang binary while setting -XP… / BINUTILSPREFIX=… to empty.
Due to GNU LD also not being available we currently *only* support the 
internal linker (FPC does not support Microsoft's link.exe either).

Unlike i386-win32 and x86_64-win64 this target uses SEH from the beginning.

Also the NX_COMPAT and DYNAMIC_BASE flags are enabled by default and a 
relocation section is generated, because this is required by Windows on 
ARM64.

To build the compiler you can do the following:

make all FPMAKEOPT="-T <cores>" CPU_TARGET=aarch64 OS_TARGET=win64 
BINUTILSPREFIX= OPT=-O-

You might also need to specify OS_SOURCE and CPU_SOURCE (which is your 
host's target, e.g. if you have a Win64 ppcx64: OS_SOURCE=win64 
CPU_SOURCE=aarch64).

Please give this target a go (if you have access to a Windows on ARM64 
machine (1)) and report any problems you find so that the target will be 
nice and well soon. :)

Things left to do (in no specific order):
- implement an internal Aarch64 assembler (this way we could get rid of 
the clang dependency, though I won't work on that)
- implement support for Microsoft's armasm64.exe
- figure out why the compiler can't compile code on Windows on ARM64
- try to compile and run Lazarus
- fix optimizations
- fix other bugs (obviously ;) )
- implement Windows on ARM32, just for the sake of completeness ;)

(1) Apparantly one can also run a Windows on ARM64 in QEMU: 
https://winaero.com/blog/install-windows-10-arm-qemu/

Regards,
Sven


More information about the fpc-devel mailing list