Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions src/bootstrap/src/core/build_steps/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1383,14 +1383,17 @@ 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()
{
cargo.env("JEMALLOC_SYS_WITH_LG_PAGE", "16");
if builder.config.jemalloc(target) && env::var_os("JEMALLOC_SYS_WITH_LG_PAGE").is_none() {
// Build jemalloc on AArch64 with support for page sizes up to 64K
// See: https://github.com/rust-lang/rust/pull/135081
if target.starts_with("aarch64") {
cargo.env("JEMALLOC_SYS_WITH_LG_PAGE", "16");
}
// Build jemalloc on LoongArch with support for page sizes up to 16K
else if target.starts_with("loongarch") {
cargo.env("JEMALLOC_SYS_WITH_LG_PAGE", "14");
}
}
}

Expand Down
14 changes: 10 additions & 4 deletions src/bootstrap/src/core/build_steps/tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,12 +228,18 @@ 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");
if env::var_os("JEMALLOC_SYS_WITH_LG_PAGE").is_none() {
// Build jemalloc on AArch64 with support for page sizes up to 64K
// See: https://github.com/rust-lang/rust/pull/135081
if target.starts_with("aarch64") {
cargo.env("JEMALLOC_SYS_WITH_LG_PAGE", "16");
}
// Build jemalloc on LoongArch with support for page sizes up to 16K
else if target.starts_with("loongarch") {
cargo.env("JEMALLOC_SYS_WITH_LG_PAGE", "14");
}
}

// CFG_RELEASE is needed by rustfmt (and possibly other tools) which
Expand Down
Loading