Recently, I’ve been quite pissed off with the dumb errors related to the legacy GCC 2.95 codebase and the hacks required to make it building again.
And then I wonder, what if, we can plug in a GCC2 ABI backend to a modern codebase? And as a bonus, a modern frontend with all the latest C++11 language features and beyond?
After a weekend of pointing AI agents at llvm/llvm-project, I now have a copy of clang that can generate simple “Hello World” binaries that can link with GCC 2.95 objects. There is primitive support for mangling, RTTI, vtables, DWARF2 exception handling, and runtime functions. I’m still continuing to loop that agent and try to fuzz for ABI mismatches - every invocation it seems to find something, but the problems are getting less and less serious.
I’m currently testing with i386-linux-gnu, using the custom flag -fc++-abi=gcc2. The ABI is not configured to be limited to any target, so theoretically, if pointed to the correct includes, libraries, and start files, this may work for x86_gcc2 Haiku.
Below is the link to the branch if you want to try. Be creative and throw in some of your weirdest C++98 code imaginable! Please let me know if you find any ABI bugs, it will help my agent a lot!
CW: AI Slop.
The branch is currently 100% generated by AI. There may be egregious hacks that have not been cleaned up.
This branch is by no means ready for upstreaming, either to HaikuPorts or to llvm-project.
If you are anti-AI, you should also refrain from reading this code.
This discussion is not meant to be a debate on AI tools. Please keep the thread on-topic about the GCC2 ABI only.
CW: This code is not suitable for newbies or those who are easily disturbed.
If you cannot fix compilation errors without asking ChatGPT, this project is not for you.
