mirror of
https://github.com/roc-lang/roc.git
synced 2025-07-24 06:55:15 +00:00
refactor collect_roc_definitions for MachO
I don't think we need to check for '@' in symbol naming as versioning is not done on a symbol level for MachO as far as I remember (unlike for Linux).
This commit is contained in:
parent
f847770f6e
commit
32b9274dad
1 changed files with 10 additions and 11 deletions
|
@ -109,20 +109,19 @@ fn collect_roc_definitions<'a>(object: &object::File<'a, &'a [u8]>) -> MutMap<St
|
|||
let mut vaddresses = MutMap::default();
|
||||
|
||||
for sym in object.symbols().filter(is_roc_definition) {
|
||||
// remove potentially trailing "@version".
|
||||
let name = sym
|
||||
.name()
|
||||
.unwrap()
|
||||
.trim_start_matches('_')
|
||||
.split('@')
|
||||
.next()
|
||||
.unwrap();
|
||||
|
||||
let name = sym.name().unwrap().trim_start_matches('_');
|
||||
let address = sym.address();
|
||||
|
||||
// special exceptions for memcpy and memset.
|
||||
if name == "roc_memset" {
|
||||
vaddresses.insert("memset".to_string(), address);
|
||||
let direct_mapping = match name {
|
||||
"roc_memset" => Some("memset"),
|
||||
"roc_memmove" => Some("memmove"),
|
||||
|
||||
_ => None,
|
||||
};
|
||||
|
||||
if let Some(libc_symbol) = direct_mapping {
|
||||
vaddresses.insert(libc_symbol.to_string(), address);
|
||||
}
|
||||
|
||||
vaddresses.insert(name.to_string(), address);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue