Skip to content

Commit 242153e

Browse files
committed
move COFF filters to obj/read.rs
1 parent 66c7b83 commit 242153e

File tree

2 files changed

+12
-22
lines changed

2 files changed

+12
-22
lines changed

objdiff-core/src/arch/ppc/mod.rs

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -358,28 +358,7 @@ impl Arch for ArchPpc {
358358
}
359359

360360
fn extra_symbol_flags(&self, symbol: &object::Symbol) -> SymbolFlagSet {
361-
// X360 COFFs should automatically hide all symbols starting with "except_data",
362-
// because those are not functions - they're pointers to exception data structs
363-
if self.extensions.eq(&powerpc::Extensions::xenon()) {
364-
match symbol.name() {
365-
Ok(name) => {
366-
if name.starts_with("except_data_"){
367-
SymbolFlag::Hidden.into()
368-
}
369-
// if the symbol name starts with __unwind and
370-
// TODO: a "show unwinds" modifier is unchecked,
371-
// hide the symbol
372-
else if name.starts_with("__unwind"){
373-
SymbolFlag::Hidden.into()
374-
}
375-
else {
376-
SymbolFlag::none()
377-
}
378-
}
379-
Err(_) => { SymbolFlag::none() }
380-
}
381-
}
382-
else if self.extab.as_ref().is_some_and(|extab| extab.contains_key(&(symbol.index().0 - 1))) {
361+
if self.extab.as_ref().is_some_and(|extab| extab.contains_key(&(symbol.index().0 - 1))) {
383362
SymbolFlag::HasExtra.into()
384363
} else {
385364
SymbolFlag::none()

objdiff-core/src/obj/read.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,17 @@ fn map_symbol(
7474
{
7575
flags |= SymbolFlag::Hidden;
7676
}
77+
if file.format() == object::BinaryFormat::Coff
78+
{
79+
match symbol.name(){
80+
Ok(name) => {
81+
if name.starts_with("except_data_") || name.starts_with("__unwind") || name.starts_with("__catch") {
82+
flags |= SymbolFlag::Hidden;
83+
}
84+
}
85+
Err(_) => {}
86+
}
87+
}
7788

7889
let kind = match symbol.kind() {
7990
object::SymbolKind::Text => SymbolKind::Function,

0 commit comments

Comments
 (0)