fix: calculate windows dll symbols from prebuilt shared library

This commit is contained in:
Ryan Barth 2024-06-30 22:56:14 -07:00
parent b92d0ef315
commit 720ed2a457
No known key found for this signature in database
GPG key ID: E00C3713D9ED3943
5 changed files with 46 additions and 45 deletions

23
crates/linker/src/util.rs Normal file
View file

@ -0,0 +1,23 @@
use std::time::Duration;
use object::ObjectSymbol;
pub(crate) 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
}
}
pub(crate) fn is_roc_definition(sym: &object::Symbol) -> bool {
sym.is_definition() && is_roc_symbol(sym)
}
pub(crate) fn is_roc_undefined(sym: &object::Symbol) -> bool {
sym.is_undefined() && is_roc_symbol(sym)
}