[lld] r244219 - bar
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 6 08:33:19 PDT 2015
Author: rafael
Date: Thu Aug 6 10:33:19 2015
New Revision: 244219
URL: http://llvm.org/viewvc/llvm-project?rev=244219&view=rev
Log:
bar
Modified:
lld/trunk/ELF/Symbols.cpp
Modified: lld/trunk/ELF/Symbols.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Symbols.cpp?rev=244219&r1=244218&r2=244219&view=diff
==============================================================================
--- lld/trunk/ELF/Symbols.cpp (original)
+++ lld/trunk/ELF/Symbols.cpp Thu Aug 6 10:33:19 2015
@@ -9,6 +9,7 @@
#include "Symbols.h"
#include "Chunks.h"
+#include "Error.h"
#include "InputFiles.h"
using namespace llvm::object;
@@ -17,13 +18,16 @@ using namespace lld;
using namespace lld::elf2;
template <class ELFT>
-StringRef
+static StringRef
getSymbolName(const llvm::object::ELFFile<ELFT> *F,
const typename llvm::object::ELFFile<ELFT>::Elf_Sym *S) {
- ErrorOr<StringRef> StrTab = F->getStringTableForSymtab(*F->getDotSymtabSec());
- if (!StrTab || S->st_name >= StrTab->size())
- llvm::report_fatal_error("Invalid string table.");
- return StrTab->data() + S->st_name;
+ ErrorOr<StringRef> StrTabOrErr =
+ F->getStringTableForSymtab(*F->getDotSymtabSec());
+ error(StrTabOrErr, "Invalid string table.");
+ StringRef StrTab = *StrTabOrErr;
+ if (S->st_name >= StrTab.size())
+ error("Invalid string table offset");
+ return StrTab.data() + S->st_name;
}
template <class ELFT>
More information about the llvm-commits
mailing list