Skip to content
This repository has been archived by the owner on Oct 10, 2022. It is now read-only.

libcompiler-rt on 3ds #2

Closed
HybridEidolon opened this issue Aug 19, 2015 · 8 comments
Closed

libcompiler-rt on 3ds #2

HybridEidolon opened this issue Aug 19, 2015 · 8 comments

Comments

@HybridEidolon
Copy link
Member

This isn't directly related to this project, but in order to continue development on the 3DS in Rust, we need a libcompiler-rt.a compiled in such a way that it can be linked with arm-none-eabi-gcc. This is a show stopper once you get past very trivial code, because llvm emits calls into it for its intrinsics.

If someone has experience with that, contributions would be helpful. We can't really advance until that problem is resolved.

@ghost
Copy link

ghost commented Jan 2, 2016

I got Rust to play nice with MS-DOS and DJGPP, and I had the same issue. If I recall, my workaround was just to have rustc build object files, then link them to a "fake" compiler-rt implementation that only contains implementations for the functions that are missing from the libc flavor you're linking to. Sounds convoluted, but it's pretty simple in practice. No idea how to make that work with Cargo, though, my Rust on DJGPP project didn't make use of it.

@HybridEidolon
Copy link
Member Author

The rust3ds-template project has had a compiled libcompiler_rt included with it for some time that works, but I want to keep this issue open in case someone comes up with a better, automated solution that people can build in their own toolchain setup.

@FenrirWolf
Copy link
Member

This project shows some promise in that regard: https://github.com/japaric/compiler-rt.rs

@HybridEidolon
Copy link
Member Author

I find it a little weird that it comes in the form of a crate that gets linked in, but that is likely the most ergonomic solution to the problem.

@FenrirWolf
Copy link
Member

FenrirWolf commented Jun 24, 2016

There's some building desire to make compiler-rt get built along with libcore itself (rust-lang/rust#34400) so hopefully it would be a temporary solution anyway.

@HybridEidolon
Copy link
Member Author

Do you know if compiler-rt.rs works for rust 3ds yet? I really can't remember all of the things I did to build the one being used in the project template right now, and all of it was wiped off my Mac accidentally. There were several specific tweaks in a custom target makefile I had to make.

@FenrirWolf
Copy link
Member

FenrirWolf commented Jun 24, 2016

I tried it out and received the following error:

   Compiling compiler-rt v0.1.0 (https://github.com/japaric/compiler-rt.rs#bb31d8b1)
error: failed to run custom build command for `compiler-rt v0.1.0 (https://github.com/japaric/compiler-rt.rs#bb31d8b1)`
process didn't exit successfully: `/home/fenrir/projects/rust3ds-template/target/release/build/compiler-rt-e5e01a4239060006/build-script-build` (signal: 6, SIGABRT: process abort signal)
--- stderr
Cloning into '/tmp/compiler-rt.jqFI0mSPaUpv'...
thread 'main' panicked at 'AR_3ds not set', ../src/libcore/option.rs:699
note: Run with `RUST_BACKTRACE=1` for a backtrace.

error: `cargo` process didn't exit successfully

Both the linker and ar fields are set in 3ds.json so I don't know why it isn't picking up on that for the latter.

@FenrirWolf
Copy link
Member

Though to be honest, I think we're fine sticking with the precompiled compiler-rt for the time being. Apparently compiler-rt.rs will be integrated into xargo if all the kinks get worked out.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants