1
Fork 0
This commit is contained in:
bjorn3 2019-09-14 15:15:06 +02:00
parent 554a1aa0ba
commit b267995f39

View file

@ -164,8 +164,7 @@ fn run_aot(
module module
}; };
let emit_module = |name: &str, let emit_module = |kind: ModuleKind,
kind: ModuleKind,
mut module: Module<FaerieBackend>, mut module: Module<FaerieBackend>,
debug: Option<DebugContext>| { debug: Option<DebugContext>| {
module.finalize_definitions(); module.finalize_definitions();
@ -177,11 +176,11 @@ fn run_aot(
let tmp_file = tcx let tmp_file = tcx
.output_filenames(LOCAL_CRATE) .output_filenames(LOCAL_CRATE)
.temp_path(OutputType::Object, Some(name)); .temp_path(OutputType::Object, Some(&artifact.name));
let obj = artifact.emit().unwrap(); let obj = artifact.emit().unwrap();
std::fs::write(&tmp_file, obj).unwrap(); std::fs::write(&tmp_file, obj).unwrap();
CompiledModule { CompiledModule {
name: name.to_string(), name: artifact.name,
kind, kind,
object: Some(tmp_file), object: Some(tmp_file),
bytecode: None, bytecode: None,
@ -208,7 +207,7 @@ fn run_aot(
tcx.sess.abort_if_errors(); tcx.sess.abort_if_errors();
let mut allocator_module = new_module("allocator_shim.o".to_string()); let mut allocator_module = new_module("allocator_shim".to_string());
let created_alloc_shim = crate::allocator::codegen(tcx.sess, &mut allocator_module); let created_alloc_shim = crate::allocator::codegen(tcx.sess, &mut allocator_module);
rustc_incremental::assert_dep_graph(tcx); rustc_incremental::assert_dep_graph(tcx);
@ -251,14 +250,12 @@ fn run_aot(
Box::new(CodegenResults { Box::new(CodegenResults {
crate_name: tcx.crate_name(LOCAL_CRATE), crate_name: tcx.crate_name(LOCAL_CRATE),
modules: vec![emit_module( modules: vec![emit_module(
"dummy_name",
ModuleKind::Regular, ModuleKind::Regular,
faerie_module, faerie_module,
debug, debug,
)], )],
allocator_module: if created_alloc_shim { allocator_module: if created_alloc_shim {
Some(emit_module( Some(emit_module(
"allocator_shim",
ModuleKind::Allocator, ModuleKind::Allocator,
allocator_module, allocator_module,
None, None,