Skip to content

Commit

Permalink
read/coff: improve detection of auxiliary symbols for sections (gimli…
Browse files Browse the repository at this point in the history
…-rs#603)

Previously we wrongly excluded section symbols with non-zero values,
and wrongly included function symbols with zero values.

This also means that we give them the correct symbol kind,
and that we exclude them from the symbol map.

Note that we still don't give the correct symbol kind to
section symbols that don't have an auxiliary symbol.
  • Loading branch information
philipc authored Nov 30, 2023
1 parent a71b18e commit 1b5fa9b
Show file tree
Hide file tree
Showing 5 changed files with 5,726 additions and 1,055 deletions.
3 changes: 2 additions & 1 deletion crates/examples/testfiles/pe/base-bigobj.o.objdump
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Segment { name: ".rdata$zzz", address: 0, size: 0 }

Symbols
0: Symbol { name: "base.c", address: 0, size: 0, kind: File, section: None, scope: Compilation, weak: false, flags: None }
2: Symbol { name: "printf", address: 0, size: 0, kind: Section, section: Section(SectionIndex(1)), scope: Compilation, weak: false, flags: CoffSection { selection: 0, associative_section: None } }
2: Symbol { name: "printf", address: 0, size: 0, kind: Text, section: Section(SectionIndex(1)), scope: Compilation, weak: false, flags: None }
4: Symbol { name: "main", address: 51, size: 0, kind: Text, section: Section(SectionIndex(1)), scope: Linkage, weak: false, flags: None }
5: Symbol { name: ".text", address: 0, size: 75, kind: Section, section: Section(SectionIndex(1)), scope: Compilation, weak: false, flags: CoffSection { selection: 0, associative_section: None } }
7: Symbol { name: ".data", address: 0, size: 0, kind: Section, section: Section(SectionIndex(2)), scope: Compilation, weak: false, flags: CoffSection { selection: 0, associative_section: None } }
Expand Down Expand Up @@ -51,4 +51,5 @@ Symbols
Dynamic symbols

Symbol map
0x0 "printf"
0x51 "main"
Loading

0 comments on commit 1b5fa9b

Please sign in to comment.