Build the EE with the mips64r5900el-ps2-elf triple #10

Merged
techwritescode merged 2 commits from ee-ps2-triple into main 2026-10-15 22:29:55 +00:00

PS2-194. Switches the EE from --target=mips64el-unknown-elf to --target=mips64r5900el-ps2-elf, the PS2 triple that implies the R5900 and n32 so lld can link -flto bitcode.

Must ship together with ps2/llvm#18, ps2/llvm#20 and ps2/ps2build#20. The triple only exists in an LLVM built from those branches; with the current LLVM_REF (r5900-ee) clang rejects it. config.sh still pins r5900-ee, so the release needs either #18/#20 merged into r5900-ee or LLVM_REF moved.

File Change
wrappers/ee-clang.cfg.in EE wrapper target (also used by the newlib, newlib-nano and pthread builds)
scripts/build-libcxx.sh libc++, libc++abi, libunwind, libatomic target
scripts/build-emutls.sh emutls.o target
steps/03-compiler-rt.sh builtins compile with the PS2 triple through CMAKE_*_FLAGS

compiler-rt note: with COMPILER_RT_DEFAULT_TARGET_ONLY it takes the arch from the first component of CMAKE_C_COMPILER_TARGET. mips64r5900el is not in its MIPS64 list, so passing the PS2 triple there builds nothing ("Builtin supported architectures:" empty). The step keeps mips64el-unknown-elf as the configure triple and adds --target=mips64r5900el-ps2-elf to the flags, which comes last on each compile line. The archive is still libclang_rt.builtins-mips64el.a, so ps2build's -lclang_rt.builtins-mips64el needs no change. Clang's own driver lookup (only used when clang drives the link, which ps2build does not do) would look in lib/clang/24/lib/mips64r5900el-ps2-unknown-elf/libclang_rt.builtins.a; nothing installs there today and nothing did before.

Verification (Windows, dev LLVM build with #17/#18/#20, scratch prefix):

  • compiler-rt builtins, libc++/libc++abi/libunwind/libatomic and emutls rebuilt with these scripts. newlib, newlib-nano and pthread were reused from the existing install and not rebuilt (without LTO the new triple produces byte-identical code; see ps2/llvm#20).
  • sdk-core tests/bench built with ps2build#20 (PS2BUILD_TOOLCHAIN_ROOT at the scratch prefix) at -O2 and -O2 -flto; both ELFs are ELF32, EF_MIPS_ABI2, MACH_5900.
  • Console rig: -O2 -flto run 20261015T220700-0203 pass, -O2 run 20261015T220708-0204 pass, [ps2rig] exit=0, all 9 checksums equal.

Not tested: the Linux and cross-Windows release builds via build.sh/Docker.

🤖 Generated with Claude Code

PS2-194. Switches the EE from `--target=mips64el-unknown-elf` to `--target=mips64r5900el-ps2-elf`, the PS2 triple that implies the R5900 and n32 so lld can link `-flto` bitcode. **Must ship together with ps2/llvm#18, ps2/llvm#20 and ps2/ps2build#20.** The triple only exists in an LLVM built from those branches; with the current `LLVM_REF` (r5900-ee) clang rejects it. `config.sh` still pins r5900-ee, so the release needs either #18/#20 merged into r5900-ee or `LLVM_REF` moved. | File | Change | |---|---| | `wrappers/ee-clang.cfg.in` | EE wrapper target (also used by the newlib, newlib-nano and pthread builds) | | `scripts/build-libcxx.sh` | libc++, libc++abi, libunwind, libatomic target | | `scripts/build-emutls.sh` | emutls.o target | | `steps/03-compiler-rt.sh` | builtins compile with the PS2 triple through `CMAKE_*_FLAGS` | compiler-rt note: with `COMPILER_RT_DEFAULT_TARGET_ONLY` it takes the arch from the first component of `CMAKE_C_COMPILER_TARGET`. `mips64r5900el` is not in its MIPS64 list, so passing the PS2 triple there builds nothing ("Builtin supported architectures:" empty). The step keeps `mips64el-unknown-elf` as the configure triple and adds `--target=mips64r5900el-ps2-elf` to the flags, which comes last on each compile line. The archive is still `libclang_rt.builtins-mips64el.a`, so ps2build's `-lclang_rt.builtins-mips64el` needs no change. Clang's own driver lookup (only used when clang drives the link, which ps2build does not do) would look in `lib/clang/24/lib/mips64r5900el-ps2-unknown-elf/libclang_rt.builtins.a`; nothing installs there today and nothing did before. Verification (Windows, dev LLVM build with #17/#18/#20, scratch prefix): - compiler-rt builtins, libc++/libc++abi/libunwind/libatomic and emutls rebuilt with these scripts. newlib, newlib-nano and pthread were reused from the existing install and not rebuilt (without LTO the new triple produces byte-identical code; see ps2/llvm#20). - sdk-core `tests/bench` built with ps2build#20 (`PS2BUILD_TOOLCHAIN_ROOT` at the scratch prefix) at `-O2` and `-O2 -flto`; both ELFs are ELF32, EF_MIPS_ABI2, MACH_5900. - Console rig: `-O2 -flto` run 20261015T220700-0203 pass, `-O2` run 20261015T220708-0204 pass, `[ps2rig] exit=0`, all 9 checksums equal. Not tested: the Linux and cross-Windows release builds via `build.sh`/Docker. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Build the EE with the mips64r5900el-ps2-elf triple
Some checks failed
Build / build-native-linux (push) Failing after 37s
Build / build-windows-cross (push) Has been skipped
0a2489239b
The triple implies the R5900 and n32, which lld needs to link -flto
bitcode. compiler-rt derives its arch name from the configure triple and
has no r5900 entry, so the builtins keep configuring as
mips64el-unknown-elf (the archive stays libclang_rt.builtins-mips64el.a)
and compile with the PS2 triple through the flags.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Rebuild against r5900-ee with the PS2 triple
All checks were successful
Build / build-native-linux (push) Successful in 8m49s
Build / build-windows-cross (push) Successful in 8m28s
eeab6d954c
Co-Authored-By: Claude Opus 5.5 <[email protected]>
techwritescode deleted branch ee-ps2-triple 2026-10-15 22:29:58 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
ps2/llvm-toolchain!10
No description provided.