Compiler does not recognize LLVM supported target-features

Hello, first time poster here so please bear with me.

I'm currently trying to compile a library with the target "armv7r-none-eabihf". I also need to specify some target-features as the library is supposed to integrate with some C-code on a microcontroller. The flags needed are "vfp3d16" and "strict-align" and I get the following error.

Even though the features are clearly specified in the list when I run "rustc --target=armv7r-none-eabi --print target-features". I guess there is a difference between rustc and llvm supported features but I cannot find any information on this.

It's not an error, just a warning that rustc doesn't know what those mean, but it will pass it on to LLVM. Have you checked the binary?

Okay, so the compiler flags will be passed on to the LLVM but rustc warns that it do not recognize them? No, I have not checked the binary yet. Is there something special I should look for?

Rustc has a hard coded list of target features for each architecture. These are the only ones for which #[cfg(target_feature = "...")] and #[target_feature(enable = "...")] work. All other target features are still passed through to LLVM with -Ctarget-feature, but will give a warning and may change in future LLVM versions. The full list of known target features can be found at https://github.com/rust-lang/rust/blob/155a5c2862c2939aa8464456ca9f358fbb213005/compiler/rustc_codegen_ssa/src/target_features.rs

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.