rustc: Don't use jemalloc when crossing to MSVC

This commit updates the compiler to not attempt to use jemalloc for platforms
where jemalloc is never enabled. Currently the compiler attempts to link in
jemalloc based on whether `--disable-jemalloc` was specified at build time for
the compiler itself, but this is only the right decision for the host target,
not for other targets.

This still leaves a hole open where a set of target libraries are downloaded
which were built with `--disable-jemalloc` and the compiler is unaware of that,
but this is a pretty rare case so it can always be fixed later.
This commit is contained in:
Alex Crichton 2015-09-25 16:26:23 -07:00
parent 8fe79bdfda
commit 747f0be082
9 changed files with 9 additions and 9 deletions

View File

@ -24,7 +24,7 @@ pub fn opts() -> TargetOptions {
dll_suffix: ".dylib".to_string(),
archive_format: "bsd".to_string(),
pre_link_args: Vec::new(),
exe_allocation_crate: super::best_allocator(),
exe_allocation_crate: super::maybe_jemalloc(),
.. Default::default()
}
}

View File

@ -20,7 +20,7 @@ pub fn opts() -> TargetOptions {
has_rpath: true,
position_independent_executables: true,
archive_format: "gnu".to_string(),
exe_allocation_crate: super::best_allocator(),
exe_allocation_crate: "alloc_system".to_string(),
.. Default::default()
}

View File

@ -27,7 +27,7 @@ pub fn opts() -> TargetOptions {
),
position_independent_executables: true,
archive_format: "gnu".to_string(),
exe_allocation_crate: super::best_allocator(),
exe_allocation_crate: super::maybe_jemalloc(),
.. Default::default()
}
}

View File

@ -18,7 +18,7 @@ pub fn opts() -> TargetOptions {
executables: true,
has_rpath: true,
archive_format: "gnu".to_string(),
exe_allocation_crate: super::best_allocator(),
exe_allocation_crate: super::maybe_jemalloc(),
.. Default::default()
}

View File

@ -29,7 +29,7 @@ pub fn opts() -> TargetOptions {
],
position_independent_executables: true,
archive_format: "gnu".to_string(),
exe_allocation_crate: super::best_allocator(),
exe_allocation_crate: super::maybe_jemalloc(),
.. Default::default()
}
}

View File

@ -449,7 +449,7 @@ impl Target {
}
}
fn best_allocator() -> String {
fn maybe_jemalloc() -> String {
if cfg!(disable_jemalloc) {
"alloc_system".to_string()
} else {

View File

@ -27,7 +27,7 @@ pub fn opts() -> TargetOptions {
),
position_independent_executables: true,
archive_format: "gnu".to_string(),
exe_allocation_crate: super::best_allocator(),
exe_allocation_crate: "alloc_system".to_string(),
.. Default::default()
}
}

View File

@ -64,7 +64,7 @@ pub fn opts() -> TargetOptions {
// Always enable DEP (NX bit) when it is available
"-Wl,--nxcompat".to_string(),
),
exe_allocation_crate: super::best_allocator(),
exe_allocation_crate: super::maybe_jemalloc(),
.. Default::default()
}

View File

@ -60,7 +60,7 @@ pub fn opts() -> TargetOptions {
"/NXCOMPAT".to_string(),
],
archive_format: "gnu".to_string(),
exe_allocation_crate: super::best_allocator(),
exe_allocation_crate: "alloc_system".to_string(),
.. Default::default()
}