diff --git a/compiler/rustc_llvm/build.rs b/compiler/rustc_llvm/build.rs index 79f06ac146c77..0b3c057345a67 100644 --- a/compiler/rustc_llvm/build.rs +++ b/compiler/rustc_llvm/build.rs @@ -238,18 +238,20 @@ fn main() { if !is_crossed { cmd.arg("--system-libs"); - } else if target.contains("windows-gnu") { - println!("cargo:rustc-link-lib=shell32"); - println!("cargo:rustc-link-lib=uuid"); - } else if target.contains("netbsd") || target.contains("haiku") || target.contains("darwin") { - println!("cargo:rustc-link-lib=z"); - } else if target.starts_with("arm") + } + + if (target.starts_with("arm") && !target.contains("freebsd")) || target.starts_with("mips-") || target.starts_with("mipsel-") || target.starts_with("powerpc-") { // 32-bit targets need to link libatomic. println!("cargo:rustc-link-lib=atomic"); + } else if target.contains("windows-gnu") { + println!("cargo:rustc-link-lib=shell32"); + println!("cargo:rustc-link-lib=uuid"); + } else if target.contains("netbsd") || target.contains("haiku") || target.contains("darwin") { + println!("cargo:rustc-link-lib=z"); } cmd.args(&components);