From e638bd6055ad4df3aa4edbfddfc1d0a09d073692 Mon Sep 17 00:00:00 2001 From: richerfu Date: Sun, 25 Aug 2024 11:12:14 +0800 Subject: [PATCH] feat: use env to adapt to more general scenarios for atomic --- libmimalloc-sys/build.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libmimalloc-sys/build.rs b/libmimalloc-sys/build.rs index 748503e..22ee917 100644 --- a/libmimalloc-sys/build.rs +++ b/libmimalloc-sys/build.rs @@ -57,6 +57,10 @@ fn main() { // on armv6 we need to link with libatomic if target_os == "linux" && target_arch == "arm" { - println!("cargo:rustc-link-lib=atomic"); + // Embrace the atomic capability library across various platforms. + // For instance, on certain platforms, llvm has relocated the atomic of the arm32 architecture to libclang_rt.builtins.a + // while some use libatomic.a, and others use libatomic_ops.a. + let atomic_name = env::var("DEP_ATOMIC").unwrap_or("atomic".to_owned()); + println!("cargo:rustc-link-lib={}", atomic_name); } }