Skip to content

Commit de80670

Browse files
committed
Disable jemalloc on aarch64/powerpc
Sounds like jemalloc is broken on systems which differ in page size than the host it was compiled on (unless an option was passed). This unfortunately reduces the portability of binaries created and can often make Rust segfault by default. For now let's patch over this by disabling jemalloc until we can figure out a better solution. Closes #36994 Closes #37320 cc jemalloc/jemalloc#467
1 parent a5b6a9f commit de80670

12 files changed

+45
-0
lines changed

src/librustc_back/target/aarch64_unknown_linux_gnu.rs

+4
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ use target::{Target, TargetOptions, TargetResult};
1313
pub fn target() -> TargetResult {
1414
let mut base = super::linux_base::opts();
1515
base.max_atomic_width = Some(128);
16+
17+
// see #36994
18+
base.exe_allocation_crate = "alloc_system".to_string();
19+
1620
Ok(Target {
1721
llvm_target: "aarch64-unknown-linux-gnu".to_string(),
1822
target_endian: "little".to_string(),

src/librustc_back/target/mips64_unknown_linux_gnuabi64.rs

+4
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ pub fn target() -> TargetResult {
2525
cpu: "mips64r2".to_string(),
2626
features: "+mips64r2".to_string(),
2727
max_atomic_width: Some(64),
28+
29+
// see #36994
30+
exe_allocation_crate: "alloc_system".to_string(),
31+
2832
..super::linux_base::opts()
2933
},
3034
})

src/librustc_back/target/mips64el_unknown_linux_gnuabi64.rs

+4
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ pub fn target() -> TargetResult {
2525
cpu: "mips64r2".to_string(),
2626
features: "+mips64r2".to_string(),
2727
max_atomic_width: Some(64),
28+
29+
// see #36994
30+
exe_allocation_crate: "alloc_system".to_string(),
31+
2832
..super::linux_base::opts()
2933
},
3034
})

src/librustc_back/target/mips_unknown_linux_gnu.rs

+4
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ pub fn target() -> TargetResult {
2424
cpu: "mips32r2".to_string(),
2525
features: "+mips32r2".to_string(),
2626
max_atomic_width: Some(32),
27+
28+
// see #36994
29+
exe_allocation_crate: "alloc_system".to_string(),
30+
2731
..super::linux_base::opts()
2832
},
2933
})

src/librustc_back/target/mips_unknown_linux_musl.rs

+4
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ pub fn target() -> TargetResult {
2424
cpu: "mips32r2".to_string(),
2525
features: "+mips32r2,+soft-float".to_string(),
2626
max_atomic_width: Some(32),
27+
28+
// see #36994
29+
exe_allocation_crate: "alloc_system".to_string(),
30+
2731
..super::linux_base::opts()
2832
}
2933
})

src/librustc_back/target/mips_unknown_linux_uclibc.rs

+4
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ pub fn target() -> TargetResult {
2424
cpu: "mips32r2".to_string(),
2525
features: "+mips32r2,+soft-float".to_string(),
2626
max_atomic_width: Some(32),
27+
28+
// see #36994
29+
exe_allocation_crate: "alloc_system".to_string(),
30+
2731
..super::linux_base::opts()
2832
},
2933
})

src/librustc_back/target/mipsel_unknown_linux_gnu.rs

+4
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ pub fn target() -> TargetResult {
2525
cpu: "mips32".to_string(),
2626
features: "+mips32".to_string(),
2727
max_atomic_width: Some(32),
28+
29+
// see #36994
30+
exe_allocation_crate: "alloc_system".to_string(),
31+
2832
..super::linux_base::opts()
2933
},
3034
})

src/librustc_back/target/mipsel_unknown_linux_musl.rs

+4
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ pub fn target() -> TargetResult {
2424
cpu: "mips32".to_string(),
2525
features: "+mips32,+soft-float".to_string(),
2626
max_atomic_width: Some(32),
27+
28+
// see #36994
29+
exe_allocation_crate: "alloc_system".to_string(),
30+
2731
..super::linux_base::opts()
2832
}
2933
})

src/librustc_back/target/mipsel_unknown_linux_uclibc.rs

+4
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ pub fn target() -> TargetResult {
2525
cpu: "mips32".to_string(),
2626
features: "+mips32,+soft-float".to_string(),
2727
max_atomic_width: Some(32),
28+
29+
// see #36994
30+
exe_allocation_crate: "alloc_system".to_string(),
31+
2832
..super::linux_base::opts()
2933
},
3034
})

src/librustc_back/target/powerpc64_unknown_linux_gnu.rs

+3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ pub fn target() -> TargetResult {
1616
base.pre_link_args.push("-m64".to_string());
1717
base.max_atomic_width = Some(64);
1818

19+
// see #36994
20+
base.exe_allocation_crate = "alloc_system".to_string();
21+
1922
Ok(Target {
2023
llvm_target: "powerpc64-unknown-linux-gnu".to_string(),
2124
target_endian: "big".to_string(),

src/librustc_back/target/powerpc64le_unknown_linux_gnu.rs

+3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ pub fn target() -> TargetResult {
1616
base.pre_link_args.push("-m64".to_string());
1717
base.max_atomic_width = Some(64);
1818

19+
// see #36994
20+
base.exe_allocation_crate = "alloc_system".to_string();
21+
1922
Ok(Target {
2023
llvm_target: "powerpc64le-unknown-linux-gnu".to_string(),
2124
target_endian: "little".to_string(),

src/librustc_back/target/powerpc_unknown_linux_gnu.rs

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ pub fn target() -> TargetResult {
1515
base.pre_link_args.push("-m32".to_string());
1616
base.max_atomic_width = Some(32);
1717

18+
// see #36994
19+
base.exe_allocation_crate = "alloc_system".to_string();
20+
1821
Ok(Target {
1922
llvm_target: "powerpc-unknown-linux-gnu".to_string(),
2023
target_endian: "big".to_string(),

0 commit comments

Comments
 (0)