llvm-nm: Don't print mapping symbols.

This matches the behavior of gnu nm. Fixes pr23930.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240695 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola 2015-06-25 21:00:51 +00:00
parent 5c09803aee
commit 0999c2c69c
2 changed files with 20 additions and 0 deletions

View File

@ -394,6 +394,15 @@ uint32_t ELFObjectFile<ELFT>::getSymbolFlags(DataRefImpl Symb) const {
EIter == EF.begin_symbols() || EIter == EF.begin_dynamic_symbols())
Result |= SymbolRef::SF_FormatSpecific;
if (EF.getHeader()->e_machine == ELF::EM_ARM) {
if (ErrorOr<StringRef> NameOrErr = EF.getSymbolName(EIter)) {
StringRef Name = *NameOrErr;
if (Name.startswith("$d") || Name.startswith("$t") ||
Name.startswith("$a"))
Result |= SymbolRef::SF_FormatSpecific;
}
}
if (ESym->st_shndx == ELF::SHN_UNDEF)
Result |= SymbolRef::SF_Undefined;

View File

@ -0,0 +1,11 @@
// RUN: llvm-mc %s -o %t.o -filetype=obj -triple=armv7-pc-linux
// RUN: llvm-readobj -t %t.o | FileCheck %s
// RUN: llvm-nm %t.o | FileCheck -allow-empty --check-prefix=NM %s
// Test that nm doesn't print the mapping symbols
// CHECK: Name: $d.0
// NM-NOT: $d.0
.section .foobar,"",%progbits
.asciz "foo"