diff --git a/build.rs b/build.rs index 0d32e97..6a05727 100644 --- a/build.rs +++ b/build.rs @@ -103,7 +103,9 @@ mod c { let target_env = env::var("CARGO_CFG_TARGET_ENV").unwrap(); let target_os = env::var("CARGO_CFG_TARGET_OS").unwrap(); let target_vendor = env::var("CARGO_CFG_TARGET_VENDOR").unwrap(); - + let target_arch_arm = + target_arch.contains("arm") || + target_arch.contains("thumb"); let cfg = &mut cc::Build::new(); cfg.warnings(false); @@ -137,10 +139,10 @@ mod c { // the implementation is not valid for the arch, then gcc will error when compiling it. if llvm_target[0].starts_with("thumb") { cfg.flag("-mthumb"); + } - if llvm_target.last() == Some(&"eabihf") { - cfg.flag("-mfloat-abi=hard"); - } + if target_arch_arm && llvm_target.last() == Some(&"eabihf") { + cfg.flag("-mfloat-abi=hard"); } if llvm_target[0] == "thumbv6m" {