From de80670f7487f5db26e3929f7f2f464345859b49 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 24 Oct 2016 19:33:28 -0700 Subject: [PATCH] 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 --- src/librustc_back/target/aarch64_unknown_linux_gnu.rs | 4 ++++ src/librustc_back/target/mips64_unknown_linux_gnuabi64.rs | 4 ++++ src/librustc_back/target/mips64el_unknown_linux_gnuabi64.rs | 4 ++++ src/librustc_back/target/mips_unknown_linux_gnu.rs | 4 ++++ src/librustc_back/target/mips_unknown_linux_musl.rs | 4 ++++ src/librustc_back/target/mips_unknown_linux_uclibc.rs | 4 ++++ src/librustc_back/target/mipsel_unknown_linux_gnu.rs | 4 ++++ src/librustc_back/target/mipsel_unknown_linux_musl.rs | 4 ++++ src/librustc_back/target/mipsel_unknown_linux_uclibc.rs | 4 ++++ src/librustc_back/target/powerpc64_unknown_linux_gnu.rs | 3 +++ src/librustc_back/target/powerpc64le_unknown_linux_gnu.rs | 3 +++ src/librustc_back/target/powerpc_unknown_linux_gnu.rs | 3 +++ 12 files changed, 45 insertions(+) diff --git a/src/librustc_back/target/aarch64_unknown_linux_gnu.rs b/src/librustc_back/target/aarch64_unknown_linux_gnu.rs index b031de76fc3f3..5f6335d405f5e 100644 --- a/src/librustc_back/target/aarch64_unknown_linux_gnu.rs +++ b/src/librustc_back/target/aarch64_unknown_linux_gnu.rs @@ -13,6 +13,10 @@ use target::{Target, TargetOptions, TargetResult}; pub fn target() -> TargetResult { let mut base = super::linux_base::opts(); base.max_atomic_width = Some(128); + + // see #36994 + base.exe_allocation_crate = "alloc_system".to_string(); + Ok(Target { llvm_target: "aarch64-unknown-linux-gnu".to_string(), target_endian: "little".to_string(), diff --git a/src/librustc_back/target/mips64_unknown_linux_gnuabi64.rs b/src/librustc_back/target/mips64_unknown_linux_gnuabi64.rs index 9f0b6fcc4364c..c284840ecb4bd 100644 --- a/src/librustc_back/target/mips64_unknown_linux_gnuabi64.rs +++ b/src/librustc_back/target/mips64_unknown_linux_gnuabi64.rs @@ -25,6 +25,10 @@ pub fn target() -> TargetResult { cpu: "mips64r2".to_string(), features: "+mips64r2".to_string(), max_atomic_width: Some(64), + + // see #36994 + exe_allocation_crate: "alloc_system".to_string(), + ..super::linux_base::opts() }, }) diff --git a/src/librustc_back/target/mips64el_unknown_linux_gnuabi64.rs b/src/librustc_back/target/mips64el_unknown_linux_gnuabi64.rs index 9c4531c5b2124..17895836fe87b 100644 --- a/src/librustc_back/target/mips64el_unknown_linux_gnuabi64.rs +++ b/src/librustc_back/target/mips64el_unknown_linux_gnuabi64.rs @@ -25,6 +25,10 @@ pub fn target() -> TargetResult { cpu: "mips64r2".to_string(), features: "+mips64r2".to_string(), max_atomic_width: Some(64), + + // see #36994 + exe_allocation_crate: "alloc_system".to_string(), + ..super::linux_base::opts() }, }) diff --git a/src/librustc_back/target/mips_unknown_linux_gnu.rs b/src/librustc_back/target/mips_unknown_linux_gnu.rs index e744dce2bb4a1..a6d8fae2536ca 100644 --- a/src/librustc_back/target/mips_unknown_linux_gnu.rs +++ b/src/librustc_back/target/mips_unknown_linux_gnu.rs @@ -24,6 +24,10 @@ pub fn target() -> TargetResult { cpu: "mips32r2".to_string(), features: "+mips32r2".to_string(), max_atomic_width: Some(32), + + // see #36994 + exe_allocation_crate: "alloc_system".to_string(), + ..super::linux_base::opts() }, }) diff --git a/src/librustc_back/target/mips_unknown_linux_musl.rs b/src/librustc_back/target/mips_unknown_linux_musl.rs index 4254c1b83e319..e4a6d2a55d981 100644 --- a/src/librustc_back/target/mips_unknown_linux_musl.rs +++ b/src/librustc_back/target/mips_unknown_linux_musl.rs @@ -24,6 +24,10 @@ pub fn target() -> TargetResult { cpu: "mips32r2".to_string(), features: "+mips32r2,+soft-float".to_string(), max_atomic_width: Some(32), + + // see #36994 + exe_allocation_crate: "alloc_system".to_string(), + ..super::linux_base::opts() } }) diff --git a/src/librustc_back/target/mips_unknown_linux_uclibc.rs b/src/librustc_back/target/mips_unknown_linux_uclibc.rs index e6b2672a8e393..ccc64ea393b78 100644 --- a/src/librustc_back/target/mips_unknown_linux_uclibc.rs +++ b/src/librustc_back/target/mips_unknown_linux_uclibc.rs @@ -24,6 +24,10 @@ pub fn target() -> TargetResult { cpu: "mips32r2".to_string(), features: "+mips32r2,+soft-float".to_string(), max_atomic_width: Some(32), + + // see #36994 + exe_allocation_crate: "alloc_system".to_string(), + ..super::linux_base::opts() }, }) diff --git a/src/librustc_back/target/mipsel_unknown_linux_gnu.rs b/src/librustc_back/target/mipsel_unknown_linux_gnu.rs index 4949055861e57..9b8b1d5713f1d 100644 --- a/src/librustc_back/target/mipsel_unknown_linux_gnu.rs +++ b/src/librustc_back/target/mipsel_unknown_linux_gnu.rs @@ -25,6 +25,10 @@ pub fn target() -> TargetResult { cpu: "mips32".to_string(), features: "+mips32".to_string(), max_atomic_width: Some(32), + + // see #36994 + exe_allocation_crate: "alloc_system".to_string(), + ..super::linux_base::opts() }, }) diff --git a/src/librustc_back/target/mipsel_unknown_linux_musl.rs b/src/librustc_back/target/mipsel_unknown_linux_musl.rs index f282ac7e88b88..5693bddd0488a 100644 --- a/src/librustc_back/target/mipsel_unknown_linux_musl.rs +++ b/src/librustc_back/target/mipsel_unknown_linux_musl.rs @@ -24,6 +24,10 @@ pub fn target() -> TargetResult { cpu: "mips32".to_string(), features: "+mips32,+soft-float".to_string(), max_atomic_width: Some(32), + + // see #36994 + exe_allocation_crate: "alloc_system".to_string(), + ..super::linux_base::opts() } }) diff --git a/src/librustc_back/target/mipsel_unknown_linux_uclibc.rs b/src/librustc_back/target/mipsel_unknown_linux_uclibc.rs index 0f9b562068f51..3acade5a47444 100644 --- a/src/librustc_back/target/mipsel_unknown_linux_uclibc.rs +++ b/src/librustc_back/target/mipsel_unknown_linux_uclibc.rs @@ -25,6 +25,10 @@ pub fn target() -> TargetResult { cpu: "mips32".to_string(), features: "+mips32,+soft-float".to_string(), max_atomic_width: Some(32), + + // see #36994 + exe_allocation_crate: "alloc_system".to_string(), + ..super::linux_base::opts() }, }) diff --git a/src/librustc_back/target/powerpc64_unknown_linux_gnu.rs b/src/librustc_back/target/powerpc64_unknown_linux_gnu.rs index 333bfad4a2683..909c5488dcb70 100644 --- a/src/librustc_back/target/powerpc64_unknown_linux_gnu.rs +++ b/src/librustc_back/target/powerpc64_unknown_linux_gnu.rs @@ -16,6 +16,9 @@ pub fn target() -> TargetResult { base.pre_link_args.push("-m64".to_string()); base.max_atomic_width = Some(64); + // see #36994 + base.exe_allocation_crate = "alloc_system".to_string(); + Ok(Target { llvm_target: "powerpc64-unknown-linux-gnu".to_string(), target_endian: "big".to_string(), diff --git a/src/librustc_back/target/powerpc64le_unknown_linux_gnu.rs b/src/librustc_back/target/powerpc64le_unknown_linux_gnu.rs index e75da133314a4..a692346ca0ffe 100644 --- a/src/librustc_back/target/powerpc64le_unknown_linux_gnu.rs +++ b/src/librustc_back/target/powerpc64le_unknown_linux_gnu.rs @@ -16,6 +16,9 @@ pub fn target() -> TargetResult { base.pre_link_args.push("-m64".to_string()); base.max_atomic_width = Some(64); + // see #36994 + base.exe_allocation_crate = "alloc_system".to_string(); + Ok(Target { llvm_target: "powerpc64le-unknown-linux-gnu".to_string(), target_endian: "little".to_string(), diff --git a/src/librustc_back/target/powerpc_unknown_linux_gnu.rs b/src/librustc_back/target/powerpc_unknown_linux_gnu.rs index 45d28dd031f7e..284772c43319a 100644 --- a/src/librustc_back/target/powerpc_unknown_linux_gnu.rs +++ b/src/librustc_back/target/powerpc_unknown_linux_gnu.rs @@ -15,6 +15,9 @@ pub fn target() -> TargetResult { base.pre_link_args.push("-m32".to_string()); base.max_atomic_width = Some(32); + // see #36994 + base.exe_allocation_crate = "alloc_system".to_string(); + Ok(Target { llvm_target: "powerpc-unknown-linux-gnu".to_string(), target_endian: "big".to_string(),