Skip to content

Commit

Permalink
cc: Only enable ARM_NEON when in target_feature
Browse files Browse the repository at this point in the history
* Fix armv7-unknown-linux-musleabi and arm-unknown-linux-musleabi by
  only passing in ARM_NEON if that target is enabled.
* This was only tested without neon, and *not* tested *with* neon support
  • Loading branch information
wcampbell0x2a committed May 29, 2024
1 parent 414ca0a commit 61c9b18
Showing 1 changed file with 4 additions and 1 deletion.
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") {
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

0 comments on commit 61c9b18

Please sign in to comment.