From 1ca49133284b24fe3c61564750b462340938bfd8 Mon Sep 17 00:00:00 2001 From: Michael Vines Date: Sun, 1 Mar 2020 15:17:23 -0700 Subject: [PATCH] Avoid is_x86_feature_detected when not building for x86 --- core/src/validator.rs | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/core/src/validator.rs b/core/src/validator.rs index 8e3910eb45..51b7a8bd00 100644 --- a/core/src/validator.rs +++ b/core/src/validator.rs @@ -750,16 +750,19 @@ fn report_target_features() { } ); - // Validator binaries built on a machine with AVX support will generate invalid opcodes - // when run on machines without AVX causing a non-obvious process abort. Instead detect - // the mismatch and error cleanly. - #[target_feature(enable = "avx")] + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] { - if is_x86_feature_detected!("avx") { - info!("AVX detected"); - } else { - error!("Your machine does not have AVX support, please rebuild from source on your machine"); - process::exit(1); + // Validator binaries built on a machine with AVX support will generate invalid opcodes + // when run on machines without AVX causing a non-obvious process abort. Instead detect + // the mismatch and error cleanly. + #[target_feature(enable = "avx")] + { + if is_x86_feature_detected!("avx") { + info!("AVX detected"); + } else { + error!("Your machine does not have AVX support, please rebuild from source on your machine"); + process::exit(1); + } } } }