Skip to content

Commit e15ab79

Browse files
committed
Set -mfloat-abi=hard not only for thumb targets
1 parent 63de7c6 commit e15ab79

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

build.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,9 @@ mod c {
103103
let target_env = env::var("CARGO_CFG_TARGET_ENV").unwrap();
104104
let target_os = env::var("CARGO_CFG_TARGET_OS").unwrap();
105105
let target_vendor = env::var("CARGO_CFG_TARGET_VENDOR").unwrap();
106-
106+
let target_arch_arm =
107+
target_arch.contains("arm") ||
108+
target_arch.contains("thumb");
107109
let cfg = &mut cc::Build::new();
108110

109111
cfg.warnings(false);
@@ -137,10 +139,10 @@ mod c {
137139
// the implementation is not valid for the arch, then gcc will error when compiling it.
138140
if llvm_target[0].starts_with("thumb") {
139141
cfg.flag("-mthumb");
142+
}
140143

141-
if llvm_target.last() == Some(&"eabihf") {
142-
cfg.flag("-mfloat-abi=hard");
143-
}
144+
if target_arch_arm && llvm_target.last() == Some(&"eabihf") {
145+
cfg.flag("-mfloat-abi=hard");
144146
}
145147

146148
if llvm_target[0] == "thumbv6m" {

0 commit comments

Comments
 (0)