about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCathal Mullan <contact@cathal.dev>2025-08-13 13:18:06 +0100
committerCathal Mullan <contact@cathal.dev>2025-08-13 13:18:06 +0100
commitebcbcc8b73cb6fa8aad42e258ca0382db68e7876 (patch)
tree6608e567db66173b4ac284a23d1fa8fba3eb012d
parent6355cd39c81e9699b1925c58d2ed3165bcab1715 (diff)
downloadrust-ebcbcc8b73cb6fa8aad42e258ca0382db68e7876.tar.gz
rust-ebcbcc8b73cb6fa8aad42e258ca0382db68e7876.zip
bootstrap: Fix jemalloc 64K page support for aarch64 tools
-rw-r--r--src/bootstrap/src/core/build_steps/compile.rs1
-rw-r--r--src/bootstrap/src/core/build_steps/tool.rs8
2 files changed, 9 insertions, 0 deletions
diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs
index 4519731ada7..edd9492225a 100644
--- a/src/bootstrap/src/core/build_steps/compile.rs
+++ b/src/bootstrap/src/core/build_steps/compile.rs
@@ -1391,6 +1391,7 @@ pub fn rustc_cargo_env(builder: &Builder<'_>, cargo: &mut Cargo, target: TargetS
 
     // Build jemalloc on AArch64 with support for page sizes up to 64K
     // See: https://github.com/rust-lang/rust/pull/135081
+    // See also the "JEMALLOC_SYS_WITH_LG_PAGE" setting in the tool build step.
     if builder.config.jemalloc(target)
         && target.starts_with("aarch64")
         && env::var_os("JEMALLOC_SYS_WITH_LG_PAGE").is_none()
diff --git a/src/bootstrap/src/core/build_steps/tool.rs b/src/bootstrap/src/core/build_steps/tool.rs
index aa00cd03c5b..0c263120eee 100644
--- a/src/bootstrap/src/core/build_steps/tool.rs
+++ b/src/bootstrap/src/core/build_steps/tool.rs
@@ -257,6 +257,14 @@ pub fn prepare_tool_cargo(
     // own copy
     cargo.env("LZMA_API_STATIC", "1");
 
+    // Build jemalloc on AArch64 with support for page sizes up to 64K
+    // See: https://github.com/rust-lang/rust/pull/135081
+    // Note that `miri` always uses jemalloc. As such, there is no checking of the jemalloc build flag.
+    // See also the "JEMALLOC_SYS_WITH_LG_PAGE" setting in the compile build step.
+    if target.starts_with("aarch64") && env::var_os("JEMALLOC_SYS_WITH_LG_PAGE").is_none() {
+        cargo.env("JEMALLOC_SYS_WITH_LG_PAGE", "16");
+    }
+
     // CFG_RELEASE is needed by rustfmt (and possibly other tools) which
     // import rustc-ap-rustc_attr which requires this to be set for the
     // `#[cfg(version(...))]` attribute.