[fpc-devel] Trunk does not build on AArch64

J. Gareth Moreton gareth at moreton-family.com
Sun Oct 18 12:25:11 CEST 2020

I can't remember for sure - it might have been 3.0.4, so I'm probably 
asking for trouble now.  When I get back later I'll check for sure and 
try a few things and get back to you.  At least it's confirmed that it 
actually did not compile!

For the curious, I'm looking to implement the optimisation of converting 
a division by a constant into a multiplication and a shift for AArch64, 
inspired by me playing around with my own assembly-written generator 
function in the other e-mail thread.  I made the comment about ADDS, 
forgetting about suffixes, because of how 'magic add' is handled when 
required (e.g. when dividing by 7 for 32-bit).

Gareth aka. Kit

On 18/10/2020 10:31, Sven Barth wrote:
> Am 18.10.2020 um 11:15 schrieb J. Gareth Moreton:
>> Hi Sven - thanks for the quick check.  I'm out of the house currently 
>> so I can't try it out immediately, but I'll try it out later this 
>> evening.  By the way, both my source and target are aarch64-linux 
>> (I'm using the prototype aarch64 build of the Raspberry Pi OS, 
>> athough I have an SD card with the standard 32-bit Arm Raspian as well).
> So you used 3.2.0 aarch64-linux as starting compiler? (though the 
> question isn't important anymore as the problem was somewhere else)
>> In regards to it not supporting inline assembly, it might only be 
>> applicable to FPC 3.2.x, as I tried to write some customised assembly 
>> language but was getting unrecognised opcode errors for instructions 
>> that definitely exist (like LDR).
> 3.2.0 also supports inline assembly for aarch64. And LDR works as well 
> as the following code in the Rtti unit from 3.2.0 shows:
> === code begin ===
> const
>   RawThunkPlaceholderProc = $8765876587658765;
>   RawThunkPlaceholderContext = $4321432143214321;
> type
>   TRawThunkProc = PtrUInt;
>   TRawThunkContext = PtrUInt;
> procedure RawThunk; assembler; nostackframe;
> asm
>   ldr x16, .LProc
>   ldr x0, .LContext
>   br x16
> .LProc:
>   .quad RawThunkPlaceholderProc
> .LContext:
>   .quad RawThunkPlaceholderContext
> RawThunkEnd:
> end;
> === code end ===
> So you probably either used something that's definitely not supposed 
> to be supported or something that the assembly reader does not yet 
> handle correctly (e.g. I had to fix 3.1.1 so that the code above is 
> handled correctly)
> Thus if you have such code and it doesn't work please report it.
> Regards,
> Sven

This email has been checked for viruses by Avast antivirus software.

More information about the fpc-devel mailing list