Delete UnknownAddress. It is a perfectly valid symbol value.
[oota-llvm.git] / include / llvm / Object / ELFObjectFile.h
index ed87621ff2ac5d6b6486d161fe2553ea20fa9ba8..6e8ace427a2021d09de0f4ce396814dfc2014903 100644 (file)
@@ -197,7 +197,7 @@ protected:
   void moveSymbolNext(DataRefImpl &Symb) const override;
   ErrorOr<StringRef> getSymbolName(DataRefImpl Symb) const override;
   ErrorOr<uint64_t> getSymbolAddress(DataRefImpl Symb) const override;
-  uint64_t getSymbolValue(DataRefImpl Symb) const override;
+  uint64_t getSymbolValueImpl(DataRefImpl Symb) const override;
   uint32_t getSymbolAlignment(DataRefImpl Symb) const override;
   uint64_t getCommonSymbolSizeImpl(DataRefImpl Symb) const override;
   uint32_t getSymbolFlags(DataRefImpl Symb) const override;
@@ -370,19 +370,13 @@ uint32_t ELFObjectFile<ELFT>::getSectionType(DataRefImpl Sec) const {
 }
 
 template <class ELFT>
-uint64_t ELFObjectFile<ELFT>::getSymbolValue(DataRefImpl Symb) const {
+uint64_t ELFObjectFile<ELFT>::getSymbolValueImpl(DataRefImpl Symb) const {
   const Elf_Sym *ESym = getSymbol(Symb);
-  switch (ESym->st_shndx) {
-  case ELF::SHN_COMMON:
-  case ELF::SHN_UNDEF:
-    return UnknownAddress;
-  case ELF::SHN_ABS:
-    return ESym->st_value;
-  }
-
-  const Elf_Ehdr *Header = EF.getHeader();
   uint64_t Ret = ESym->st_value;
+  if (ESym->st_shndx == ELF::SHN_ABS)
+    return Ret;
 
+  const Elf_Ehdr *Header = EF.getHeader();
   // Clear the ARM/Thumb or microMIPS indicator flag.
   if ((Header->e_machine == ELF::EM_ARM || Header->e_machine == ELF::EM_MIPS) &&
       ESym->getType() == ELF::STT_FUNC)