Ravenslofty / prussia

Prussia - a Rust PS2 SDK.
Other
105 stars 6 forks source link

Q: binutils version to use? #3

Closed mlafeldt closed 4 years ago

mlafeldt commented 4 years ago

What version/flavor of binutils is required use prussia? And how did you install/compile it?

The ps2toolchain project uses binutils 2.14 with this patch: https://github.com/ps2dev/ps2toolchain/blob/master/patches/binutils-2.14-PS2.patch

Ravenslofty commented 4 years ago

It's designed to be purely LLVM - binutils is never used here. The reason the SDK is a rewrite and not bindings to PS2SDK is that it uses a custom R5900-specific ELF mode, which makes it impossible to link code with any other language.

However, I know @frno7 has been working on binutils for R5900, and I think a very modern (>= 2.29) upstream binutils might work.

On Fri, 29 May 2020, 12:38 Mathias Lafeldt, notifications@github.com wrote:

What version/flavor of binutils is required use prussia? And how did you install/compile it?

The ps2toolchain project uses binutils 2.14 with this patch: https://github.com/ps2dev/ps2toolchain/blob/master/patches/binutils-2.14-PS2.patch

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ZirconiumX/prussia/issues/3, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALPDW5SWPGY4BOWVGPKWNLRT6NBTANCNFSM4NN63M2A .

mlafeldt commented 4 years ago

But you state in the README that one should install binutils for MIPS, no?

I get this error when trying to build the project:

$ cargo xbuild --target ps2.json
...
error: linker `mips64el-none-elf-ld` not found
  |
  = note: No such file or directory (os error 2)
mlafeldt commented 4 years ago

I guess I need to install binutils like this https://github.com/bokuweb/docker-rust-gba/blob/ff0de7b1b8b5502f983b10c71082b5d5dfcac364/Dockerfile#L10 with --target=mips64el-none-elf but I'm not sure.

Ravenslofty commented 4 years ago

Then yes, you'll need binutils made with ,./configure --target=mips64el-none-elf. It's been a while since I worked on this, sorry.

On Fri, 29 May 2020, 13:30 Mathias Lafeldt, notifications@github.com wrote:

But you state in the README that one should install binutils for MIPS, no?

I get this error when trying to build the project:

$ cargo xbuild --target ps2.json ... error: linker mips64el-none-elf-ld not found | = note: No such file or directory (os error 2)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ZirconiumX/prussia/issues/3#issuecomment-635946386, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALPDW3OEEPJ5R5HVFKP6DDRT6THNANCNFSM4NN63M2A .

mlafeldt commented 4 years ago

Thanks!

This Dockerfile does the job for me under OS X:

FROM rustlang/rust:nightly

RUN wget http://ftp.gnu.org/gnu/binutils/binutils-2.27.tar.gz && \
  tar -zxvf binutils-2.27.tar.gz && \
  cd binutils-2.27 && \
  ./configure --target=mips64el-none-elf && \
  make && \
  make install

RUN cargo install cargo-xbuild
RUN rustup component add rust-src

WORKDIR /src
CMD ["/bin/bash"]

The code requires some changes to compile with a recent Rust version. I'm going to open a PR later.

mlafeldt commented 4 years ago

One more thing: maybe the project could be compiled using https://github.com/rust-embedded/cross but I haven't tried yet.

frno7 commented 4 years ago

Indeed, modern Binutils and GCC work with the R5900, but there are some limitations, at least in the context of Linux for the PlayStation 2: only the o32 ABI is currently supported, and the FPU is currently emulated in software. These restrictions may eventually be lifted.

Also of note is that modern Binutils and GCC also work with IOP modules.

Ravenslofty commented 4 years ago

GCC version is not particularly relevant in the context of a Rust program.

On Fri, 29 May 2020, 15:46 frno7, notifications@github.com wrote:

Indeed, modern Binutils and GCC work with the R5900, but there are some limitations, at least in the context of Linux for the PlayStation 2: only the o32 ABI https://github.com/frno7/linux/wiki/R5900-processor-specific-ABI-(psABI) is currently supported, and the FPU is currently emulated in software https://github.com/frno7/linux/wiki/R5900-floating-point-unit-(FPU). These restrictions may eventually be lifted.

Also of note is that modern Binutils and GCC also work with IOP modules https://github.com/frno7/iopmod.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ZirconiumX/prussia/issues/3#issuecomment-636013625, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALPDW6TVYI2TWYI72BPJS3RT7DCTANCNFSM4NN63M2A .

mlafeldt commented 4 years ago

The code requires some changes to compile with a recent Rust version. I'm going to open a PR later.

Here we go: https://github.com/ZirconiumX/prussia/pull/4