mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 23:04:49 +00:00
refactor: remove duplicate symbol functions from macho module
This commit is contained in:
parent
720ed2a457
commit
3fe2a4cd13
1 changed files with 2 additions and 21 deletions
|
@ -15,7 +15,7 @@ use std::{
|
||||||
io::{BufReader, BufWriter},
|
io::{BufReader, BufWriter},
|
||||||
mem,
|
mem,
|
||||||
path::Path,
|
path::Path,
|
||||||
time::{Duration, Instant},
|
time::Instant,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
@ -23,6 +23,7 @@ use crate::{
|
||||||
load_struct_inplace_mut, load_structs_inplace, load_structs_inplace_mut, open_mmap,
|
load_struct_inplace_mut, load_structs_inplace, load_structs_inplace_mut, open_mmap,
|
||||||
open_mmap_mut,
|
open_mmap_mut,
|
||||||
};
|
};
|
||||||
|
use crate::util::{report_timing, is_roc_undefined, is_roc_definition};
|
||||||
|
|
||||||
const MIN_SECTION_ALIGNMENT: usize = 0x40;
|
const MIN_SECTION_ALIGNMENT: usize = 0x40;
|
||||||
|
|
||||||
|
@ -104,26 +105,6 @@ impl Metadata {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn report_timing(label: &str, duration: Duration) {
|
|
||||||
println!("\t{:9.3} ms {}", duration.as_secs_f64() * 1000.0, label,);
|
|
||||||
}
|
|
||||||
|
|
||||||
fn is_roc_symbol(sym: &object::Symbol) -> bool {
|
|
||||||
if let Ok(name) = sym.name() {
|
|
||||||
name.trim_start_matches('_').starts_with("roc_")
|
|
||||||
} else {
|
|
||||||
false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn is_roc_definition(sym: &object::Symbol) -> bool {
|
|
||||||
sym.is_definition() && is_roc_symbol(sym)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn is_roc_undefined(sym: &object::Symbol) -> bool {
|
|
||||||
sym.is_undefined() && is_roc_symbol(sym)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn collect_roc_definitions<'a>(object: &object::File<'a, &'a [u8]>) -> MutMap<String, u64> {
|
fn collect_roc_definitions<'a>(object: &object::File<'a, &'a [u8]>) -> MutMap<String, u64> {
|
||||||
let mut vaddresses = MutMap::default();
|
let mut vaddresses = MutMap::default();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue