[fpc-devel] Porting fpc to linux-sparc64

John Paul Adrian Glaubitz glaubitz at physik.fu-berlin.de
Mon May 29 10:37:42 CEST 2017


On Mon, May 29, 2017 at 10:03:57AM +0200, Karoly Balogh (Charlie/SGR) wrote:
> > When trying to cross-build fpc for sparc64, I ran into linker issues. I was
> > able to resolve these when changing the ELF format from 32 to 64 bits in
> > compiler/system/t_linux.pas and changing the dynamic loader path from
> > /lib/ld-linux.so.2 to /lib64/ld-linux.so.2. However, trying to run these
> > binaries on an actual sparc64 box running Debian unstable results in bus errors.
> Hmm, we had the last testsuite run for SPARC Linux back in 2013. I was
> under the impression it's still being tested... The Solaris version's last
> testresult is from 2012...
> https://www.freepascal.org/testsuite/cgi-bin/testsuite.cgi?action=1&run1id=150744
> https://www.freepascal.org/testsuite/cgi-bin/testsuite.cgi?action=1&run1id=120817


> Which might suggest that the trunk could be broken at this point. :(

The build actually succeeds with the modifications I made.

> And/or completely unprepared for 64bit in any way.

I actually don't think there would be much work necessary. fpc already
supports SPARCv9 which is actually by default a 64-bit architecture
(also known as UltraSPARC).

However, most Linux distributions compiled SPARCv9 binaries with
"-m32" in the past and that was also the default configuration for
Debian's old "sparc" port which was dropped in 2015 after Debian

Debian's new sparc64 port is effectively the same code (SPARCv9), just
with the "-m32" option removed. Depending on how much fpc depends on
pointer and default word sizes, it may just be a matter of extending
all pointers and default words to 64 bits.

> Although we still seem to have a stable 3.0.2 release. Can you try
> if the stable release built by us works on your system? Any binary
> from this.
> ftp://ftp.freepascal.org/pub/fpc/dist/3.0.2/sparc-linux/

Running the IDE (fp) and the compiler (ppcsparc) works, although I did
not perform any extensive tests:

glaubitz at deb4g:~/fpc-3.0.2$ ./lib/fpc/3.0.2/ppcsparc
Free Pascal Compiler version 3.0.2 [2017/05/07] for sparc
Copyright (c) 1993-2017 by Florian Klaempfl and others
/home/glaubitz/fpc-3.0.2/lib/fpc/3.0.2/ppcsparc [options] <inputfile>
 Put + after a boolean switch option to enable it, - to disable it.

> > Thus, I was wondering whether there are still people around who care for the
> > SPARC port of fpc and who could help me. We have very fast sparc64 porterboxes
> > available running Debian unstable and I'd be happy to create accounts on these
> > machines for anyone who wants to help.
> I don't know anything about SPARC, but if no one else volunteers, I can
> take a look. In fact, maybe even a full 64bit SPARC port shouldn't be that
> hard (famous last words...), but at least a few weeks of work for sure for
> someone who knows the compiler internals.

I also don't think it will be that hard given the fact that the
important part, a code generator for SPARCv9, is already in place.

I can also provide a machine that could be used for running the
testsuite on Linux/sparc64. We already provide such a machine for the
QEMU upstream developers to test on sparc64.


 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaubitz at debian.org
`. `'   Freie Universitaet Berlin - glaubitz at physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

More information about the fpc-devel mailing list