Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2022-01

Crash on Windows for Aarch64 target

4 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Volo Zyko

Hello,

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.

Volo.

Reply by email

Sven Barth
to Volo Zyko
Volo Zyko wrote 7 lines
Hello, 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).

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).

Regards,
Sven

Reply by email

Volo Zyko
to Sven Barth
Sven Barth wrote 12 lines
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.

Reply by email

Marc Weustink
to Volo Zyko: Some time ago it was announced an experimental support for Windows on Aarch64 (namely in…
Volo Zyko wrote
Hello, 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.

I've been experimenting with this too. It looked cool to me to see if I can show our flagship product running on a rpi4.

The major pain is to debug windbg what is going wrong on asm level. One of the issues I ran into was something weird when a case jumptable was used. It jumped to invalid code. I never was able to reproduce this in a smaller example and in the full code it was one of the issues it could run into.
Now that VisualStudio starts to supports more and more dwarf debug info, I hope one day to use it as debugger.

Marc

Reply by email