Allocator shim

This commit is contained in:
bjorn3
2018-11-05 18:29:15 +01:00
parent f19f8e4b49
commit 4e4cad8a20
2 changed files with 94 additions and 0 deletions

View File

@@ -5,6 +5,7 @@ extern crate byteorder;
extern crate syntax;
#[macro_use]
extern crate rustc;
extern crate rustc_allocator;
extern crate rustc_codegen_utils;
extern crate rustc_incremental;
extern crate rustc_mir;
@@ -47,6 +48,7 @@ macro_rules! unimpl {
}
mod abi;
mod allocator;
mod analyze;
mod base;
mod common;
@@ -374,6 +376,17 @@ fn codegen_mono_items<'a, 'tcx: 'a>(
crate::main_shim::maybe_create_entry_wrapper(tcx, module);
let any_dynamic_crate = tcx.sess.dependency_formats.borrow()
.iter()
.any(|(_, list)| {
use crate::rustc::middle::dependency_format::Linkage;
list.iter().any(|&linkage| linkage == Linkage::Dynamic)
});
if any_dynamic_crate {
} else if let Some(kind) = *tcx.sess.allocator_kind.get() {
allocator::codegen(tcx, module, kind);
}
ccx.finalize(tcx, module);
let after = ::std::time::Instant::now();