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;
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", || {