Fix exported symbol detection on macOS
Apparently all exported symbols in Mach-O are prefixed with an underscore.
This commit is contained in:
parent
e4e0fd2da2
commit
a8f66af147
|
@ -23,6 +23,9 @@ pub fn exported<P: AsRef<Path>>(binary: P, symbol: &str) -> Result<bool> {
|
||||||
goblin::mach::Mach::Binary(obj) => obj,
|
goblin::mach::Mach::Binary(obj) => obj,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// XXX: Why are all exported symbols on macOS prefixed with an underscore?
|
||||||
|
let symbol = format!("_{}", symbol);
|
||||||
|
|
||||||
Ok(obj.exports()?.into_iter().any(|sym| sym.name == symbol))
|
Ok(obj.exports()?.into_iter().any(|sym| sym.name == symbol))
|
||||||
}
|
}
|
||||||
goblin::Object::PE(obj) => Ok(obj.exports.iter().any(|sym| sym.name == Some(symbol))),
|
goblin::Object::PE(obj) => Ok(obj.exports.iter().any(|sym| sym.name == Some(symbol))),
|
||||||
|
|
Loading…
Reference in a new issue