]> git.lizzy.rs Git - rust.git/commitdiff
rustc: Don't use jemalloc when crossing to MSVC
authorAlex Crichton <alex@alexcrichton.com>
Fri, 25 Sep 2015 23:26:23 +0000 (16:26 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Fri, 25 Sep 2015 23:26:23 +0000 (16:26 -0700)
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.

src/librustc_back/target/apple_base.rs
src/librustc_back/target/bitrig_base.rs
src/librustc_back/target/dragonfly_base.rs
src/librustc_back/target/freebsd_base.rs
src/librustc_back/target/linux_base.rs
src/librustc_back/target/mod.rs
src/librustc_back/target/openbsd_base.rs
src/librustc_back/target/windows_base.rs
src/librustc_back/target/windows_msvc_base.rs

index 0c4e28d97000834e05c50657fe9817b33cbf82b6..8b75bb3941477b356aef4df75b75e253961f5614 100644 (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()
     }
 }
index 96680dc37596551dfa273331ac7f0303e398fa3c..2b84244cda4a2ef2f903bd532867e770a2fc9d4c 100644 (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()
     }
index 41c5f36099e8012a3cf99824d11e937cc3a118bf..b78fdc9f59ba1103063cb2863e1ab87efaf5fa80 100644 (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()
     }
 }
index a5807d2787fdd726ebf4b5fda601c93696e614a9..e955f8c302bd64977a0b8c84e0d17c49bd153963 100644 (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()
     }
index d6b50a955b6829ddc6d54dc14c548dd4d72946dd..6492fa5015970e07ca149a11c3ab32866dadf997 100644 (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()
     }
 }
index e7c1c3fb258adad6a490e587295d0fbbc699beca..771c2b45e1fabbb40531c9aeb8bcb83d205b6165 100644 (file)
@@ -449,7 +449,7 @@ macro_rules! load_specific {
     }
 }
 
-fn best_allocator() -> String {
+fn maybe_jemalloc() -> String {
     if cfg!(disable_jemalloc) {
         "alloc_system".to_string()
     } else {
index 3b02111d93444fbd4cdf34e739890494438da72e..2e4aa27cf889d22659b909e2221c5e5e6d9d8182 100644 (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()
     }
 }
index 8d089bb43ad5019a5001e9d9f9563d6dc760895d..2e5973679022d7c05a56544db0e9cd84ff2c6fc9 100644 (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()
     }
index fe9ac32ee8fb5251483ef3f8a55d1f98ec2455aa..fb88ce158e4b3db5e0f25d217101df06ac247dec 100644 (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()
     }