Small fix for llvm-nm handling of weak symbols on ELF (print 'v').

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200808 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola 2014-02-04 23:53:15 +00:00
parent 524f08d603
commit 7e369ff2e5
3 changed files with 12 additions and 2 deletions

Binary file not shown.

View File

@ -6,6 +6,8 @@ RUN: llvm-nm %p/Inputs/trivial-object-test.elf-i386 \
RUN: | FileCheck %s -check-prefix ELF
RUN: llvm-nm %p/Inputs/trivial-object-test.elf-x86-64 \
RUN: | FileCheck %s -check-prefix ELF
RUN: llvm-nm %p/Inputs/weak.elf-x86-64 \
RUN: | FileCheck %s -check-prefix WEAK-ELF
RUN: llvm-nm %p/Inputs/trivial-object-test.macho-i386 \
RUN: | FileCheck %s -check-prefix macho
RUN: llvm-nm %p/Inputs/trivial-object-test.macho-x86-64 \
@ -34,6 +36,10 @@ ELF: U SomeOtherFunction
ELF: 00000000 T main
ELF: U puts
WEAK-ELF: w f1
WEAK-ELF: 00000000 W f2
WEAK-ELF: v x1
WEAK-ELF: 00000000 V x2
macho: 00000000 U _SomeOtherFunction
macho: 00000000 T _main

View File

@ -360,8 +360,12 @@ static char getSymbolNMTypeChar(ELFObjectFile<ELFT> &Obj, symbol_iterator I) {
Ret = ::toupper(Ret);
break;
case ELF::STB_WEAK:
if (EF.getSymbolTableIndex(ESym) == ELF::SHN_UNDEF)
Ret = 'w';
if (EF.getSymbolTableIndex(ESym) == ELF::SHN_UNDEF) {
if (ESym->getType() == ELF::STT_OBJECT)
Ret = 'v';
else
Ret = 'w';
}
else if (ESym->getType() == ELF::STT_OBJECT)
Ret = 'V';
else