llvm-nm: Don't print mapping symbols.

This matches the behavior of gnu nm. Fixes pr23930.

llvm-svn: 240695
This commit is contained in:
Rafael Espindola 2015-06-25 21:00:51 +00:00
parent c2ffa0891f
commit b298fbcfdd
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"