aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-objdump/llvm-objdump.cpp
diff options
context:
space:
mode:
authorMatt Davis <Matthew.Davis@sony.com>2019-01-31 19:42:21 +0000
committerMatt Davis <Matthew.Davis@sony.com>2019-01-31 19:42:21 +0000
commit82937e44bd70c6141593427ce677d9c9f991d0a0 (patch)
treee503623a41161f8bf1c97768d3d21c0ac2ea36b7 /llvm/tools/llvm-objdump/llvm-objdump.cpp
parent4061b440575e9e52fd50c8c95bc94aa597f93cc3 (diff)
downloadllvm-82937e44bd70c6141593427ce677d9c9f991d0a0.zip
llvm-82937e44bd70c6141593427ce677d9c9f991d0a0.tar.gz
llvm-82937e44bd70c6141593427ce677d9c9f991d0a0.tar.bz2
[ELF] Return the section name when calling getSymbolName on a section symbol.
Summary: Previously, llvm-nm would report symbols for .debug and .note sections as: '?' with an empty section name: ``` 00000000 ? 00000000 ? ... ``` With this patch the output more closely resembles GNU nm: ``` 00000000 N .debug_abbrev 00000000 n .note.GNU-stack ... ``` This patch calls `getSectionName` for sections that belong to symbols of type `ELF::STT_SECTION`, which returns the name of the section from the section string table. Reviewers: Bigcheese, davide, jhenderson Reviewed By: davide, jhenderson Subscribers: rupprecht, jhenderson, llvm-commits Differential Revision: https://reviews.llvm.org/D57105 llvm-svn: 352785
Diffstat (limited to 'llvm/tools/llvm-objdump/llvm-objdump.cpp')
-rw-r--r--llvm/tools/llvm-objdump/llvm-objdump.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp b/llvm/tools/llvm-objdump/llvm-objdump.cpp
index 87ed8bb..a82ed09 100644
--- a/llvm/tools/llvm-objdump/llvm-objdump.cpp
+++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp
@@ -941,8 +941,11 @@ static void disassembleObject(const Target *TheTarget, const ObjectFile *Obj,
report_error(Obj->getFileName(), SectionOrErr.takeError());
uint8_t SymbolType = ELF::STT_NOTYPE;
- if (Obj->isELF())
+ if (Obj->isELF()) {
SymbolType = getElfSymbolType(Obj, Symbol);
+ if (SymbolType == ELF::STT_SECTION)
+ continue;
+ }
section_iterator SecI = *SectionOrErr;
if (SecI != Obj->section_end())