diff options
| author | Matt Davis <Matthew.Davis@sony.com> | 2019-01-31 19:42:21 +0000 |
|---|---|---|
| committer | Matt Davis <Matthew.Davis@sony.com> | 2019-01-31 19:42:21 +0000 |
| commit | 82937e44bd70c6141593427ce677d9c9f991d0a0 (patch) | |
| tree | e503623a41161f8bf1c97768d3d21c0ac2ea36b7 /llvm/tools/llvm-objdump | |
| parent | 4061b440575e9e52fd50c8c95bc94aa597f93cc3 (diff) | |
| download | bcm5719-llvm-82937e44bd70c6141593427ce677d9c9f991d0a0.tar.gz bcm5719-llvm-82937e44bd70c6141593427ce677d9c9f991d0a0.zip | |
[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')
| -rw-r--r-- | llvm/tools/llvm-objdump/llvm-objdump.cpp | 5 |
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 87ed8bbe6ab..a82ed0974fb 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()) |

