View Issue Details

IDProjectCategoryView StatusLast Update
0009262FPCCompilerpublic2019-08-14 09:56
ReporterAdriaan van OsAssigned To 
PrioritynormalSeverityminorReproducibilityalways
Status acknowledgedResolutionopen 
Product Version2.3.1Product Build 
Target VersionFixed in Version 
Summary0009262: No support for 80 bit softfloat in the compiler (needed for non-x86 to x86 crosscompiling)
DescriptionThe attched script builds a native PowerPC compiler and an i386 crosscompiler on powerpc-darwin8. The build stops with Internal error 2006012201. The bootstrap compiler is fpc 2.1.4.

.....
/Users/macg5/fpc-from-svn/fpc/compiler/ppcross386 -dNOMOUSE -Ur -dFPC_USE_LIBC -Pi386 -XPi386-darwin- -Xc -Xr -gl -Ur -Xs -O2 -n -Fi../inc -Fi../i386 -Fi../unix -Fi../bsd -Fi../bsd/i386 -Fi../darwin/i386 -FE. -FU/Users/macg5/fpc-from-svn/fpc/rtl/units/i386-darwin -di386 -dDEBUG -dRELEASE -Us -Sg ../bsd/system.pp
variant.inc(768,25) Warning: Automatic type conversion from floating type to COMP which is an integer type
setjump.inc(24,16) Warning: Use of +offset(%ebp) for parameters invalid here
setjump.inc(30,2) Warning: Use of +offset(%ebp) for parameters invalid here
heap.inc(1011,9) Warning: unreachable code
heap.inc(1204,7) Warning: unreachable code
thread.inc(323,10) Warning: Function result does not seem to be set
thread.inc(335,11) Warning: Function result does not seem to be set
thread.inc(345,11) Warning: Function result does not seem to be set
thread.inc(350,11) Warning: Function result does not seem to be set
thread.inc(355,11) Warning: Function result does not seem to be set
thread.inc(384,10) Warning: Function result does not seem to be set
thread.inc(403,11) Warning: Function result does not seem to be set
thread.inc(427,11) Warning: Function result does not seem to be set
thread.inc(433,11) Warning: Function result does not seem to be set
thread.inc(474,10) Warning: Function result does not seem to be set
generic.inc(588,14) Fatal: Internal error 2006012201
Fatal: Compilation aborted
make[5]: *** [system.ppu] Error 1
make[4]: *** [darwin_all] Error 2
make[3]: *** [rtl] Error 2
make[2]: *** [cycle] Error 2
make[1]: *** [compiler_cycle] Error 2
make: *** [build-stamp.i386-darwin] Error 2
logout
Additional Information The checked out revision is 8042.
TagsNo tags attached.
Fixed in Revision
FPCOldBugId0
FPCTarget-
Attached Files

Relationships

has duplicate 0029892 closedJonas Maebe Building or cross-compiler from Windows to Linux is broken 
has duplicate 0031210 closedJonas Maebe Internal error 2015030501 when building cross-compiler 
has duplicate 0035781 resolvedJonas Maebe x86_64 compiler ppcx64.exe fails on Windows when target is x86_64-darwin: Internal error 200208151 

Activities

2007-07-14 08:09

 

fpc-build.command.bz2 (1,027 bytes)

Daniël Mantione

2007-07-14 11:46

administrator   ~0013697

Cross-compiling from PowerPC to i386 is not possible at the moment, because the PowerPC cannot do extended precision floating point arithmetic. This internalerror occurs because the compiler needs to write an extended precision constant to the assembler file, but the code to do so is ifdef'ed out because it cannot be compiled correctly on PowerPC.

Perhaps in the future we will have a software implementation of the extended.

Adriaan van Os

2007-07-14 12:29

developer   ~0013698

On PowerPC-darwin, long double routines are built-into /usr/lib/libSystem.dylib, see e.g. <http://gcc.gnu.org/ml/gcc/2005-12/msg00505.html>

Apart from that, I see a discrepancy between the longreal sizes of the i386-darwin API <http://gcc.gnu.org/ml/gcc-patches/2005-03/msg02326.html> and current FPC.

[p17:~/gpc/testgpc/adriaan] adriaan% gp realsizetest.p
[p17:~/gpc/testgpc/adriaan] adriaan% ./realsizetest
GPC
SizeOf( Byte) = 1
SizeOf( Single) = 4
SizeOf( Double) = 8
SizeOf( Real) = 8
SizeOf( Extended) = 16
SizeOf( LongReal) = 16
SizeOf( LongestReal) = 16

[p17:~/gpc/testgpc/adriaan] adriaan% gp -m96bit-long-double realsizetest.p
[p17:~/gpc/testgpc/adriaan] adriaan% ./realsizetest
GPC
SizeOf( Byte) = 1
SizeOf( Single) = 4
SizeOf( Double) = 8
SizeOf( Real) = 8
SizeOf( Extended) = 12
SizeOf( LongReal) = 12
SizeOf( LongestReal) = 12

[p17:~/gpc/testgpc/adriaan] adriaan% fpc realsizetest.p
Free Pascal Compiler version 2.3.1 [2007/07/14] for i386
Copyright (c) 1993-2007 by Florian Klaempfl
Target OS: Darwin for i386
Compiling realsizetest.p
Assembling testlongrealsize
Linking realsizetest
24 lines compiled, 0.2 sec
[p17:~/gpc/testgpc/adriaan] adriaan% ./realsizetest
FPC
SizeOf( Byte) = 1
SizeOf( Single) = 4
SizeOf( Double) = 8
SizeOf( Real) = 8
SizeOf( Extended) = 10
SizeOf( LongDouble) = 10

Also see <http://gcc.gnu.org/onlinedocs/gcc-4.2.0/gcc/i386-and-x86_002d64-Options.html>

Daniël Mantione

2007-07-14 13:47

administrator   ~0013706

Extended is not a quadruple precision type, it is a 80 bit real, equal to the REAL*10 Fortran type. FPC handles extended precision calculations in hardware using the 8087 fpu on i386 and x86_64.

To support cross-compiling to i386 you need to be able to support this 80 bit real. You need to be binary compatible, otherwise you write the wrong data to object files and PPU files. So, 128 bit floating point is of no help here.

Jonas Maebe

2007-07-16 08:50

manager   ~0013736

FWIW, while Daniel's comments are correct, it's not true that this is not fixable: it requires 80 bit softfloat support in the compiler. Adding this is not a high priority, but it will probably be done in the long run.

Florian

2007-07-21 17:39

administrator   ~0013799

For a final, we'll implement 128 bit softfloat support which will be used for internal float values when compiling. This requires however that the softfpu unit is completly translated to pascal.

Daniël Mantione

2007-07-21 20:04

administrator   ~0013804

I see a lot of code in softfpu.pp, but eh, what parts of the 128-bit real implementation are still missing? :)

Florian

2007-07-29 16:31

administrator   ~0013874

Uncomment the defines
{ $define FPC_SOFTFLOAT_FLOATX80}
{ $define FPC_SOFTFLOAT_FLOAT128}
in line 74/75 and you will get errors :)

Lychee

2019-05-08 14:53

reporter   ~0116078

Any progress on this ?

I tried to cross-compile some stuf from arm to i386 a couple of months ago and this issue popped up. I take it that even if it's addressed that this will not make it into 3.2 ?

A rough estimate (plus-minus a couple of years) would be nice to have :-)

Jonas Maebe

2019-05-08 22:19

manager   ~0116084

Sorry, I'm not aware of anyone working on this.

Lychee

2019-05-30 09:45

reporter   ~0116457

Thank you for your quick reply J.M.,

No need to be sorry about anything :-) I apologize for my delayed reaction.

Please forgive my ignorance but it seems to me that the show-stopper as mentioned by Florian in 2007 does not apply anymore ? I am able to compile the softfloat unit just fine (i'm aware that this does not mean anything in relation to compatibility) and this unit seems to be enabled for the x64 platform as well (which seems to indicate there is some form of compatibility).

Is there something missing from the infrastructure of the compiler and/or (platform specific) RTL that prevents the softfloat unit to be used for non intel (compatible) platforms (such as mentioned by the reporter) so that it's possible to crosscompile ?

I seem to be unable to find another show-stopper myself other then that the comments report that this issue has low priority. Hence why i stated that it would be nice to have a rough estimate :-)

Sven Barth

2019-05-31 15:20

manager   ~0116479

The constant evaluation inside the compiler needs to be adjusted so that it can utilize the SoftFPU unit code (preferably in a way that does not need too many other changes).

Akira1364

2019-06-28 20:28

reporter   ~0116998

Last edited: 2019-06-28 20:33

View 6 revisions

Am I missing something here? I don't think this issue exists anymore in trunk.

For example, I've been using a native Win64 build of FPC to successfully build cross-compilers for targets ranging from AVR to MSDOS simply by setting the "FPC_SOFT_FPUX80" define for quite a while now.

The response to the "related" issue regarding x86_64-darwin is not correct, either. You can definitely build working cross-compilers for both 64 and 32-bit Darwin using a native Win64 copy of FPC.

Sven Barth

2019-06-29 23:01

manager   ~0117012

AVR doesn't really count as a suitable example for this, because it doesn't support an FPU at all. Also the only targets that are problematic are X86 targets as all other platforms don't have a 80-bit floating point type.

That said: the define allows compilation, yes. However ts80real is still declared as Extended (the x86_64 Extended, aka Double on Win64) and the code in assemble.pas is using the ts32real and ts64real based values for constants. Thus constant values will have wrong values thus resulting in slightly different values when code is cross compiled. Enough that there *are* issues with this (here: 0035147, at least I suspect that is the cause, I've not investigated it yet).

Issue History

Date Modified Username Field Change
2007-07-14 08:09 Adriaan van Os New Issue
2007-07-14 08:09 Adriaan van Os File Added: fpc-build.command.bz2
2007-07-14 11:46 Daniël Mantione Status new => resolved
2007-07-14 11:46 Daniël Mantione Resolution open => not fixable
2007-07-14 11:46 Daniël Mantione Assigned To => Daniël Mantione
2007-07-14 11:46 Daniël Mantione Note Added: 0013697
2007-07-14 12:29 Adriaan van Os Status resolved => feedback
2007-07-14 12:29 Adriaan van Os Resolution not fixable => reopened
2007-07-14 12:29 Adriaan van Os Note Added: 0013698
2007-07-14 13:47 Daniël Mantione Status feedback => resolved
2007-07-14 13:47 Daniël Mantione Resolution reopened => not fixable
2007-07-14 13:47 Daniël Mantione Note Added: 0013706
2007-07-16 08:50 Jonas Maebe FPCOldBugId => 0
2007-07-16 08:50 Jonas Maebe FPCTarget => -
2007-07-16 08:50 Jonas Maebe Note Added: 0013736
2007-07-20 14:15 Jonas Maebe Assigned To Daniël Mantione =>
2007-07-20 14:15 Jonas Maebe Severity major => minor
2007-07-20 14:15 Jonas Maebe Status resolved => acknowledged
2007-07-20 14:15 Jonas Maebe Resolution not fixable => open
2007-07-20 14:15 Jonas Maebe Summary Fatal: Internal error 2006012201 on powerpc-darwin => No support for 80 bit softfloat in the compiler (needed for non-x86 to x86 crosscompiling)
2007-07-21 17:39 Florian Note Added: 0013799
2007-07-21 20:04 Daniël Mantione Note Added: 0013804
2007-07-29 16:31 Florian Note Added: 0013874
2016-03-25 22:18 Jonas Maebe Relationship added has duplicate 0029899
2016-03-25 22:20 Jonas Maebe Relationship deleted has duplicate 0029899
2016-03-25 22:20 Jonas Maebe Relationship added has duplicate 0029892
2017-01-10 18:53 Jonas Maebe Relationship added has duplicate 0031210
2019-05-08 14:53 Lychee Note Added: 0116078
2019-05-08 22:19 Jonas Maebe Note Added: 0116084
2019-05-30 09:45 Lychee Note Added: 0116457
2019-05-31 15:20 Sven Barth Note Added: 0116479
2019-06-28 19:20 Jonas Maebe Relationship added has duplicate 0035781
2019-06-28 20:28 Akira1364 Note Added: 0116998
2019-06-28 20:28 Akira1364 Note Edited: 0116998 View Revisions
2019-06-28 20:31 Akira1364 Note Edited: 0116998 View Revisions
2019-06-28 20:31 Akira1364 Note Edited: 0116998 View Revisions
2019-06-28 20:33 Akira1364 Note Edited: 0116998 View Revisions
2019-06-28 20:33 Akira1364 Note Edited: 0116998 View Revisions
2019-06-29 23:01 Sven Barth Note Added: 0117012