System call ABI problem on ppc Linux

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

System call ABI problem on ppc Linux

tobiasgiesen
Hello,

I just filed a bug report about FpFtruncate passing the parameters incorrectly to the
system. For example, setting a file size to $D would cause the file to have the size
$D 0000 000D. Apparently the conditional define FPC_ABI_EABI would fix it, but what
other impact does it have?

I wonder which other system calls might be affected? My application seems to work
fine except for this function.

https://bugs.freepascal.org/view.php?id=32772

Cheers,
Tobias


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: System call ABI problem on ppc Linux

Marco van de Voort
In our previous episode, Tobias Giesen said:
> I just filed a bug report about FpFtruncate passing the parameters incorrectly to the
> system. For example, setting a file size to $D would cause the file to have the size
> $D 0000 000D. Apparently the conditional define FPC_ABI_EABI would fix it, but what
> other impact does it have?
>
> I wonder which other system calls might be affected? My application seems to work
> fine except for this function.
>
> https://bugs.freepascal.org/view.php?id=32772

I replied. Roughly anything with an 64-bit argument, (typically off_t) most
notably mmap.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: System call ABI problem on ppc Linux

tobiasgiesen
Hi,
I will check it but the app really runs fine now after changing only FpFtruncate, and
also FppRead and FppWrite (which nobody seems to use anyway). These are the
occurrences of {$ifdef FPC_ABI_EABI}.

I think the only problem is with fpmake, which doesn't include FPC_ABI_EABI for
powerpc 32-bit processors.

My use case is running my software on a Synology DS-413 NAS, which has a PowerPC
processor. It's only a few years old. Nowadays they use only Intel and ARM.

For old times' sake I will also release it for Mac OS / ppc.

Cheers,
Tobias

----

On Tue, 5 Dec 2017 14:55:41 +0100 (CET)
[hidden email] (Marco van de Voort) wrote:

> In our previous episode, Tobias Giesen said:
> > I just filed a bug report about FpFtruncate passing the parameters incorrectly to the
> > system. For example, setting a file size to $D would cause the file to have the size
> > $D 0000 000D. Apparently the conditional define FPC_ABI_EABI would fix it, but what
> > other impact does it have?
> >
> > I wonder which other system calls might be affected? My application seems to work
> > fine except for this function.
> >
> > https://bugs.freepascal.org/view.php?id=32772
>
> I replied. Roughly anything with an 64-bit argument, (typically off_t) most
> notably mmap.
> _______________________________________________
> fpc-pascal maillist  -  [hidden email]
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Kind Regards,
Tobias Giesen

Super Flexible Software Ltd. & Co. KG
Buddenstr. 29-31
48143 Münster, Germany
www.superflexible.com
www.tgtools.com

-----------------------------------------------------------
Registered at register court Münster as HRA 9716
Liability / general partner: TGTools Ltd.
Company No. 05513299
Registered in England and Wales
Directors: Tobias Giesen and Claudia Giesen

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: System call ABI problem on ppc Linux

Karoly Balogh (Charlie/SGR)
Hi,

On Tue, 5 Dec 2017, [hidden email] wrote:

> I think the only problem is with fpmake, which doesn't include
> FPC_ABI_EABI for powerpc 32-bit processors.
>
> My use case is running my software on a Synology DS-413 NAS, which has a
> PowerPC processor. It's only a few years old. Nowadays they use only
> Intel and ARM.

Please note that your NAS has a Freescale P1022 CPU, which has an e500v2
CPU core. In Linux architecture terms, this isn't a regular PowerPC but
PowerPCSPE, as it has a non-standard FPU. This means that classic PowerPC
FPU instructions are not supported, or supported only with kernel
emulation. It's also entirely incompatible with regular applications using
Altivec or VMX SIMD, as the instruction encoding overlaps. It could also
mean that the syscall ABI *could* be different to regular PowerPCs. I
don't know if it is, but could be.

Free Pascal doesn't support PPCSPE CPUs officially (we always generate
classic FPU code for memory copies for example, and the PPC code generator
doesn't support the SPE FPU or the softfpu at this point), so at least we
should verify if your patch doesn't cause problems on regular PPC Linux
installations, or if this bug also exist there.

Charlie
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: System call ABI problem on ppc Linux

tobiasgiesen
Interesting! But my report was based on my development machine, a PowerBook G4.

Apparently the special instructions are not used or not causing a problem because it also runs fine on the NAS.


-----

Please excuse the shortness of this mail which was sent from my mobile phone. If necessary, I will send more information later.

Cheers,
Tobias Giesen

> Am 05.12.2017 um 19:20 schrieb Karoly Balogh (Charlie/SGR) <[hidden email]>:
>
> Hi,
>
>> On Tue, 5 Dec 2017, [hidden email] wrote:
>>
>> I think the only problem is with fpmake, which doesn't include
>> FPC_ABI_EABI for powerpc 32-bit processors.
>>
>> My use case is running my software on a Synology DS-413 NAS, which has a
>> PowerPC processor. It's only a few years old. Nowadays they use only
>> Intel and ARM.
>
> Please note that your NAS has a Freescale P1022 CPU, which has an e500v2
> CPU core. In Linux architecture terms, this isn't a regular PowerPC but
> PowerPCSPE, as it has a non-standard FPU. This means that classic PowerPC
> FPU instructions are not supported, or supported only with kernel
> emulation. It's also entirely incompatible with regular applications using
> Altivec or VMX SIMD, as the instruction encoding overlaps. It could also
> mean that the syscall ABI *could* be different to regular PowerPCs. I
> don't know if it is, but could be.
>
> Free Pascal doesn't support PPCSPE CPUs officially (we always generate
> classic FPU code for memory copies for example, and the PPC code generator
> doesn't support the SPE FPU or the softfpu at this point), so at least we
> should verify if your patch doesn't cause problems on regular PPC Linux
> installations, or if this bug also exist there.
>
> Charlie
> _______________________________________________
> fpc-pascal maillist  -  [hidden email]
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal