diff options
Diffstat (limited to 'include/llvm/Object')
-rw-r--r-- | include/llvm/Object/ELFObjectFile.h | 10 |
1 files changed, 9 insertions, 1 deletions
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 <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; } |