mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-10 13:56:19 +00:00
fix underflow in duration calculation
This commit is contained in:
parent
220f975ea8
commit
320aa504cd
1 changed files with 29 additions and 25 deletions
|
@ -2102,15 +2102,14 @@ fn surgery_elf_and_macho(
|
||||||
report_timing("Loading and mmap-ing", load_and_mmap_duration);
|
report_timing("Loading and mmap-ing", load_and_mmap_duration);
|
||||||
report_timing("Output Generation", out_gen_duration);
|
report_timing("Output Generation", out_gen_duration);
|
||||||
report_timing("Flushing Data to Disk", flushing_data_duration);
|
report_timing("Flushing Data to Disk", flushing_data_duration);
|
||||||
report_timing(
|
|
||||||
"Other",
|
let sum = loading_metadata_duration
|
||||||
total_duration
|
+ app_parsing_duration
|
||||||
- loading_metadata_duration
|
+ load_and_mmap_duration
|
||||||
- app_parsing_duration
|
+ out_gen_duration
|
||||||
- load_and_mmap_duration
|
+ flushing_data_duration;
|
||||||
- out_gen_duration
|
|
||||||
- flushing_data_duration,
|
report_timing("Other", total_duration.saturating_sub(sum));
|
||||||
);
|
|
||||||
report_timing("Total", total_duration);
|
report_timing("Total", total_duration);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2752,29 +2751,32 @@ fn surgery_elf(
|
||||||
};
|
};
|
||||||
if verbose {
|
if verbose {
|
||||||
println!(
|
println!(
|
||||||
"\t\tRelocation base location: {:+x} (virt: {:+x})",
|
"\t\tRelocation base location: {base:+x} (virt: {virt_base:+x})",
|
||||||
base, virt_base
|
|
||||||
);
|
);
|
||||||
println!("\t\tFinal relocation target offset: {:+x}", target);
|
println!("\t\tFinal relocation target offset: {target:+x}");
|
||||||
}
|
}
|
||||||
match rel.1.size() {
|
match rel.1.size() {
|
||||||
32 => {
|
32 => {
|
||||||
let data = (target as i32).to_le_bytes();
|
let data = (target as i32).to_le_bytes();
|
||||||
exec_mmap[base..base + 4].copy_from_slice(&data);
|
exec_mmap[base..][..4].copy_from_slice(&data);
|
||||||
}
|
}
|
||||||
64 => {
|
64 => {
|
||||||
let data = target.to_le_bytes();
|
let data = target.to_le_bytes();
|
||||||
exec_mmap[base..base + 8].copy_from_slice(&data);
|
exec_mmap[base..][..8].copy_from_slice(&data);
|
||||||
}
|
}
|
||||||
x => {
|
other => {
|
||||||
internal_error!("Relocation size not yet supported: {}", x);
|
internal_error!("Relocation size not yet supported: {other}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if matches!(app_obj.symbol_by_index(index), Ok(sym) if ["__divti3", "__udivti3"].contains(&sym.name().unwrap_or_default()))
|
|
||||||
{
|
|
||||||
// Explicitly ignore some symbols that are currently always linked.
|
|
||||||
continue;
|
|
||||||
} else {
|
} else {
|
||||||
|
// Explicitly ignore some symbols that are currently always linked.
|
||||||
|
const ALWAYS_LINKED: &[&str] = &["__divti3", "__udivti3"];
|
||||||
|
|
||||||
|
match app_obj.symbol_by_index(index) {
|
||||||
|
Ok(sym) if ALWAYS_LINKED.contains(&sym.name().unwrap_or_default()) => {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
_ => {
|
||||||
internal_error!(
|
internal_error!(
|
||||||
"Undefined Symbol in relocation, {:+x?}: {:+x?}",
|
"Undefined Symbol in relocation, {:+x?}: {:+x?}",
|
||||||
rel,
|
rel,
|
||||||
|
@ -2782,6 +2784,8 @@ fn surgery_elf(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_ => {
|
_ => {
|
||||||
internal_error!("Relocation target not yet support: {:+x?}", rel);
|
internal_error!("Relocation target not yet support: {:+x?}", rel);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue