Skip to content

Commit

Permalink
Auto merge of #28668 - alexcrichton:crossing-with-jemalloc, r=nrc
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bors committed Sep 28, 2015
2 parents 638b260 + 747f0be commit 9e11845
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/librustc_back/target/apple_base.rs
Expand Up @@ -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()
}
}
2 changes: 1 addition & 1 deletion src/librustc_back/target/bitrig_base.rs
Expand Up @@ -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()
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_back/target/dragonfly_base.rs
Expand Up @@ -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()
}
}
2 changes: 1 addition & 1 deletion src/librustc_back/target/freebsd_base.rs
Expand Up @@ -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()
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_back/target/linux_base.rs
Expand Up @@ -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()
}
}
2 changes: 1 addition & 1 deletion src/librustc_back/target/mod.rs
Expand Up @@ -458,7 +458,7 @@ impl Target {
}
}

fn best_allocator() -> String {
fn maybe_jemalloc() -> String {
if cfg!(disable_jemalloc) {
"alloc_system".to_string()
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_back/target/openbsd_base.rs
Expand Up @@ -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()
}
}
2 changes: 1 addition & 1 deletion src/librustc_back/target/windows_base.rs
Expand Up @@ -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()
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_back/target/windows_msvc_base.rs
Expand Up @@ -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()
}
Expand Down

0 comments on commit 9e11845

Please sign in to comment.