mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-13 15:26:24 +00:00
Fix a couple of preprocessed host bugs
This commit is contained in:
parent
d9f3e11634
commit
c0b065b51a
2 changed files with 13 additions and 22 deletions
|
@ -163,13 +163,8 @@ pub fn build_file<'a>(
|
|||
})
|
||||
.collect();
|
||||
|
||||
let preprocessed_host_path = match linking_strategy {
|
||||
LinkingStrategy::Surgical | LinkingStrategy::Additive => {
|
||||
host_input_path.with_file_name(preprocessed_host_filename(target).unwrap())
|
||||
}
|
||||
LinkingStrategy::Legacy => host_input_path
|
||||
.with_file_name(legacy_host_filename(target, code_gen_options.opt_level).unwrap()),
|
||||
};
|
||||
let preprocessed_host_path =
|
||||
host_input_path.with_file_name(preprocessed_host_filename(target).unwrap());
|
||||
|
||||
// We don't need to spawn a rebuild thread when using a prebuilt host.
|
||||
let rebuild_thread = if prebuilt {
|
||||
|
@ -182,12 +177,6 @@ pub fn build_file<'a>(
|
|||
std::process::exit(1);
|
||||
}
|
||||
|
||||
if linking_strategy == LinkingStrategy::Surgical {
|
||||
// Copy preprocessed host to executable location.
|
||||
// The surgical linker will modify that copy in-place.
|
||||
std::fs::copy(&preprocessed_host_path, binary_path.as_path()).unwrap();
|
||||
}
|
||||
|
||||
None
|
||||
} else {
|
||||
Some(spawn_rebuild_thread(
|
||||
|
@ -202,6 +191,12 @@ pub fn build_file<'a>(
|
|||
))
|
||||
};
|
||||
|
||||
if linking_strategy == LinkingStrategy::Surgical {
|
||||
// Copy preprocessed host to executable location.
|
||||
// The surgical linker will modify that copy in-place.
|
||||
std::fs::copy(&preprocessed_host_path, binary_path.as_path()).unwrap();
|
||||
}
|
||||
|
||||
let buf = &mut String::with_capacity(1024);
|
||||
|
||||
let mut it = loaded.timings.iter().peekable();
|
||||
|
@ -441,6 +436,9 @@ fn spawn_rebuild_thread(
|
|||
exported_symbols,
|
||||
exported_closure_types,
|
||||
);
|
||||
|
||||
// Copy preprocessed host to executable location.
|
||||
std::fs::copy(preprocessed_host_path, binary_path.as_path()).unwrap();
|
||||
}
|
||||
LinkingStrategy::Legacy => {
|
||||
rebuild_host(
|
||||
|
@ -452,14 +450,7 @@ fn spawn_rebuild_thread(
|
|||
}
|
||||
}
|
||||
|
||||
if linking_strategy == LinkingStrategy::Surgical {
|
||||
// Copy preprocessed host to executable location.
|
||||
std::fs::copy(preprocessed_host_path, binary_path.as_path()).unwrap();
|
||||
}
|
||||
|
||||
let rebuild_host_end = rebuild_host_start.elapsed();
|
||||
|
||||
rebuild_host_end.as_millis()
|
||||
rebuild_host_start.elapsed().as_millis()
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -134,7 +134,7 @@ pub const fn preprocessed_host_filename(target: &Triple) -> Option<&'static str>
|
|||
|
||||
/// Same format as the precompiled host filename, except with a file extension like ".o" or ".obj"
|
||||
pub fn legacy_host_filename(target: &Triple, opt_level: OptLevel) -> Option<String> {
|
||||
let os = roc_target::OperatingSystem::new(target.operating_system)?;
|
||||
let os = roc_target::OperatingSystem::from(target.operating_system);
|
||||
let ext = legacy_host_filename_ext(os, opt_level);
|
||||
|
||||
Some(preprocessed_host_filename(target)?.replace(PRECOMPILED_HOST_EXT, ext))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue