mirror of
https://github.com/encounter/objdiff.git
synced 2025-12-12 22:56:19 +00:00
Ignore extern symbols with symbol name lookups
When searching for a symbol by name, only look at symbols that are defined within the object, ignoring extern symbols (symbols without section). Fixes #180 Fixes #181
This commit is contained in:
@@ -308,6 +308,10 @@ impl Object {
|
||||
let offset = symbol.address.checked_sub(section.address)?;
|
||||
section.data.get(offset as usize..offset as usize + symbol.size as usize)
|
||||
}
|
||||
|
||||
pub fn symbol_by_name(&self, name: &str) -> Option<usize> {
|
||||
self.symbols.iter().position(|symbol| symbol.section.is_some() && symbol.name == name)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Eq, PartialEq, Hash)]
|
||||
|
||||
Reference in New Issue
Block a user