Index: include/llvm/Object/ELF.h =================================================================== --- include/llvm/Object/ELF.h +++ include/llvm/Object/ELF.h @@ -86,7 +86,7 @@ void getRelocationTypeName(uint32_t Type, SmallVectorImpl &Result) const; - /// \brief Get the symbol table section and symbol for a given relocation. + /// \brief Get the symbol for a given relocation. template const Elf_Sym *getRelocationSymbol(const RelT *Rel, const Elf_Shdr *SymTab) const; @@ -293,6 +293,8 @@ const typename ELFFile::Elf_Sym * ELFFile::getRelocationSymbol(const RelT *Rel, const Elf_Shdr *SymTab) const { + assert(Rel && "Invalid relocation"); + assert(SymTab && "Invalid symbol table"); uint32_t Index = Rel->getSymbol(isMips64EL()); if (Index == 0) return nullptr;