Re: [fpc-devel] Porting fpc to linux-sparc64

2017-05-31 Thread Jonas Maebe
On 30/05/17 12:15, Karoly Balogh (Charlie/SGR) wrote: Is it still required? Darwin does all kinds of weak linking too, and it has a Pascal written startup code if I'm correct. We use the libc startup code on Darwin. FPC only supports referencing external weak symbols. It does not (yet)

Re: [fpc-devel] Porting fpc to linux-sparc64

2017-05-30 Thread Marco van de Voort
In our previous episode, Karoly Balogh (Charlie/SGR) said: > > In our previous episode, Karoly Balogh (Charlie/SGR) said: > > > Err, those are invoked directly from the Makefile, not invoked from inside > > > FPC. But you're right, that will be also a problem... Some platforms still > > > use

Re: [fpc-devel] Porting fpc to linux-sparc64

2017-05-30 Thread Karoly Balogh (Charlie/SGR)
Hi, On Tue, 30 May 2017, Marco van de Voort wrote: > In our previous episode, Karoly Balogh (Charlie/SGR) said: > > Err, those are invoked directly from the Makefile, not invoked from inside > > FPC. But you're right, that will be also a problem... Some platforms still > > use asm-written

Re: [fpc-devel] Porting fpc to linux-sparc64

2017-05-30 Thread Marco van de Voort
In our previous episode, John Paul Adrian Glaubitz said: > > generate the actual Makefile. But by the time I get there I'll figure it > > out. One problem at a time. > > Actually, the Debian package explicitly regenerates all Makefiles and > I assume the main reason being to make sure they are

Re: [fpc-devel] Porting fpc to linux-sparc64

2017-05-30 Thread Marco van de Voort
In our previous episode, Karoly Balogh (Charlie/SGR) said: > Err, those are invoked directly from the Makefile, not invoked from inside > FPC. But you're right, that will be also a problem... Some platforms still > use asm-written startup stubs in FPC. Not all of them tho'. I think these > days

Re: [fpc-devel] Porting fpc to linux-sparc64

2017-05-29 Thread John Paul Adrian Glaubitz
On 05/29/2017 10:22 PM, Florian Klämpfl wrote: > Well, fpc has a SPARCv9 switch, but it does little to none and it was only > supposed to enable > SPARCv9 instructions in 32 bit only mode. SPARC64 is another story: it needs > some more work, it is > basically a new target for the compiler though

Re: [fpc-devel] Porting fpc to linux-sparc64

2017-05-29 Thread Florian Klämpfl
Am 29.05.2017 um 10:37 schrieb John Paul Adrian Glaubitz: >> 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). Well, fpc

Re: [fpc-devel] Porting fpc to linux-sparc64

2017-05-29 Thread Florian Klämpfl
Am 29.05.2017 um 17:35 schrieb John Paul Adrian Glaubitz: > On Mon, May 29, 2017 at 05:11:52PM +0200, Karoly Balogh (Charlie/SGR) wrote: >> Err, sorry, there's a typo in the previous line I've sent. here's the >> correct one. Also, ASTARGET= override seems to work, so you don't need to >> patch

Re: [fpc-devel] Porting fpc to linux-sparc64

2017-05-29 Thread Mark Morgan Lloyd
On 29/05/17 15:15, Karoly Balogh (Charlie/SGR) wrote: Hi, On Mon, 29 May 2017, Karoly Balogh (Charlie/SGR) wrote: Plus you need to fix the Makefile.fpc in rtl/linux to include -32 for> SPARC, and regenerate it using fpcmake -Tall. Then everything works. Maybe> it's also possible to just add

Re: [fpc-devel] Porting fpc to linux-sparc64

2017-05-29 Thread Karoly Balogh (Charlie/SGR)
Hi, On Mon, 29 May 2017, Karoly Balogh (Charlie/SGR) wrote: > make all ASTARGET=-32 OPT="-ao-32 -Fo/usr/lib32 -Fl/usr/lib32" So Adrian, I've got a question. Looking at fixing this in the right way, the linker search paths at least. What's the right directory to search for libs and objects in

Re: [fpc-devel] Porting fpc to linux-sparc64

2017-05-29 Thread John Paul Adrian Glaubitz
On Mon, May 29, 2017 at 05:55:46PM +0200, Karoly Balogh (Charlie/SGR) wrote: > From what I can see, binutils 2.9.1, released 1/5/1998 (19+ years ago) > already has it for SPARC (according to the man page). :) But binutils > 2.8.1 from 20 years ago, still didn't. So it was added between those >

Re: [fpc-devel] Porting fpc to linux-sparc64

2017-05-29 Thread Karoly Balogh (Charlie/SGR)
Hi, On Mon, 29 May 2017, John Paul Adrian Glaubitz wrote: > > However, it should probably not be merged to fixes, because it may be a > > breaking change for older Sparc/Linux versions (see my previous e-mail; > > note that the situation with MIPS was probably different, because the > > support

Re: [fpc-devel] Porting fpc to linux-sparc64

2017-05-29 Thread Tomas Hajny
On Mon, May 29, 2017 17:35, John Paul Adrian Glaubitz wrote: > On Mon, May 29, 2017 at 05:11:52PM +0200, Karoly Balogh (Charlie/SGR) > wrote: . . >> Now, if you want to patch the compiler for this, or simply wire >> additional options to the package supplied fpc.cfg with the right >> paths and

Re: [fpc-devel] Porting fpc to linux-sparc64

2017-05-29 Thread John Paul Adrian Glaubitz
On Mon, May 29, 2017 at 05:35:37PM +0200, Tomas Hajny wrote: > However, it should probably not be merged to fixes, because it may be a > breaking change for older Sparc/Linux versions (see my previous e-mail; > note that the situation with MIPS was probably different, because the > support of that

Re: [fpc-devel] Porting fpc to linux-sparc64

2017-05-29 Thread Tomas Hajny
On Mon, May 29, 2017 17:28, Karoly Balogh (Charlie/SGR) wrote: > Hi, > > On Mon, 29 May 2017, Karoly Balogh (Charlie/SGR) wrote: > >> Like this: >> >> make all ASTARGET=-32 OPT="-ao-32 -Fo/usr/lib32 -Fl/usr/lib32" >> >> This builds current 3.1.1 SVN with the preinstalled 3.0.2 package on the >>

Re: [fpc-devel] Porting fpc to linux-sparc64

2017-05-29 Thread John Paul Adrian Glaubitz
On Mon, May 29, 2017 at 05:11:52PM +0200, Karoly Balogh (Charlie/SGR) wrote: > Err, sorry, there's a typo in the previous line I've sent. here's the > correct one. Also, ASTARGET= override seems to work, so you don't need to > patch the sources, you can fix it during build with options. > > Like

Re: [fpc-devel] Porting fpc to linux-sparc64

2017-05-29 Thread Tomas Hajny
On Mon, May 29, 2017 17:17, Karoly Balogh (Charlie/SGR) wrote: > On Mon, 29 May 2017, John Paul Adrian Glaubitz wrote: Hi, . . >> Well, all the -32 options should definitely go into trunk. Upstream >> doesn't support anything but 32 bits for SPARC anyway and after >> looking at the

Re: [fpc-devel] Porting fpc to linux-sparc64

2017-05-29 Thread Karoly Balogh (Charlie/SGR)
Hi, On Mon, 29 May 2017, Karoly Balogh (Charlie/SGR) wrote: > Like this: > > make all ASTARGET=-32 OPT="-ao-32 -Fo/usr/lib32 -Fl/usr/lib32" > > This builds current 3.1.1 SVN with the preinstalled 3.0.2 package on the > Debian SPARC64 box without patching anything. Just for the record, the same

Re: [fpc-devel] Porting fpc to linux-sparc64

2017-05-29 Thread Karoly Balogh (Charlie/SGR)
Hi, On Mon, 29 May 2017, John Paul Adrian Glaubitz wrote: > > Can you try if you can reproduce this? > > Sure. Can you put the cross-compiled ppcsparc somewhere so I can find > and use it? You don't need one. :) See my other mail. Although I did crosscompile a new bootstrap compiler, in the end

Re: [fpc-devel] Porting fpc to linux-sparc64

2017-05-29 Thread Karoly Balogh (Charlie/SGR)
Hi, On Mon, 29 May 2017, Karoly Balogh (Charlie/SGR) wrote: > Plus you need to fix the Makefile.fpc in rtl/linux to include -32 for > SPARC, and regenerate it using fpcmake -Tall. Then everything works. Maybe > it's also possible to just add ASTARGET=-32 into the make command line, > without

Re: [fpc-devel] Porting fpc to linux-sparc64

2017-05-29 Thread John Paul Adrian Glaubitz
On Mon, May 29, 2017 at 04:59:16PM +0200, Karoly Balogh (Charlie/SGR) wrote: > Did a last attempt, and bingo. :) Awesome \o/. > make all OPTS="-ao-32 -Fo/usr/lib32 -Fl/usr/lib32" > > Then everything builds, including the FP IDE, and all tools as expected. > > Plus you need to fix the

Re: [fpc-devel] Porting fpc to linux-sparc64

2017-05-29 Thread Karoly Balogh (Charlie/SGR)
Hi, On Mon, 29 May 2017, Karoly Balogh (Charlie/SGR) wrote: > > However, these also seem to be installed in /usr/lib32... So build running > > now, lets see what happens. > > Different error: ... :/ I would gladly keep working on this, but I kinda > ran out of time for now, I can take a deeper

Re: [fpc-devel] Porting fpc to linux-sparc64

2017-05-29 Thread Karoly Balogh (Charlie/SGR)
Hi, On Mon, 29 May 2017, Karoly Balogh (Charlie/SGR) wrote: > However, these also seem to be installed in /usr/lib32... So build running > now, lets see what happens. Different error: ... :/ I would gladly keep working on this, but I kinda ran out of time for now, I can take a deeper look maybe

Re: [fpc-devel] Porting fpc to linux-sparc64

2017-05-29 Thread Karoly Balogh (Charlie/SGR)
Hi, On Mon, 29 May 2017, John Paul Adrian Glaubitz wrote: > Make sure to pass -L/lib32 to the linker because that's where libc6-sparc > gets installed into: > > root@deb4g:~# dpkg -L libc6-sparc |head > /. > /etc > /etc/ld.so.conf.d > /etc/ld.so.conf.d/zz_sparc-biarch-compat.conf > /lib > /lib32

Re: [fpc-devel] Porting fpc to linux-sparc64

2017-05-29 Thread John Paul Adrian Glaubitz
On Mon, May 29, 2017 at 04:04:00PM +0200, Karoly Balogh (Charlie/SGR) wrote: > > I'll just install that, second. > > Oh, ok. Nice. :) I'll wait then. libc6-sparc was already installed: root@deb4g:~# apt show libc6-sparc Package: libc6-sparc Version: 2.24-10 Priority: optional Section: libs

Re: [fpc-devel] Porting fpc to linux-sparc64

2017-05-29 Thread Karoly Balogh (Charlie/SGR)
Hi, On Mon, 29 May 2017, John Paul Adrian Glaubitz wrote: > > Which is because the buildbox doesn't have these 32bit libraries > > installed, so FPC obviously cannot link against them. This is because the > > very limited multiarch you mentioned before I guess. Now, FPC doesn't need > > Libc on

Re: [fpc-devel] Porting fpc to linux-sparc64

2017-05-29 Thread Karoly Balogh (Charlie/SGR)
Hi, On Mon, 29 May 2017, Karoly Balogh (Charlie/SGR) wrote: > Which is because the buildbox doesn't have these 32bit libraries > installed, so FPC obviously cannot link against them. This is because the > very limited multiarch you mentioned before I guess. Now, FPC doesn't need > Libc on linux

Re: [fpc-devel] Porting fpc to linux-sparc64

2017-05-29 Thread John Paul Adrian Glaubitz
On Mon, May 29, 2017 at 03:59:37PM +0200, Karoly Balogh (Charlie/SGR) wrote: > Obviously, the startup compiler doesn't have the -32 fix, so this is why > it failed for you, but this option inject this option externally. Ok, I'm an idiot. I completely forgot about fixing the stage0 compiler ... >

Re: [fpc-devel] Porting fpc to linux-sparc64

2017-05-29 Thread Karoly Balogh (Charlie/SGR)
Hi, On Mon, 29 May 2017, John Paul Adrian Glaubitz wrote: > In the end, I want to build the Debian package. So, the patches have > to apply against that version. Well. I applied a 1 line patch against rtl/linux/Makefile.fpc, to append -32 when it builds the startup code, regenerated the

Re: [fpc-devel] Porting fpc to linux-sparc64

2017-05-29 Thread John Paul Adrian Glaubitz
On 05/29/2017 03:20 PM, Karoly Balogh (Charlie/SGR) wrote: > I'm also sitting in Berlin, so we're having different delusions from the > heat then... :) BTW, I sent you a pubkey. But I'm in the south-west of Berlin. Much hotter here :D. I'll create you an account in a minute. > It's easy to test

Re: [fpc-devel] Porting fpc to linux-sparc64

2017-05-29 Thread Karoly Balogh (Charlie/SGR)
Hi, On Mon, 29 May 2017, John Paul Adrian Glaubitz wrote: > On Mon, May 29, 2017 at 02:57:51PM +0200, Karoly Balogh (Charlie/SGR) wrote: > > Indeed, this worked. Also, not sure what Adrian was doing wrong, but I > > added -32 into sparc/cpugas.pas file as I said, and from then on I started > >

Re: [fpc-devel] Porting fpc to linux-sparc64

2017-05-29 Thread John Paul Adrian Glaubitz
On Mon, May 29, 2017 at 02:57:51PM +0200, Karoly Balogh (Charlie/SGR) wrote: > Indeed, this worked. Also, not sure what Adrian was doing wrong, but I > added -32 into sparc/cpugas.pas file as I said, and from then on I started > getting 32 bit object files, and after fixing the Makefile, I got a

Re: [fpc-devel] Porting fpc to linux-sparc64

2017-05-29 Thread Karoly Balogh (Charlie/SGR)
Hi, On Mon, 29 May 2017, Tomas Hajny wrote: > > It is, but it's *pregenerated*, and committed to the SVN. The build > > process doesn't generate any Makefiles, actually. (Lets not argue now it > > is a nice practice or not, it is what it is...) To fix this, one has to > > regenerate them. But

Re: [fpc-devel] Porting fpc to linux-sparc64

2017-05-29 Thread Tomas Hajny
On Mon, May 29, 2017 14:35, Karoly Balogh (Charlie/SGR) wrote: . . > It is, but it's *pregenerated*, and committed to the SVN. The build > process doesn't generate any Makefiles, actually. (Lets not argue now it > is a nice practice or not, it is what it is...) To fix this, one has to >

Re: [fpc-devel] Porting fpc to linux-sparc64

2017-05-29 Thread John Paul Adrian Glaubitz
On Mon, May 29, 2017 at 02:35:28PM +0200, Karoly Balogh (Charlie/SGR) wrote: > > But isn't the Makefile generated from fpcmake? :-O > > It is, but it's *pregenerated*, and committed to the SVN. The build > process doesn't generate any Makefiles, actually. (Lets not argue now it > is a nice

Re: [fpc-devel] Porting fpc to linux-sparc64

2017-05-29 Thread Karoly Balogh (Charlie/SGR)
Hi, On Mon, 29 May 2017, John Paul Adrian Glaubitz wrote: > On Mon, May 29, 2017 at 02:25:34PM +0200, Karoly Balogh (Charlie/SGR) wrote: > > > > Even passing "-Av8plus" does not help. So, the options from > > > > compiler/sparc/cpugas.pas are definitely not passed to the assembler. > > > > I'm

Re: [fpc-devel] Porting fpc to linux-sparc64

2017-05-29 Thread Tomas Hajny
On Mon, May 29, 2017 14:29, John Paul Adrian Glaubitz wrote: . . >> > From the build log: >> > >> > as -o /root/fpc/fpc-3.0.0+dfsg/fpcsrc/rtl/units/sparc-linux/prt0.o >> sparc/prt0.as >> > as -o >> /root/fpc/fpc-3.0.0+dfsg/fpcsrc/rtl/units/sparc-linux/dllprt0.o >> sparc/dllprt0.as >> > as -o

Re: [fpc-devel] Porting fpc to linux-sparc64

2017-05-29 Thread John Paul Adrian Glaubitz
On Mon, May 29, 2017 at 02:31:05PM +0200, Tomas Hajny wrote: > Are you sure that you rebuilt the compiler completely after your change > and that you invoked the right (newly built) version while testing the > performed change? Do you call 'fpc', or 'ppcsparc' while testing it (the > former may

Re: [fpc-devel] Porting fpc to linux-sparc64

2017-05-29 Thread Tomas Hajny
On Mon, May 29, 2017 14:14, John Paul Adrian Glaubitz wrote: > On Mon, May 29, 2017 at 01:09:05PM +0200, John Paul Adrian Glaubitz wrote: >> I tried adding "-32" like this: > > Even passing "-Av8plus" does not help. So, the options from > compiler/sparc/cpugas.pas are definitely not passed to the

Re: [fpc-devel] Porting fpc to linux-sparc64

2017-05-29 Thread John Paul Adrian Glaubitz
On Mon, May 29, 2017 at 02:25:34PM +0200, Karoly Balogh (Charlie/SGR) wrote: > > > Even passing "-Av8plus" does not help. So, the options from > > > compiler/sparc/cpugas.pas are definitely not passed to the assembler. > > I'm looking into it now. Stay tuned. I managed to reproduce your linker >

Re: [fpc-devel] Porting fpc to linux-sparc64

2017-05-29 Thread Karoly Balogh (Charlie/SGR)
Hi, On Mon, 29 May 2017, John Paul Adrian Glaubitz wrote: > On Mon, May 29, 2017 at 02:14:26PM +0200, John Paul Adrian Glaubitz wrote: > > On Mon, May 29, 2017 at 01:09:05PM +0200, John Paul Adrian Glaubitz wrote: > > > I tried adding "-32" like this: > > > > Even passing "-Av8plus" does not

Re: [fpc-devel] Porting fpc to linux-sparc64

2017-05-29 Thread John Paul Adrian Glaubitz
On Mon, May 29, 2017 at 02:14:26PM +0200, John Paul Adrian Glaubitz wrote: > On Mon, May 29, 2017 at 01:09:05PM +0200, John Paul Adrian Glaubitz wrote: > > I tried adding "-32" like this: > > Even passing "-Av8plus" does not help. So, the options from > compiler/sparc/cpugas.pas are definitely

Re: [fpc-devel] Porting fpc to linux-sparc64

2017-05-29 Thread John Paul Adrian Glaubitz
On Mon, May 29, 2017 at 01:09:05PM +0200, John Paul Adrian Glaubitz wrote: > I tried adding "-32" like this: Even passing "-Av8plus" does not help. So, the options from compiler/sparc/cpugas.pas are definitely not passed to the assembler. Adrian -- .''`. John Paul Adrian Glaubitz : :' :

Re: [fpc-devel] Porting fpc to linux-sparc64

2017-05-29 Thread Mark Morgan Lloyd
On 29/05/17 11:12, Karoly Balogh (Charlie/SGR) wrote: Hi, On Mon, 29 May 2017, Mark Morgan Lloyd wrote: My recollection is that the SPARC64 code generator is immature,> hopefully Jonas will comment on that. Not sure what "immature" means, granted, I don't know anything aboutSPARC, but from

Re: [fpc-devel] Porting fpc to linux-sparc64

2017-05-29 Thread John Paul Adrian Glaubitz
On Mon, May 29, 2017 at 12:46:57PM +0200, John Paul Adrian Glaubitz wrote: > On Mon, May 29, 2017 at 11:53:26AM +0200, Karoly Balogh (Charlie/SGR) wrote: > > > Running the file utility on one of the object files shows that the > > > assembler did not generate 32-bit code. So, at least a hotfix

Re: [fpc-devel] Porting fpc to linux-sparc64

2017-05-29 Thread Karoly Balogh (Charlie/SGR)
Hi, On Mon, 29 May 2017, Mark Morgan Lloyd wrote: > My recollection is that the SPARC64 code generator is immature, > hopefully Jonas will comment on that. Not sure what "immature" means, granted, I don't know anything about SPARC, but from what I see, FPC definitely handles SPARC as a 32bit

Re: [fpc-devel] Porting fpc to linux-sparc64

2017-05-29 Thread John Paul Adrian Glaubitz
On Mon, May 29, 2017 at 11:53:26AM +0200, Karoly Balogh (Charlie/SGR) wrote: > > Running the file utility on one of the object files shows that the > > assembler did not generate 32-bit code. So, at least a hotfix here > > would be to pass "-m32" to the assembler. > > That is easy to add, see in

Re: [fpc-devel] Porting fpc to linux-sparc64

2017-05-29 Thread John Paul Adrian Glaubitz
On Mon, May 29, 2017 at 08:45:32AM +, Mark Morgan Lloyd wrote: > The important thing to know about the linker on 32-bit Solaris is the -Xn > option to force the native one to be used. Apart from that more info is > needed before anybody here can comment. Looking at

Re: [fpc-devel] Porting fpc to linux-sparc64

2017-05-29 Thread Karoly Balogh (Charlie/SGR)
Hi, On Mon, 29 May 2017, John Paul Adrian Glaubitz wrote: > Running the file utility on one of the object files shows that the > assembler did not generate 32-bit code. So, at least a hotfix here > would be to pass "-m32" to the assembler. That is easy to add, see in compiler/sparc/cpugas.pas,

Re: [fpc-devel] Porting fpc to linux-sparc64

2017-05-29 Thread John Paul Adrian Glaubitz
On Mon, May 29, 2017 at 10:37:42AM +0200, John Paul Adrian Glaubitz wrote: > > 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/

Re: [fpc-devel] Porting fpc to linux-sparc64

2017-05-29 Thread Mark Morgan Lloyd
On 29/05/17 08:15, Karoly Balogh (Charlie/SGR) wrote: Hi, On Sun, 28 May 2017, John Paul Adrian Glaubitz 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

Re: [fpc-devel] Porting fpc to linux-sparc64

2017-05-29 Thread John Paul Adrian Glaubitz
Hi! 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

Re: [fpc-devel] Porting fpc to linux-sparc64

2017-05-29 Thread Karoly Balogh (Charlie/SGR)
Hi, On Sun, 28 May 2017, John Paul Adrian Glaubitz 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 >