Let mimalloc_rust link libatomic

mimalloc_rust now links libatomic itself on targets without 64-bit
atomics, so cli/build.rs, which did that for 32-bit PowerPC hosts, is
no longer needed.
This commit is contained in:
Rui Ueyama committed 2026-10-01 21:31:34 +09:00
1 parent b7d67b020e
commit 6f8dbb64b2
3 files changed
+3 -18

No files matched your search

Generated
+2 -2
View File
@@ -189,7 +189,7 @@ checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2"
[[package]]
name = "libmimalloc-sys"
version = "0.1.49"
source = "git+https://github.com/rui314/mimalloc_rust?rev=3979460494f1cd1e7f936cb8e10f41e927c9f698#3979460494f1cd1e7f936cb8e10f41e927c9f698"
source = "git+https://github.com/rui314/mimalloc_rust?rev=d4636c9f420065b29306de9deb128b7fa162892c#d4636c9f420065b29306de9deb128b7fa162892c"
dependencies = [
"cc",
]
@@ -224,7 +224,7 @@ dependencies = [
[[package]]
name = "mimalloc"
version = "0.1.52"
source = "git+https://github.com/rui314/mimalloc_rust?rev=3979460494f1cd1e7f936cb8e10f41e927c9f698#3979460494f1cd1e7f936cb8e10f41e927c9f698"
source = "git+https://github.com/rui314/mimalloc_rust?rev=d4636c9f420065b29306de9deb128b7fa162892c#d4636c9f420065b29306de9deb128b7fa162892c"
dependencies = [
"libmimalloc-sys",
]
+1 -1
View File
@@ -39,7 +39,7 @@ mold-target-loongarch32 = { path = "../arch/loongarch32", optional = true }
# sparc64 uses the system allocator. See main.rs.
[target.'cfg(not(target_arch = "sparc64"))'.dependencies]
mimalloc = { git = "https://github.com/rui314/mimalloc_rust", rev = "3979460494f1cd1e7f936cb8e10f41e927c9f698" }
mimalloc = { git = "https://github.com/rui314/mimalloc_rust", rev = "d4636c9f420065b29306de9deb128b7fa162892c" }
[dev-dependencies]
mold-tests = { path = "../tests" }
-15
View File
@@ -1,15 +0,0 @@
//! Links libatomic into mold on hosts without 64-bit atomics, such as
//! 32-bit PowerPC. mimalloc uses 64-bit atomics, which C compilers
//! implement as calls into libatomic on those hosts.
fn main() {
println!("cargo:rerun-if-changed=build.rs");
let widths = std::env::var("CARGO_CFG_TARGET_HAS_ATOMIC").unwrap_or_default();
if !widths.split(',').any(|w| w == "64") {
// rustc places libraries named by this crate before its dependencies
// on the linker command line, where --as-needed would drop libatomic.
// Link arguments come after all libraries.
println!("cargo:rustc-link-arg-bins=-latomic");
}
}