Skip to content
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

cc: Only enable ARM_NEON when in target_feature #196

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion zng/cc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ pub fn build_zlib_ng(target: &str, compat: bool) {

let target_os = env::var("CARGO_CFG_TARGET_OS").unwrap();
let arch = env::var("CARGO_CFG_TARGET_ARCH").expect("failed to retrieve target arch");
let features = env::var("CARGO_CFG_TARGET_FEATURE").unwrap();

let is_linux_or_android = matches!(target_os.as_str(), "linux" | "android");
if is_linux_or_android {
Expand Down Expand Up @@ -311,7 +312,9 @@ pub fn build_zlib_ng(target: &str, compat: bool) {
}

// neon
cfg.define("ARM_NEON", None);
if features.contains("neon") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even though right now neon is unique, I am afraid that in future there will be neon-ultra or something like that which might make this a false positive.

Can you try features.split(",").any(|name| name == "neon") instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, fixed with a62591d

cfg.define("ARM_NEON", None);
}

// NOTE: These intrinsics were only added in gcc 9.4, which is _relatively_
// recent, and if the define is not set zlib-ng just provides its
Expand Down
Loading