[fpc-devel] AArch64 port committed to svn trunk

Jonas Maebe jonas.maebe at elis.ugent.be
Fri May 8 15:37:29 CEST 2015

[replying on the list to a private message with consent from the
original poster]

On 07/05/15 12:38, Edmund Grimley Evans wrote:
>> I've just committed the AArch64 (aka "ARM64") port to trunk. It
>> currently only supports iOS, but adding Linux support should not be
>> difficult.
> How difficult? What needs to be done?

Compiler: mostly adding support for the GNU syntax to the assembler
writer (compiler/aarch64/agcpugas.pas). Apart from that, possibly adding
support for ELF-specific symbol addressing (e.g. GOT-related things) and
possibly adding support for non-PIC code if that is supported (iOS only
supports/uses PIC on AArch64) (compiler/aarch64/cgcpu.pas,
tcgaarch64.make_simple_ref -- at least the first "{ todo }" part, or
verify what can be reused from the existing code for Darwin). Possibly
also add support for the GNU memory reference assembler syntax to
compiler/aarch64/racpugas.pas (search for "LO12").

RTL: add Linux startup and syscall code for AArch64 (rtl/linux/aarch64,
base on rtl/linux/{powerpc64,i386,x86_64}/si_*.inc if possible), and
Linux signal/sigcontext
support(rtl/linux/aarch64/{sighnd.inc,sighndh.inc}). Verify/fix various
types used for kernel interfacing (statfs etc -- see

fpcmake and fpmkunit: add the Linux/AArch64 target (see
http://svn.freepascal.org/cgi-bin/viewvc.cgi?view=revision&revision=29899 and
http://svn.freepascal.org/cgi-bin/viewvc.cgi?view=revision&revision=29902 )

> I might be interested in playing with this. I know about Linux, ARM
> architectures and compilers. However, I don't know much about iOS or,
> indeed, Pascal.
> fpcmake -Tall

The above command regenerated the top-level makefile using the fpcmake
that was in your path. This is probably the fpcmake from the latest
official release. Since that release had no AArch64 support, this
removed any AArch64 support that the Makefile may have had.

You only have to use that command if you want to regenerate a Makefile
either after modifying the corresponding Makefile.fpc, or after
modifying the fpcmake program to add support for a new target (such as
Linux/AArch64). In this latter case you have to regenerate all Makefiles
rather than on only the top-level one though, e.g. using fpcmake -Tall
`find . -name Makefile.fpc`

> make all OS_TARGET=linux CPU_TARGET=arm BINUTILSPREFIX=arm-linux-gnueabihf-
> worked for me. With "darwin" instead of "linux" it got as far as not
> finding the assembler. With "darwin" instead of "linux" and "aarch64"
> instead of "arm":
> Makefile:197: *** The Makefile doesn't support target aarch64-darwin,
> please run fpcmake first.  Stop.
> Is the build infrastructure incomplete?

As mentioned above, you probably overwrote the Makefile with one that
does not have support for Darwin/AArch64 anymore. Note that building for
Darwin generally doesn't work on non-Darwin platforms, as the GNU
binutils don't support it. You may be able to use
https://github.com/tpoechtrager/osxcross , but I've never tried it myself.


More information about the fpc-devel mailing list