Fix a nomenclature error in llvm-nm.

What llvm-nm prints depends on the file format. On ELF for example, if the
file is relocatable, it prints offsets. If it is not, it prints addresses.
Since it doesn't really need to care what it is that it is printing, use the
generic term value.

Fix or implement getSymbolValue to keep llvm-nm working.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205479 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola
2014-04-02 22:52:46 +00:00
parent d7e2a48153
commit 5a61b72493
4 changed files with 47 additions and 31 deletions

View File

@ -417,7 +417,15 @@ template <class ELFT>
error_code ELFObjectFile<ELFT>::getSymbolValue(DataRefImpl Symb,
uint64_t &Val) const {
const Elf_Sym *ESym = getSymbol(Symb);
Val = ESym->st_value;
switch (EF.getSymbolTableIndex(ESym)) {
default:
Val = ESym->st_value;
break;
case ELF::SHN_COMMON:
case ELF::SHN_UNDEF:
Val = UnknownAddressOrSize;
break;
}
return object_error::success;
}