#![feature(link_args)]
#![feature(static_nobundle)]
#![feature(trusted_len)]
+#![recursion_limit = "256"]
use back::write::{create_informational_target_machine, create_target_machine};
use rustc_span::symbol::Symbol;
use rustc_errors::{FatalError, Handler};
use std::any::Any;
use std::ffi::CStr;
+use std::fs;
use std::sync::Arc;
use syntax::expand::allocator::AllocatorKind;
use rustc::util::common::ErrorReported;
use rustc_codegen_ssa::ModuleCodegen;
use rustc_codegen_utils::codegen_backend::CodegenBackend;
+use rustc_serialize::json;
mod back {
pub mod archive;
&self,
tcx: TyCtxt<'_>,
cgu_name: Symbol,
- tx: &std::sync::mpsc::Sender<Box<dyn Any + Send>>,
- ) {
- base::compile_codegen_unit(tcx, cgu_name, tx);
+ ) -> (ModuleCodegen<ModuleLlvm>, u64) {
+ base::compile_codegen_unit(tcx, cgu_name)
}
fn target_machine_factory(
&self,
return Ok(());
}
+ if sess.opts.debugging_opts.no_link {
+ // FIXME: use a binary format to encode the `.rlink` file
+ let rlink_data = json::encode(&codegen_results).map_err(|err| {
+ sess.fatal(&format!("failed to encode rlink: {}", err));
+ })?;
+ let rlink_file = outputs.with_extension("rlink");
+ fs::write(&rlink_file, rlink_data).map_err(|err| {
+ sess.fatal(&format!("failed to write file {}: {}", rlink_file.display(), err));
+ })?;
+ return Ok(());
+ }
+
// Run the linker on any artifacts that resulted from the LLVM run.
// This should produce either a finished executable or library.
sess.time("link_crate", || {