I am trying to experiment with a no-std application. I can get my crate to build by using cargo rustc -- -C link-arg=-nostartfiles. However, I cannot run cargo build, since it doesn't automatically pass in the -nostartfiles flag. However, if I add it to .cargo/config, then it is also used when compiling my dependencies, which doesn't work.
Is there a way to add everything I would add after the cargo rustc to .cargo/config (or Cargo.toml) so I don't have to use that command every time?
And the answer is "no". There's no way to pass arbitrary flags through cargo. That's intentional. The Cargo team doesn't want dependencies to be able to build themselves with arbitrary compiler flags, because having different flags for different crates can result in a broken build.
Thanks! I did take a look through the manifest documentation but wanted to make sure I wasn't missing something.
I think I can understand the concept of not allowing libraries to specify arbitrary flags. However, wouldn't it make sense for a binary to be able to pass arbitrary flags to the compiler? Or am I missing something?