japaric/steed

Use custom targets

Closed this issue · 2 comments

Given that we are forced to use panic = abort, which currently has to be specified in Cargo.toml, until we implement unwinding (#12) and that some crates may require modifications to be compiled against steed (e.g. use syscalls instead of the libc crate, or not use last_os_error), I propose that we create and ship with this repo custom targets that make it easier to deal with those two requirements.

In a nutshell, we would create custom targets named e.g. x86_64-linux that look very similar to their built-in counterparts, e.g. x86_64-unknown-linux-gnu, except for:

  • Setting panic-strategy to abort

  • Setting env to steed so people can use cfg(target_env = "steed") to make their crates compatible with steed

  • And moving the linker flags that currently reside in .cargo/config into the pre-link-args fields so people don't have to carry that file around to compile against steed.

The main downside is that to call cargo build --target x86_64-linux you would need to have the target specification file around. But I think that can be fixed by teaching cross how to support custom targets and by providing images that contain the target specification file and set RUST_TARGET_PATH as appropriate such that cross build --target x86_64-linux just works.

Thoughts on this?

Sounds reasonable but why not call it x86_64-unknown-linux-steed?

Sounds reasonable but why not call it x86_64-unknown-linux-steed?

Less typing but that works too.