cc-rs icon indicating copy to clipboard operation
cc-rs copied to clipboard

Not sourcing `target-cpu`

Open N-T-K opened this issue 3 months ago • 2 comments

If TARGET = Some(thumbv7em-none-eabihf) then it is correctly mapped to: https://github.com/rust-lang/cc-rs/blob/1ca8b2af7a19faa4d090cc5deba3f7a0cd721174/src/lib.rs#L2406-L2412

However, if there is a provided CARGO_ENCODED_RUSTFLAGS = Some(-Ctarget-cpu=cortex-m7) then the aforementioned cc flags are wrong and should be -march=armv7e-m+fp.dp -mfloat-abi=hard -mfpu=auto.

gcc -mcpu docs. rustc thumbv7em-none-eabihf.

N-T-K avatar Oct 05 '25 01:10 N-T-K

I would accept a PR to fix this

NobodyXu avatar Oct 05 '25 06:10 NobodyXu

It's a bit more complicated now that I've looked into it, but I'll try and put something together.

N-T-K avatar Oct 06 '25 15:10 N-T-K