about summary refs log tree commit diff
path: root/src/allocator.rs
diff options
context:
space:
mode:
authorbjorn3 <bjorn3@users.noreply.github.com>2018-12-13 15:16:46 +0100
committerbjorn3 <bjorn3@users.noreply.github.com>2018-12-13 15:24:14 +0100
commitc8d435aade4db3e51eb2414293a8e0d7934bd17a (patch)
tree58f25e31c8536242fd7316e008df898d70c926b8 /src/allocator.rs
parent77e36125812c257c68a89d56e6dad30e6c081ebe (diff)
downloadrust-c8d435aade4db3e51eb2414293a8e0d7934bd17a.tar.gz
rust-c8d435aade4db3e51eb2414293a8e0d7934bd17a.zip
Put allocator shim in a different object file
Diffstat (limited to 'src/allocator.rs')
-rw-r--r--src/allocator.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/allocator.rs b/src/allocator.rs
index 9c444d8cfc5..1cc45a7d93b 100644
--- a/src/allocator.rs
+++ b/src/allocator.rs
@@ -13,7 +13,8 @@ use crate::prelude::*;
 use rustc::middle::allocator::AllocatorKind;
 use rustc_allocator::{AllocatorTy, ALLOCATOR_METHODS};
 
-pub fn codegen(sess: &Session, module: &mut Module<impl Backend + 'static>) {
+/// Returns whether an allocator shim was created
+pub fn codegen(sess: &Session, module: &mut Module<impl Backend + 'static>) -> bool {
     let any_dynamic_crate = sess
         .dependency_formats
         .borrow()
@@ -23,8 +24,12 @@ pub fn codegen(sess: &Session, module: &mut Module<impl Backend + 'static>) {
             list.iter().any(|&linkage| linkage == Linkage::Dynamic)
         });
     if any_dynamic_crate {
+        false
     } else if let Some(kind) = *sess.allocator_kind.get() {
         codegen_inner(module, kind);
+        true
+    } else {
+        false
     }
 }