Hello,
I’m part of the (sadly fairly small) community of PS2 hackers. The current cross-toolchain for the PS2 is based on GCC 3.2.3, an outdated and buggy compiler, which I have personally gotten tired of working with, so I would like to port Clang as a newer cross-compiler for the PS2.
However, the PS2 has some notable quirks which make this a non-trivial task for the current compiler. It has two main CPUs, the “Emotion Engine” (EE), which controls the main operating system, and the “I/O Processor” (IOP), which is used for PS1 compatibility and for I/O.
The EE is based on a custom chip called the R5900, which implements most of MIPS III (except the ll and sc instructions, which make little sense on a single-core CPU), as well as some instructions from MIPS IV (pref, movz/movn, rsqrt.s), and a set of SIMD instructions known as Multimedia Instructions (MMI). It also contains a non-IEEE 754 single-precision FPU (which has provided a lot of headaches). It was later re-used by Toshiba as the TX79, along with a proper FPU.
The IOP is based on the MIPS I R3051A, and was also used as the PS1 CPU.
I’d like to go through some of the issues I’ve had so far.
I’ve tried to use mips64el
as a target, but it would invoke the system GCC with obvious bad results, so I have used the mips64el-img-linux
target to generate ELF files which the PS2 BIOS can load (is there a better solution to generate bare-metal ELF?).
I then tried to compile newlib 3.0.0-20180802, as newlib is used as the standard C library for the PS2, and hit multiple asserts, which I have attached below.
I don’t mind trying to fix these myself, but I would appreciate some pointers.
llvm-bugs.tgz (440 KB)