diff options
| author | bjorn3 <bjorn3@users.noreply.github.com> | 2018-11-05 18:29:15 +0100 |
|---|---|---|
| committer | bjorn3 <bjorn3@users.noreply.github.com> | 2018-11-05 18:29:15 +0100 |
| commit | 4e4cad8a205276bdaf577a81b6af5102fbc2ee15 (patch) | |
| tree | 3ae13b0e2bf291b33b53a18672287057dfa8615c /src/lib.rs | |
| parent | f19f8e4b4961e279cfe389bb177b86ea97613dbc (diff) | |
| download | rust-4e4cad8a205276bdaf577a81b6af5102fbc2ee15.tar.gz rust-4e4cad8a205276bdaf577a81b6af5102fbc2ee15.zip | |
Allocator shim
Diffstat (limited to 'src/lib.rs')
| -rw-r--r-- | src/lib.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs index c9ca758e55a..013dbc510d8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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(); |
