gnzlbg / cargo-asm

cargo subcommand showing the assembly or llvm-ir generated for Rust code
https://github.com/gnzlbg/cargo-asm
Other
1.17k stars 36 forks source link

Change target discovery to a more sophisticated algorithm #119

Closed therealprof closed 5 years ago

therealprof commented 5 years ago

Instead of relying on cfg attributes and making crude assumptions to detect the target system (iff it is the host system), the new approach is a bit more elaborate and allows for more ways to discover the real target:

  1. Check whether there's a TARGET env variable
  2. Check if there's a cargo config file (common for embedded cross compilation)
  3. Use platforms crate for more exhaustive host guessing

Signed-off-by: Daniel Egger daniel@eggers-club.de

therealprof commented 5 years ago

With this change automatically setting the target "just works" (tm) for both desktop and no_std cross compilation, e.g. cargo asm --rust --example i2c_scanner stm32f0xx_hal::adc::Adc::convert

Next stop: figuring out how to render the #[entry] function.

gnzlbg commented 5 years ago

Next stop: figuring out how to render the #[entry] function.

Thank you for working on this. There is also a couple of issues over #[no_mangle] in case you are interested in tackling those as well.

therealprof commented 5 years ago

A release might be nice at some point so I can point other people at this great crate. 😉

gnzlbg commented 5 years ago

I tend to only do releases when CI is green. Because of how this crate is currently tested, that also involves quite a bit of work, particularly when the Rust versions used in CI are updated.

I'll try to take a look next weekend.

therealprof commented 5 years ago

I tend to only do releases when CI is green.

Makes sense.

Because of how this crate is currently tested, that also involves quite a bit of work, particularly when the Rust versions used in CI are updated.

I noticed. 😞

I'll try to take a look next weekend.

No pressure. 😅