Hello and welvome
Just a word of warning, GSoC 2023 has not been announced yet, and we don’t know if Google will do it and if they will again accept Haiku as a mentoring organization. It is likely that will be the case, but not certain. That being said, it’s a good idea to start early so that you can make most of the coding period when it happens.
Maybe surprisingly for this project, you may not need to know that much about how a compiler works, besides the basic idea: it takes sourcecode, parses it, and convert it into executable code.
The executable code depends largely on the processor, and that does not change if you replace the operating system. So that part does not need a lot of changes.
What needs work is making sure the Go programs can call functions from the operating system. If I remember correctly from the previous porting attempts, the idea then was that Go for Linux would call directly into the kernel using “system calls”. However, in Haiku, the interface between applications and the kernel is not stable, and we do not recommend using it directly in this way. Instead we expect applicaitons (including those written in Go) will only call into the C standard library (functions you probably already know if you written a C program: open, read, write, malloc, etc).
So that’s where a part of the work is: investigating if that is possible for the Go compiler, how it works on other systems currently (do they still call the kernel directly on Linux? or did they change that? what about their support for other operating systems?)
Also you may have to learn about cross compilation and if it’s needed to setup Go for that. We already have a very old port of Go. At the time, the Go compiler itself was written in C. Now it’s written in Go. So it may be a problem to build it starting from “nothing”. You have basically two options:
- Start from an older version or a kind of limited mini-compiler, and build newer/larger versions until you have the whole Go compiler able to build itself,
- Start the work by making a cross-compiler, that runs on Linux but creates Haiku executables
Are these two solutions supported by the current Go compiler? Or only one of them? Which route did the existing porting efforts (in the thread linked by MashiJams) try to take, and how far they went?