1
0
Fork 0

Don't filter ELF exports by functions

Since we export a constant for CLAP.
This commit is contained in:
Robbert van der Helm 2022-02-28 15:17:04 +01:00
parent f0504ed59a
commit ab30b7dc9d

View file

@ -10,11 +10,11 @@ pub fn exported<P: AsRef<Path>>(binary: P, symbol: &str) -> Result<bool> {
let bytes = fs::read(&binary)
.with_context(|| format!("Could not read '{}'", binary.as_ref().display()))?;
match goblin::Object::parse(&bytes)? {
goblin::Object::Elf(obj) => Ok(obj.dynsyms.iter().any(|sym| {
!sym.is_import()
&& sym.is_function()
&& obj.dynstrtab.get_at(sym.st_name) == Some(symbol)
})),
goblin::Object::Elf(obj) => Ok(obj
.dynsyms
.iter()
// We don't filter by functions here since we need to export a constant for CLAP
.any(|sym| !sym.is_import() && obj.dynstrtab.get_at(sym.st_name) == Some(symbol))),
goblin::Object::Mach(obj) => {
let obj = match obj {
goblin::mach::Mach::Fat(arches) => arches