4 ms·
I didn't read the article. But I wonder, since Rust uses LLVM, isn't the PSP platform a compiler target automatically? And if not (I suspect it could have some
by amelius 12y ago
I didn't read the article. But I wonder, since Rust uses LLVM, isn't the PSP platform a compiler target automatically?
And if not (I suspect it could have something to do with kernel-specific stuff), then shouldn't there be some intermediate kernel-API translator that would make the process of porting the compiler more easy?
- pitterpatter 12y agoYes, LLVM does (mostly) support the PSP as a target. Previously though, one would have to manually modify the rust compiler itself to recognize any new targets and basically fill in a lot of the plumbing for the new target. But thanks to the (relatively) recent Target Specs feature, teaching rustc about a new triple is as easy as writing a simple JSON file: https://github.com/luqmana/rust-psp-hello/blob/master/psp.json.in https://github.com/luqmana/rust-psp-hello/blob/master/psp.js...
- bri3d 12y agoThe PSP's calling convention ("MIPS EABI", not to be confused with ARM EABI) is simple, the executable format ("PRX" - basically ELF with some extra sections) is converted from ELFs by a PSPSDK tool, and the dynamic linker uses a funny table of 32-bit virtual pointers ("NIBs") correlating with the first 32 bits of the SHA-1 of a method name, which, once the method name is known, makes things pretty straightforward to set up. Basically any compiler supporting MIPS-EABI-ELF can be made to generate PSP executables with the use of the ELF-to-PRX tools from the open-source PSP toolchain. The PSP does support some special instructions (a VFPU and some "allegrex extensions") but they aren't necessary to make working binaries - just for performance.