Skip to content

Commit

Permalink
Detect more ELF symbol kinds
Browse files Browse the repository at this point in the history
This makes 2 changes to `SymbolKind` detection:
- `STT_NOTYPE` is detected as a label, since that's the default type
given to a label in assembly code. This is also used for mapping symbols
that are inserted by the assembler to indicate which addresses contain
code or data.
- `STT_GNU_IFUNC` is detected as a function symbol.
  • Loading branch information
Amanieu committed Jan 3, 2023
1 parent b3096ce commit f381978
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/read/elf/symbol.rs
Expand Up @@ -349,8 +349,9 @@ impl<'data, 'file, Elf: FileHeader, R: ReadRef<'data>> ObjectSymbol<'data>
fn kind(&self) -> SymbolKind {
match self.symbol.st_type() {
elf::STT_NOTYPE if self.index.0 == 0 => SymbolKind::Null,
elf::STT_NOTYPE => SymbolKind::Label,
elf::STT_OBJECT | elf::STT_COMMON => SymbolKind::Data,
elf::STT_FUNC => SymbolKind::Text,
elf::STT_FUNC | elf::STT_GNU_IFUNC => SymbolKind::Text,
elf::STT_SECTION => SymbolKind::Section,
elf::STT_FILE => SymbolKind::File,
elf::STT_TLS => SymbolKind::Tls,
Expand Down

0 comments on commit f381978

Please sign in to comment.