-
Notifications
You must be signed in to change notification settings - Fork 214
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
Move from an "asm" flag to a "no-asm" feature flag #386
Conversation
Could you also make a PR to disable it by default in libstd and only enable it when libstd has a certain feature flag enabled? It is fine to make this feature flag enabled by default, for as long as |
EDIT: Would it be possible for cg_clif to disable the |
cg_clif can't remove cfg features. What I want to achieve is that simply passing # compiler-builtins
[features]
default = ["asm"]
asm = []
# std
[dependencies]
compiler-builtins = { version = "...", default-features = false, features = ["compiler-builtins"] }
[features]
default = ["asm"]
asm = ["compiler-builtins/asm"]
# test
[dependencies]
std = { path = "../std", default-features = false }
[features]
default = ["asm"]
asm = ["std/asm"] |
I think it'd be best to add a feature to libstd to enable the asm feature, and that way |
@bjorn3 @alexcrichton would having a This also means that as cg_clif supports more of Rust, we can disable these workarounds without changing the external feature set. |
What about naming it |
I don't really mind how this works myself, I think it just needs to solve the constraint of "it should be able to compile this crate in libstd without If this is enabled by default (as in this PR), is there an example of how to disable this feature as part of building libstd? |
That's a good idea. I've updated this PR and the description to do this. The
Ya, @bjorn3's idea to just have a
Now the question would be how to enable |
8464592
to
522db62
Compare
I think that the |
This works better as core/alloc/std have trouble supporting default featues in this crate. Signed-off-by: Joe Richey <joerichey@google.com>
Signed-off-by: Joe Richey <joerichey@google.com>
Correct, once the Note that libcore and libstd currently use inline asm, so they will also need to gate those implementations with |
Ok sounds good to me! Is this ready to go or would you like some more time? |
This is ready to be merged. @bjorn3 should I open a PR to rust-lang/rust to add the |
I can do it, but if you want to do it that is fine with me too. |
👍 |
@josephlr @alexcrichton @bjorn3 I introduced the |
* Use a no-asm feature instead of an asm feature This works better as core/alloc/std have trouble supporting default featues in this crate. Signed-off-by: Joe Richey <joerichey@google.com> * Have no-asm disable arm assembly intrinsics Signed-off-by: Joe Richey <joerichey@google.com>
Update `compiler_builtins` to 0.1.38 This version contains the fixes of rust-lang/compiler-builtins#390 and rust-lang/compiler-builtins#391. Also, rename features following rust-lang/compiler-builtins#386.
Update `compiler_builtins` to 0.1.39 This version contains the fixes of rust-lang/compiler-builtins#390 and rust-lang/compiler-builtins#391. Also, rename features following rust-lang/compiler-builtins#386.
Right now there's no way to get the assembly related improvements when building this crate with
-Zbuild-std
, as theasm
feature flag is not enabled bylibstd
. This is also preventing performance improvements from getting into the pre-built libstd (see rust-lang/rust#39078).The solution to this is to have a
"no-asm"
feature. That way, by default, we will get the optimized version. This is reasonable as the default backend (rustc
) supports inline assembly.CC: @bjorn3 @alexcrichton
Signed-off-by: Joe Richey joerichey@google.com