Kaynağa Gözat

Set -mfloat-abi=hard not only for thumb targets

Paolo Teti 7 yıl önce
ebeveyn
işleme
e15ab79173
1 değiştirilmiş dosya ile 6 ekleme ve 4 silme
  1. 6 4
      build.rs

+ 6 - 4
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" {