diff options
| author | Jack O'Connor <[email protected]> | 2023-09-19 17:15:17 -0700 |
|---|---|---|
| committer | Jack O'Connor <[email protected]> | 2023-09-19 17:18:31 -0700 |
| commit | 4e25f2e094312b11cb9fa28305774696eb046058 (patch) | |
| tree | 00f2ac7cfc1ca9bf58ab05c09839e1c7215adbc4 /build.rs | |
| parent | 8bfe93fbf9766a3c4ff52fce9dc8211c8dc297c5 (diff) | |
don't default to NEON intrinsics in build.rs for big-endian targets
Diffstat (limited to 'build.rs')
| -rw-r--r-- | build.rs | 22 |
1 files changed, 21 insertions, 1 deletions
@@ -60,6 +60,20 @@ fn is_armv7() -> bool { target_components()[0] == "armv7" } +fn endianness() -> String { + let endianness = env::var("CARGO_CFG_TARGET_ENDIAN").unwrap(); + assert!(endianness == "little" || endianness == "big"); + endianness +} + +fn is_little_endian() -> bool { + endianness() == "little" +} + +fn is_big_endian() -> bool { + endianness() == "big" +} + // Windows targets may be using the MSVC toolchain or the GNU toolchain. The // right compiler flags to use depend on the toolchain. (And we don't want to // use flag_if_supported, because we don't want features to be silently @@ -253,7 +267,13 @@ fn main() -> Result<(), Box<dyn std::error::Error>> { } } - if (is_arm() && is_neon()) || (!is_no_neon() && !is_pure() && is_aarch64()) { + if is_neon() && is_big_endian() { + panic!("The NEON implementation doesn't support big-endian ARM.") + } + + if (is_arm() && is_neon()) + || (!is_no_neon() && !is_pure() && is_aarch64() && is_little_endian()) + { println!("cargo:rustc-cfg=blake3_neon"); build_neon_c_intrinsics(); } |
