DebugInfo/Symbolize: Allow STT_NOTYPE/STT_GNU_IFUNC symbols for .symtab symbolization
authorFangrui Song <i@maskray.me>
Mon, 8 Feb 2021 20:29:11 +0000 (12:29 -0800)
committerFangrui Song <i@maskray.me>
Mon, 8 Feb 2021 20:29:11 +0000 (12:29 -0800)
commit6d766c8bf9df3c22590a78c77879080736ad55ae
tree3497efed448025cab2d24c8d092b621c07ec0716
parent4c9adbb287e7e6cfea866b3c3254b50f21e5ce1f
DebugInfo/Symbolize: Allow STT_NOTYPE/STT_GNU_IFUNC symbols for .symtab symbolization

In assembly files, omitting `.type foo,@function` is common. Such functions have
type `STT_NOTYPE` and llvm-symbolizer reports `??` for them.

An ifunc symbol usually has an associated resolver symbol which is defined at
the same address. Returning either one is fine for symbolization. The resolver
symbol may not end up in the symbol table if (object file) `.L` is used (linked
image) .symtab is stripped while .dynsym is retained.

This patch allows ELF STT_NOTYPE/STT_GNU_IFUNC symbols for .symtab symbolization.

I have left TODO in the test files for an unimplemented STT_FILE heuristic.

Differential Revision: https://reviews.llvm.org/D95916
llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp
llvm/test/DebugInfo/Symbolize/ELF/symtab-file.s [new file with mode: 0644]
llvm/test/DebugInfo/Symbolize/ELF/symtab-ifunc.s [new file with mode: 0644]
llvm/test/DebugInfo/Symbolize/ELF/symtab-ignored.s [new file with mode: 0644]
llvm/test/DebugInfo/Symbolize/ELF/symtab-notype.s [new file with mode: 0644]