Re: [fpc-devel] Trunk does not build on AArch64
Am 18.10.2020 um 08:56 schrieb J. Gareth Moreton via fpc-devel: Hi everyone, I've started to look at developing FPC on the Raspberry Pi again, but I've run into a snag. The unmodified trunk does not build - it fails when building system.pp at the ppc1 stage: math.inc(57,7) Error: Assembler syntax error math.inc(58,11) Error: Unrecognized opcode round flt_core.inc(459,47) Error: Can't evaluate constant expression flt_core.inc(461,10) Fatal: Syntax error, ")" expected but "," found How do you build for Aarch64 (your command line)? I assume your host is arm-linux? I remember noticing that AArch64 does not yet support inline assembly, which is what math.inc contains at the lines indicated (although "round" is inside a constant, so... what gives?!). Not sure how to get around the issue with flt_core.inc just yet. Of course it supports inline assembly. Where did you get that nonsense? Regards, Sven ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Trunk does not build on AArch64
Am 18.10.2020 um 08:56 schrieb J. Gareth Moreton via fpc-devel: Hi everyone, I've started to look at developing FPC on the Raspberry Pi again, but I've run into a snag. The unmodified trunk does not build - it fails when building system.pp at the ppc1 stage: math.inc(57,7) Error: Assembler syntax error math.inc(58,11) Error: Unrecognized opcode round flt_core.inc(459,47) Error: Can't evaluate constant expression flt_core.inc(461,10) Fatal: Syntax error, ")" expected but "," found Okay, found the problem. Please try again with r47123. Regards, Sven ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Trunk does not build on AArch64
Am 18.10.20 um 08:56 schrieb J. Gareth Moreton via fpc-devel: (On another note, a number of AArch64 opcodes are missing, notably ADDS (add and set flags) and similar instructions - This is done by opcode prefixes. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Trunk does not build on AArch64
Ah, thanks Florian. Gareth aka. Kit On 18/10/2020 10:01, Florian Klämpfl via fpc-devel wrote: Am 18.10.20 um 08:56 schrieb J. Gareth Moreton via fpc-devel: (On another note, a number of AArch64 opcodes are missing, notably ADDS (add and set flags) and similar instructions - This is done by opcode prefixes. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel -- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Trunk does not build on AArch64
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). 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). Gareth aka. Kit On 18/10/2020 09:53, Sven Barth wrote: Am 18.10.2020 um 08:56 schrieb J. Gareth Moreton via fpc-devel: Hi everyone, I've started to look at developing FPC on the Raspberry Pi again, but I've run into a snag. The unmodified trunk does not build - it fails when building system.pp at the ppc1 stage: math.inc(57,7) Error: Assembler syntax error math.inc(58,11) Error: Unrecognized opcode round flt_core.inc(459,47) Error: Can't evaluate constant expression flt_core.inc(461,10) Fatal: Syntax error, ")" expected but "," found Okay, found the problem. Please try again with r47123. Regards, Sven -- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Trunk does not build on AArch64
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 ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Trunk does not build on AArch64
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. https://www.avast.com/antivirus ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Trunk does not build on AArch64
I've just seen the change you've made Sven (just looking it via diff, not actually testing the code)... do the standard Pascal comments seriously cause a problem in AArch64 assembly blocks? Do the braces have an actual syntactic use on that platform? That seems like an incredibly awkward design. Gareth aka. Kit On 18/10/2020 09:53, Sven Barth wrote: Am 18.10.2020 um 08:56 schrieb J. Gareth Moreton via fpc-devel: Hi everyone, I've started to look at developing FPC on the Raspberry Pi again, but I've run into a snag. The unmodified trunk does not build - it fails when building system.pp at the ppc1 stage: math.inc(57,7) Error: Assembler syntax error math.inc(58,11) Error: Unrecognized opcode round flt_core.inc(459,47) Error: Can't evaluate constant expression flt_core.inc(461,10) Fatal: Syntax error, ")" expected but "," found Okay, found the problem. Please try again with r47123. Regards, Sven -- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Trunk does not build on AArch64
On 18/10/2020 13:34, J. Gareth Moreton via fpc-devel wrote: > I've just seen the change you've made Sven (just looking it via diff, > not actually testing the code)... do the standard Pascal comments > seriously cause a problem in AArch64 assembly blocks? Do the braces > have an actual syntactic use on that platform? Just like with plain ARM, some instructions in AArch64 accept register sets. The syntax for a register set for both ARM and AArch64 is "{ rX, rY }". Jonas ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Trunk does not build on AArch64
Aah, I see - thanks Jonas. That's a little awkward - presumably we can't change it to round brackets instead since that's a bit of a clash that can't easily be remedied, especially as such comments are fine in other inline assembly languages. Gareth aka. Kit On 18/10/2020 14:10, Jonas Maebe via fpc-devel wrote: On 18/10/2020 13:34, J. Gareth Moreton via fpc-devel wrote: I've just seen the change you've made Sven (just looking it via diff, not actually testing the code)... do the standard Pascal comments seriously cause a problem in AArch64 assembly blocks? Do the braces have an actual syntactic use on that platform? Just like with plain ARM, some instructions in AArch64 accept register sets. The syntax for a register set for both ARM and AArch64 is "{ rX, rY }". Jonas ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel -- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Trunk does not build on AArch64
Am 18.10.2020 um 15:15 schrieb J. Gareth Moreton via fpc-devel: Aah, I see - thanks Jonas. That's a little awkward - presumably we can't change it to round brackets instead since that's a bit of a clash that can't easily be remedied, especially as such comments are fine in other inline assembly languages. Technically it would be possible, but we want to be as close as possible to the native platform assembly language so that people don't need to search for how it might work. Regards, Sven ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Trunk does not build on AArch64
That's a point, yeah. It's just difficult because, on Lazarus for example, anything inside braces is coloured as if it were a comment in an asm block. Changing this so it appears the same colour as the rest of the assembly code when on Arm platforms would help reduce the confusion, although that's another story, and I'm not sure what the policy is on platform-specific syntax highlighting. Gareth aka. Kit On 18/10/2020 14:41, Sven Barth wrote: Am 18.10.2020 um 15:15 schrieb J. Gareth Moreton via fpc-devel: Aah, I see - thanks Jonas. That's a little awkward - presumably we can't change it to round brackets instead since that's a bit of a clash that can't easily be remedied, especially as such comments are fine in other inline assembly languages. Technically it would be possible, but we want to be as close as possible to the native platform assembly language so that people don't need to search for how it might work. Regards, Sven -- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Support for FreeBSD PowerPC
On 14/10/2020 17:45, Curtis Hamilton via fpc-devel wrote: > I’ve been able to create a cross compiler using the guidance and some > additional information. But I’ve been unable to create the proper FPC > startup code (prt0.as) needed. > > Any help would be appreciated. I believe these files are generally created by disassembling the system's crt1.o (objdump -d) and then changing the call(s) to the libc intialisation code with calls to the FPC RTL intialisation code. Jonas ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Support for FreeBSD PowerPC
Op 2020-10-18 om 23:03 schreef Jonas Maebe via fpc-devel: I’ve been able to create a cross compiler using the guidance and some additional information. But I’ve been unable to create the proper FPC startup code (prt0.as) needed. Any help would be appreciated. I believe these files are generally created by disassembling the system's crt1.o (objdump -d) and then changing the call(s) to the libc intialisation code with calls to the FPC RTL intialisation code. Afaik mostly gcc -S. Trunk SVN also contains an untested and incomplete attempt at translating the C startup files to pascal. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel