Skip to content

Commit e638bd6

Browse files
committed
feat: use env to adapt to more general scenarios for atomic
1 parent 880fd1f commit e638bd6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

libmimalloc-sys/build.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ fn main() {
5757

5858
// on armv6 we need to link with libatomic
5959
if target_os == "linux" && target_arch == "arm" {
60-
println!("cargo:rustc-link-lib=atomic");
60+
// Embrace the atomic capability library across various platforms.
61+
// For instance, on certain platforms, llvm has relocated the atomic of the arm32 architecture to libclang_rt.builtins.a
62+
// while some use libatomic.a, and others use libatomic_ops.a.
63+
let atomic_name = env::var("DEP_ATOMIC").unwrap_or("atomic".to_owned());
64+
println!("cargo:rustc-link-lib={}", atomic_name);
6165
}
6266
}

0 commit comments

Comments
 (0)