summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_llvm/build.rs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_llvm/build.rs')
-rw-r--r--compiler/rustc_llvm/build.rs11
1 files changed, 9 insertions, 2 deletions
diff --git a/compiler/rustc_llvm/build.rs b/compiler/rustc_llvm/build.rs
index 62ef5804d..28e092c1e 100644
--- a/compiler/rustc_llvm/build.rs
+++ b/compiler/rustc_llvm/build.rs
@@ -242,6 +242,13 @@ fn main() {
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")
+ || 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");
}
cmd.args(&components);
@@ -335,10 +342,10 @@ fn main() {
};
// RISC-V GCC erroneously requires libatomic for sub-word
- // atomic operations. FreeBSD uses Clang as its system
+ // atomic operations. Some BSD uses Clang as its system
// compiler and provides no libatomic in its base system so
// does not want this.
- if !target.contains("freebsd") && target.starts_with("riscv") {
+ if target.starts_with("riscv") && !target.contains("freebsd") && !target.contains("openbsd") {
println!("cargo:rustc-link-lib=atomic");
}