OSDN Git Service

[ELF] Return the section name when calling getSymbolName on a section symbol.
authorMatt Davis <Matthew.Davis@sony.com>
Thu, 31 Jan 2019 19:42:21 +0000 (19:42 +0000)
committerMatt Davis <Matthew.Davis@sony.com>
Thu, 31 Jan 2019 19:42:21 +0000 (19:42 +0000)
commit7fac036c204bd0273ecf3cb5980b8d5c06aca9f7
tree8698a50c7f7c1f3e2a776217e5319c5ff5a22b17
parent6980a884f19f17bea78f1f2921f1c1197a1195ed
[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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@352785 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Object/ELFObjectFile.h
test/Object/nm-trivial-object.test
tools/llvm-objdump/llvm-objdump.cpp