-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow of way to toggle freestanding platform features #356
Conversation
`RUST_MBED_C_COMPILER_FREESTANDING=1` allows to skip cmake checks where the target must produce valid binaries
latest nightly compiler provides some new warnings. will fix them in another PR |
mbedtls-sys/build/cmake.rs
Outdated
@@ -32,7 +32,9 @@ impl super::BuildConfig { | |||
// thumbv6m-none-eabi, thumbv7em-none-eabi, thumbv7em-none-eabihf, | |||
// thumbv7m-none-eabi probably use arm-none-eabi-gcc which can cause the | |||
// cmake compiler test to fail. | |||
if target.starts_with("thumbv") && target.contains("none-eabi") { | |||
if target.starts_with("thumbv") && target.contains("none-eabi") | |||
|| crate::features::FEATURES.have_platform_component("c_compiler", "freestanding") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will affect the environment which already has freestanding
feature.
I think you could just directly read RUST_MBED_C_COMPILER_FREESTANDING
and use it here. And it could have a better name, such as RUST_MBED_C_COMPILER_ARM_BAREMETAL
or anything more related to the issue or reason here.
In mbedtls-sys/build/features.rs
you do not need to change the logic about adding freestanding
feature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I am thinking if your case can be determined by checking some property of cc
here.
Note: cc
represents c compiler here, see let cc = cc::Build::new().get_compiler();
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Querying from CC could work but is not guaranteed for example we can check for -none
targets however there might be other operating systems that purely only support static libraries.
I've tested 30b7f13 with
$ CFLAGS="-isysroot /opt/arm-gnu-toolchain-13.2.Rel1-x86_64-aarch64-none-elf" CC=clang RUST_MBED_C_COMPILER_BAREMETAL=1 cargo +stable b --target aarch64-unknown-none --no-default-features --features no_std_deps
RUST_MBED_C_COMPILER_FREESTANDING=1
allows to skip cmake checks where the target must produce valid binaries.Closes: #355
cc: @Taowyoo