From 5a61b72493a700229bac6cf87366188b039c6271 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Wed, 2 Apr 2014 22:52:46 +0000 Subject: 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 --- include/llvm/Object/ELFObjectFile.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'include/llvm/Object') diff --git a/include/llvm/Object/ELFObjectFile.h b/include/llvm/Object/ELFObjectFile.h index be5ed9b611..f611c6c06f 100644 --- a/include/llvm/Object/ELFObjectFile.h +++ b/include/llvm/Object/ELFObjectFile.h @@ -417,7 +417,15 @@ template error_code ELFObjectFile::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; } -- cgit v1.2.3