Make asm-targets independent from target name.#152
Make asm-targets independent from target name.#152jonathanpallant merged 1 commit intorust-embedded:mainfrom
asm-targets independent from target name.#152Conversation
6982e0e to
2f5e089
Compare
|
Are those variables set by cargo, or did you invent them? Good idea either way. No one loves string parsing targets. |
|
Ah I see cargo sets them. But because features are not stable, CARGO_CFG_FEATURE is empty, so I cannot see any way to know which Arm architecture I am building for. Are you using nightly? |
|
Ah, yes, I am using nightly. Seems like Then again, custom targets also only work on nightly, right? |
|
Becase the CARGET_TARGET_CFG_FEATURES variable is empty on stable Rust, with this PR the Thumb targets will be mis-detected at Arm targets. Maybe the code could default to looking at the target string first, and only fall back to CARGO_TARGET_CFG_xxx if that fails? |
|
Alternative idea: Use |
2f5e089 to
c8621e3
Compare
That shouldn't be the case since |
|
It's still set, it's just missing all the useful info. $ cat build.rs
fn main() {
eprintln!("FEATURES = {:?}", std::env::var("CARGO_CFG_TARGET_FEATURE"));
}
$ cargo build && rg FEATURE ./target --no-ignore
Compiling testapp v0.1.0 (/Users/jonathan/testapp)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.27s
./target/debug/build/testapp-71c68bd226f9aac7/stderr
1:FEATURES = Ok("aes,crc,dit,dotprod,dpb,dpb2,fcma,fhm,flagm,fp16,frintts,jsconv,lor,lse,neon,paca,pacg,pan,pmuv3,ras,rcpc,rcpc2,rdm,sb,sha2,sha3,ssbs,vh")
$ cargo clean && cargo +nightly build && rg FEATURE ./target --no-ignore
Removed 59 files, 2.3MiB total
Compiling testapp v0.1.0 (/Users/jonathan/testapp)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.68s
./target/debug/build/testapp-fce034d1b64435a6/stderr
1:FEATURES = Ok("aes,crc,dit,dotprod,dpb,dpb2,fcma,fhm,flagm,flagm2,fp16,frintts,jsconv,lor,lse,lse2,neon,paca,pacg,pan,pmuv3,ras,rcpc,rcpc2,rdm,sb,sha2,sha3,ssbs,v8.1a,v8.2a,v8.3a,v8.4a,vh") |
|
I see, for target I was using to test this ( |
|
There's a reason I resorted to just parsing the target strings 😢 |
c8621e3 to
9f8e0ef
Compare
9f8e0ef to
30a9854
Compare
|
Okay, I now switched the order so that |
|
Ok, looks ok to me. Would love to know more about your JSON target though! |
|
The basis for our targets are these
but slightly altered for our use case and named after the hardware variants instead (i.e. |
We have a custom target definition which is named differently to what the
arm-targetscrate expects.I found that the same features can be detected using
CARGO_CFG_TARGET_*variables, e.g.: