Open rasky opened 6 years ago
the right place to look at gccgo is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46986 - AFAIR the compiler, itself, builds but we do not have complete runtime support. It is, sadly, quite far down my list of priorities.
no change, we are totally resource-limited and AFAIK there has been no new work done on supporting go on Darwin/macOS.
For my application; it was for Synology rather than a Mac
For my application; it was for Synology rather than a Mac
Didn’t know Synology uses ppc. Anyway, to a certain extent implementation for MacOS and Linux will be overlapping, though the former gonna require more, for obvious reasons.
Didn’t know Synology uses ppc.
It had, but migrated to Intel a few years ago.
Maybe implementing a Darwin-PowerPC backend could be a Google Summer of Code project.
the right place to look at gccgo is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46986 - AFAIR the compiler, itself, builds but we do not have complete runtime support. It is, sadly, quite far down my list of priorities.
@iains Do you know if that will be sufficient to bootstrap Go
itself via gccgo
?
That was used on AIX, apparently:
We are porting golang to AIX. We used our port of GCC 8.1 Go to AIX for bootstrapping and we used the work done by IBM Linux/Power about the Go assembler for PPC64 machines. So, you need a Go compiler for bootstrapping. Either GCC Go, or an old golang written in C (v1.4 if I'm correct).
the right place to look at gccgo is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46986 - AFAIR the compiler, itself, builds but we do not have complete runtime support. It is, sadly, quite far down my list of priorities.
@iains Do you know if that will be sufficient to bootstrap
Go
itself viagccgo
?
Sorry, I have no idea - stretched way too thin at the moment - I have not tried go since maybe GCC-7 .. .. but I would be surprised if the compiler could build something without its runtime?
That was used on AIX, apparently:
We are porting golang to AIX. We used our port of GCC 8.1 Go to AIX for bootstrapping and we used the work done by IBM Linux/Power about the Go assembler for PPC64 machines. So, you need a Go compiler for bootstrapping. Either GCC Go, or an old golang written in C (v1.4 if I'm correct).
fyi, gccgo does work for non-Darwin ppc32. I’ve only tested a fork of gccgo that targeted VxWorks, however.
fyi, gccgo does work for non-Darwin ppc32. I’ve only tested a fork of gccgo that targeted VxWorks, however.
@ericlagergren So it is not in GCC upstream, you mean? Could you please refer to the fork in question? (This won’s be sufficient for macOS, but it may be helpful.)
fyi, gccgo does work for non-Darwin ppc32. I’ve only tested a fork of gccgo that targeted VxWorks, however.
@ericlagergren So it is not in GCC upstream, you mean? Could you please refer to the fork in question? (This won’s be sufficient for macOS, but it may be helpful.)
Correct. The isn't currently public, sorry. Most of the work was adding or working around APIs that don't exist on VxWorks 6. For example, VxWorks 6 doesn't have pread/pwrite or getcontext/setcontext. I also had to implement the atomic APIs, too.
I'll post on this thread if/when we (my work) ever release the source code.
fyi, gccgo does work for non-Darwin ppc32. I’ve only tested a fork of gccgo that targeted VxWorks, however.
@ericlagergren So it is not in GCC upstream, you mean? Could you please refer to the fork in question? (This won’s be sufficient for macOS, but it may be helpful.)
Correct. The isn't currently public, sorry. Most of the work was adding or working around APIs that don't exist on VxWorks 6. For example, VxWorks 6 doesn't have pread/pwrite or getcontext/setcontext. I also had to implement the atomic APIs, too.
I'll post on this thread if/when we (my work) ever release the source code.
@ericlagergren Got it, thank you.
On a side note, did you work only on gccgo
or some other components of GCC? I think IEEE arithmetic fix for gfortran
on VxWorks, for example, while been discussed in gcc mailing list time ago, had never been merged.
I think Ian was pretty clear about what areas needed work for Darwin (not just PowerPC - but all Darwin). Big Endian powerpc64-linux (with a 32b multilib) also has working go/libgo - so there is another example to work from.
fyi, gccgo does work for non-Darwin ppc32. I’ve only tested a fork of gccgo that targeted VxWorks, however.
@ericlagergren So it is not in GCC upstream, you mean? Could you please refer to the fork in question? (This won’s be sufficient for macOS, but it may be helpful.)
Correct. The isn't currently public, sorry. Most of the work was adding or working around APIs that don't exist on VxWorks 6. For example, VxWorks 6 doesn't have pread/pwrite or getcontext/setcontext. I also had to implement the atomic APIs, too.
I'll post on this thread if/when we (my work) ever release the source code.
@ericlagergren Got it, thank you.
On a side note, did you work only on
gccgo
or some other components of GCC? I think IEEE arithmetic fix forgfortran
on VxWorks, for example, while been discussed in gcc mailing list time ago, had never been merged.
Only gccgo and libbacktrace. We actually didn't need libbacktrace, but it was easier to get it to compile than it was to make gccgo not use it. We enabled software floats for some reason, I don't remember why. We were targeting an e500 core btw.
Just checked back here, so essentially, yall are saying that if 1.4 could build, modern Go could be bootstrapped for PPC? I'm specifically concerned about PPC32 Linux here, I don't have Mac hardware to test this on.
1.4 (the last one to bootstrap from C) lacks support for ppc: not just in a build system (which would be an easy fix) but also in sources; fixing the latter requires writing some stuff from scratch. And well, while that may be feasible, nobody has time.
I would be willing to chuck some hours at this if there's a chance it could acutally get up-to-date Go working on PowerPC Linux (primarily, my target is the PPC750CL in the Nintendo Wii, as I am one of the lead developers of the Wii-Linux project, but I'll try to get it working for all 32-bit PPC regardless).
If I were to get 1.4 building properly, someone else would need to figure out how to use it to get modern Go boostrapping with it, as I don't have unlimited time unfortunately.
I'll post an update here if I'm successful.
I would say that, since gcc-go already works on PPC32, you don't have to start with 1.4. Adding support to mainline Go could probably be in anything that gcc-go could bootstrap.
I don't entirely understand the bootstrapping issue. Just build a recent Go on amd64/linux and cross-compile a toolchain from there. There's no need to bootstrap completely from ancient Go versions on the platform itself. Gory details: https://go.dev/blog/rebuild
Just build a recent Go on amd64/linux and cross-compile a toolchain from there.
Some platforms (OpenBSD/macppc comes to mind) might want to bootstrap the whole thing from the base system without cross-compiling, but I agree, that's probably the easiest way.
So that sounds that it might be possible to have a Go Version for darwin/ppc32 and darwin/ppc64 right now?
So that sounds that it might be possible to have a Go Version for darwin/ppc32 and darwin/ppc64 right now?
Unfortunately I don't believe gcc-go supports the Mac OS, at least not versions of that age. It does however support Linux on these systems.
Mainline Go should work on G5 machines running Linux, too, but doesn't because of #19074. I still believe this was a mistake to merge, it still impedes my work on G5s and Power6/Power7 systems (including trying to make Docker run on them), and it still makes me frustrated, but what are you going to do…
Mainline Go dosnt work on G5 since (Go 1.9) quite some time...
So that sounds that it might be possible to have a Go Version for darwin/ppc32 and darwin/ppc64 right now?
Well, in practice current versions of Go will not build even on Intel, and somewhat earlier versions which can be built do not work :( This is quite unfortunate, given that this is a useful compiler and it would not take much to maintain fallbacks for older systems, but that was not done. The last ppc-capable system is 10.6, and Go does not build there.
I have fixed Go 1.11.13 for 10.6 i386 in https://github.com/macports/macports-ports/commit/0435fe55210208e7d4f4ec6b4954a7d746a1a971 – however when I tried to build a few dependents, it is either too old or just does not work. It is also broken on x86_64 for older macOS.
Unfortunately I don't believe gcc-go supports the Mac OS, at least not versions of that age.
It does not work on any macOS, as of now: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46986
The last ppc-capable system is 10.6, and Go does not build there.
This is not accurate. The last PPC capable system is 10.5 (Leopard). There are some beta builds of 10.6 for PPC, but no released version. There is a community effort called Sorbet Leopard to make more bits of it work, but I wouldn't call it official at all. If you want real Darwin PPC support, you'd need to support 10.5 at least. Note also that many systems were dropped with 10.5, including all G3 and a wide swath of G4, so you really would want to target 10.4 for maximal compatibility.
Mainline Go dosnt work on G5 since (Go 1.9) quite some time...
@yhaenggi Do you know whether it was a policy to break it or just accidental breakage? macOS aside, OpenBSD/FreeBSD/NetBSD support PowerPC systems back to G4, and it would be nice to have Go working there.
Mainline Go dosnt work on G5 since (Go 1.9) quite some time...
@yhaenggi Do you know whether it was a policy to break it or just accidental breakage? macOS aside, OpenBSD/FreeBSD/NetBSD support PowerPC systems back to G4, and it would be nice to have Go working there.
As I linked above, #19074 made it policy, but it's one I would be willing to help overturn if such a thing exists in the Go community. I would be more than happy to put the work in to make it work on down level ISA versions again, provide CI, and whatever else needed.
The last ppc-capable system is 10.6, and Go does not build there.
This is not accurate. The last PPC capable system is 10.5 (Leopard). There are some beta builds of 10.6 for PPC, but no released version.
@awilfox Well, first of all 10.6.8 is ppc-capable. It does not boot on PowerPC, but it can build and run ppc
binaries.
Then, here is 10.6 on PowerPC, running natively:
There is a community effort called Sorbet Leopard to make more bits of it work, but I wouldn't call it official at all.
That is just 10.5.8 with a few tweaks, not on a system level. For all practical purposes it is 10.5.8.
If you want real Darwin PPC support, you'd need to support 10.5 at least. Note also that many systems were dropped with 10.5, including all G3 and a wide swath of G4, so you really would want to target 10.4 for maximal compatibility.
Aside from some archaic G4, later ones run 10.5 and 10.6 with no issues. I do not think it is a realistic concern to support G3 and super-old G4, they are too slow for anything. 10.4 is a problematic system with much of stuff broken. It is very different from 10.5–10.6.
@awilfox Well, first of all 10.6.8 is ppc-capable. It does not boot on PowerPC, but it can build and run
ppc
binaries.
Building PPC binaries is not that big of a deal; you can do that on any Mac running Big Sur or earlier with Xcode 12 and XcodeLegacy.
Then, here is 10.6 on PowerPC, running natively:
This is 10A190, which is a beta build. Yes, you can get it to work, but it is not entirely stable and has bugs that are even fixed in 10.5.8 (10.5.8 is newer than 10.6 final, let alone a WWDC build). I just don't think 10.6/ppc is a useful target for a compiler. You would literally be having users install a private beta OS that was never meant for public consumption.
If you want real Darwin PPC support, you'd need to support 10.5 at least. Note also that many systems were dropped with 10.5, including all G3 and a wide swath of G4, so you really would want to target 10.4 for maximal compatibility.
Aside from some archaic G4, later ones run 10.5 and 10.6 with no issues. I do not think it is a realistic concern to support G3 and super-old G4, they are too slow for anything. 10.4 is a problematic system with much of stuff broken. It is very different from 10.5–10.6.
Any G4 < 867 MHz will not run Leopard without hacks. My G3 runs gitlab-runner fine with gcc-go, and it would run it fine with mainline Go if it had a ppc32 backend. 🤷‍♀️
10.5 is old enough that it doesn't have the *64 APIs (open64, readdir64, etc), as a single omission that comes directly to my mind. I'm not sure what APIs Go uses internally, but I'm pretty sure porting it backwards to 10.5 would be a lot more work than the work to go the bit further to make it work on 10.4 as well. I will admit I don't know that for certain.
As an aside, I don't think it is particularly useful to discuss a theoretical Darwin port for ppc32. It will be hard enough convincing upstream to accept ppc32 at all, so can we at least focus on operating systems that have existed in the last decade as a bare minimum to even see if this is viable?
so can we at least focus on operating systems
Let's not dictate how people spend https://gist.github.com/cellularmitosis/2def88bdf2b772a8635e6a2972fac9c7 their free time https://github.com/cellularmitosis/leopard.sh. Sergey has contributed an incredible amount of effort to supporting all kinds of software on Darwin/PPC.
This thread is the only space on the internet for discussing the pipedream of a Darwin/PPC Golang. Please do not silence it.
On Wed, Mar 20, 2024 at 5:21 PM A. Wilcox @.***> wrote:
As an aside, I don't think it is particularly useful to discuss a theoretical Darwin port for ppc32. It will be hard enough convincing upstream to accept ppc32 at all, so can we at least focus on operating systems that have existed in the last decade as a bare minimum to even see if this is viable?
— Reply to this email directly, view it on GitHub https://github.com/golang/go/issues/22885#issuecomment-2010749925, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABWRJHTQJ7FKPZB72KVKTDYZIDXPAVCNFSM4EFNHA5KU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMBRGA3TIOJZGI2Q . You are receiving this because you commented.Message ID: @.***>
I don't think it is particularly useful to discuss a theoretical Darwin port for ppc32
@awilfox While ppc ABI of Darwin is not identical to BSD or Linux, it is perhaps a secondary problem, which we could realistically deal with on our end, provided some ppc works and provided x86 Go works on 10.6. (10.5 is not hugely different; perhaps one issue which will matter is a lack of GCD, so mach semaphores are to be used instead.)
For my 0.02GBP (noting that I will keep testing/supporting ppc 10.5 until the hardware is no longer working)
Actually, I would expect that most of the work would be in supporting Darwin (generically) and Mach-O (generically).
Certainly, there is some run-time architecture-specific stuff applicable to each language (but even then, I often find that 10.5 i686 has similar constraints to 10.5 ppc).
If you have a faster machine with a more modern version of the OS, it can be quite a bit quicker to work on that and then back port to the earlier OS (I tend to use Darwin17 [because it supports 32b] on an oldish but still quite capable xeon box)
Tracking bug for missing PowerPC 32-bit backend. People interested in this can put a đź‘Ť reaction here so that we can track interest.