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

Conversation

wcampbell0x2a
Copy link
Contributor

  • 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

To enable NEON in the future, I think the following will need to be addressed with adding compiler options:

  cargo:warning=                 from src/zlib-ng/arch/arm/slide_hash_neon.c:12:
  cargo:warning=/usr/local/lib/gcc/arm-linux-musleabi/9.2.0/include/arm_neon.h:31:2: error: #error "NEON intrinsics not available with the soft-float ABI.  Please use -mfloat-abi=softfp or -mfloat-abi=hard"
  cargo:warning=   31 | #error "NEON intrinsics not available with the soft-float ABI.  Please use -mfloat-abi=softfp or -mfloat-abi=hard"

* 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
Copy link
Member

@Byron Byron left a comment

Choose a reason for hiding this comment

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

Thank you for this fix - it seems reasonable to conditionally add this feature.

There is just one small robustness change to be done before the merge.
Thanks again.

zng/cc.rs Outdated
@@ -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

@Byron Byron merged commit 50dfd55 into rust-lang:main May 30, 2024
45 checks passed
@Byron
Copy link
Member

Byron commented May 30, 2024

Thanks a lot!

@wcampbell0x2a wcampbell0x2a deleted the arm-only-enable-neon-if-in-features branch June 6, 2024 03:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants