-
-
Notifications
You must be signed in to change notification settings - Fork 477
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Keeping DEC Alpha support is difficult because there are no Alpha machines available for toolchain developers, and even if there were, no modern Linux distros still support Alpha. For example, Debian dropped Alpha support in Debian 6.0. As a result, I cannot test my linker with real-world programs. In fact, I believe mold has never been able to link real-world large programs. Object files for Alpha are compiled with the small code model by default, so it is not easy to support it in the linker. There's no means to verify that my implementation is correct for Alpha because Alpha's psABI has never been published by DEC. The most "reliable" source of correctness is GNU ld's source code and comments. Last but not least, I believe there are literally zero mold/Alpha users. Unlike some other retro computers like the m68k, Alpha doesn't seem to get much love from the community, perhaps because the availability of Alpha machines was limited in the first place, even in the 90s. Therefore, I'll remove Alpha support now. If there's someone who wants to keep it, we can resurrect and re-test it. This change should make the mold binary size a little smaller.
- Loading branch information
Showing
20 changed files
with
9 additions
and
531 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
3711ddb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there anything we can do to get Alpha back? Alpha is still supported in Debian Ports and Gentoo.
CC @thesamesam @mattst88
3711ddb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is lack of testing environment, so if there's a VM image of some Linux/Alpha distro which I can easily boot with qemu-system, I may be able to bring it back. If that happens, I also want to run that VM image on GitHub Actions so that I'll get a notification if something breaks the Alpha port. Note that the distro needs to be modern enough to compile programs written in C++20.
3711ddb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can just install Debian unstable which contains the latest version of GCC in QEMU:
After installation has finished, you need to extract both the kernel and initrd of the installed system and boot the system with:
3711ddb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The last command to install Debian (
qemu-system-alpha
) doesn't show anything. Is this expected? It looks like it is doing something, as the process uses a core 100%.3711ddb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, please drop
-serial none
from the command line.3711ddb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@matoro also provides access to running systems running up-to-date Gentoo for Alpha and other arches: https://static.matoro.tk/isa-sandbox-faq.html.
3711ddb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that Alpha support on Mold is never keyworded in Gentoo (at least on the currently available versions).
3711ddb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was never keyworded because it never worked. I've already provided access to the hardware and shared specific steps for reproducing the failure, but didn't get any response: #1166
3711ddb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I set up an Alpha VM with qemu-system-alpha and tried to build mold inside it. Unfortunately, the build failed due to a "corrupted size vs. prev_size" error which was reported by GNU ld. It seems even GNU ld doesn't work correctly on Alpha. Is this expected?
3711ddb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's an error from glibc, not from GNU ld. It indicates that there's some inconsistency in memory state, so nothing is reliable from that point forward. I do know that on real hardware I did observe memory corruption unless
CONFIG_COMPACTION
was disabled in my kernel, but I don't know if that would be an issue on QEMU.In the meantime, that specific issue may be reproducible with a cross toolchain. I'll try it out and see.
3711ddb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's odd. We're not seeing this issue on Debian on the buildds where the last 12 or so releases built fine:
Even the testsuite passes 100%:
3711ddb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like GNU ld fails if I try to build mold with
-DCMAKE_BUILD_TYPE=Debug
. Release build builds fine.3711ddb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't that be enough for the time being?
3711ddb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If GNU binutils are so broken that GNU ld cannot build mold for the release build, it's a signal that the entire ecosystem has rotted to the extent that it doesn't make much sense to try to port new software to it. If Alpha community is serious enough to sustain their ecosystem, they need to fix the toolchain so that developers can trust the tools.
GNU ld's issue also means a lot to mold because the GNU ld's source code is the psABI spec for Alpha because DEC has never published Alpha processor-specific ABI.
3711ddb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But we're building the whole Debian software stack for Alpha, including mold, see:
I will try to reproduce the issue with mold and report the issue upstream. I don't think the »entire ecosystem« is broken just because a single package doesn't build. I find this criticism quite harsh.
The generic Unix documentation won't help?
3711ddb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, I have to say that the situation for Alpha is definitely worse than MIPS which we ended up giving up supporting. On MIPS, at least all existing tools worked as expected for me. On the other hand, mold is the only program I tried to build myself so far for Alpha so far, and that didn't built correctly with debug info.
Unfortunately, no. Calling convention spec is different from a processor-specific ELF spec. For example, here is a calling convention spec (https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-cc.adoc) and here is an ELF psABI (https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-elf.adoc) for RISC-V.
3711ddb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW, there are some newly discovered bugs in the Alpha toolchain. Luckly, Maciej W.Rozycki is currently working on improving the Alpha backend in GCC, so chances are good that this issues will resolve in the near future.
OK, I'll try to figure out whether the calling convention spec can be obtained.
3711ddb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rui314 Does the Tru64 Unix Object File Specification for Alpha help?
This seems to contain the specification about object files and linking on Alpha.
3711ddb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Close, but it looks like that document explains COFF object files instead of ELF.
3711ddb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aren't the relocations the same for COFF and ELF?
According this this article, the Alpha ELF format is based on the object file format used in Tru64 Unix.
3711ddb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That document works as a hint as to how its ELF correspondent should look like, but that cannot be a substitute for a specification. It's just like we have other hints such as GNU ld's source code, but those are not a spec.