[fpc-pascal] Crash on Windows for Aarch64 target

Volo Zyko volo.zyko at protonmail.com
Fri Jan 14 08:37:34 CET 2022


On Friday, January 14th, 2022 at 8:38 AM, Sven Barth via fpc-pascal <fpc-pascal at lists.freepascal.org> wrote:

> Am 12.01.2022 um 14:37 schrieb Volo Zyko via fpc-pascal:
>
> > Some time ago it was announced an experimental support for Windows on Aarch64 (namely in this post https://lists.freepascal.org/pipermail/fpc-pascal/2020-April/057762.html). I tried to build a dll with a proprietary code for that target. Building succeeded but it crashes on loading. At the moment I don't understand how to investigate the issue to provide more information about it.
> >
> > Here is my setup (in case there are any obvious mistakes). I built FPC from source (using commit e091d263c84890f64ca8353fa837c4fd7eb94c37). Building on Windows was quite straightforward - make OS_TARGET=win64 CPU_TARGET=aarch64 BINUTILSPREFIX= OPT=-O- all (as it was described in the post above). There was one catch though. Since I used MSys I had to make sure that the path to existing FPC was earlier than MSys's paths, i.e. I did export PATH=/c/tools/FPC/3.2.2/bin/i386-Win32/fpc:$PATH. FPC build system doesn't understand MSys file paths which are produced by MSys make, one must use make from FPC distribution. After building I got ppcrossa64.exe which is PE32+ executable for x86-64 itself. After this I built my dll. The command line was roughly like this: /c/tools/FPC/3.3.1/bin/x86_64-win64/ppcrossa64 -O- -Twin64 -Paarch64 -Sd -CF64 -fPIC -XPaarch64-win64 -olib.dll lib.dpr.
> >
> > Any help in investigating the crash would be appreciated. Obviously I cannot share the proprietary code (it's not mine). However, in case there are any tests from the FPC source code that I can build and run on ARM64 I would eagerly do it.
>
> The aarch64-win64 target isn't yet fully useable, cause it even fails to
> correctly cycle the compiler itself (and if that fails I'm not really
> confident with real world applications either). The cause wasn't yet
> directly investigated however (mainly due to time constraints).

I understand that this platform is still an experiment. However, the product I work on contains some legacy Pascal code which we need to build for aarch64-win64 to fully conform to MS Store requirements. We want to run on MS Surface, etc. This part is so important for us that my company is considering sponsoring proper aarch64-win64 support in FPC. Is this an option? For the moment I'm trying to investigate all possibilities to report them to management to make the final decision on this piece of code.

> By the way: is there a reason why you use MSys? FPC doesn't need it (nor
> expect it as you noticed with the paths).

I'm just used to MSys. It's more like a terminal on macOS or Linux. Windows cmd is too poor. I certainly can rebuild everything from scratch in cmd but I doubt that the result will differ.

Volo.



More information about the fpc-pascal mailing list