summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-06-05 02:55:01 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-06-05 02:55:01 +0000
commit7595447b15608fe60378b472b759cb5c5187eaa2 (patch)
treed3192b884ce5f9e52e15afff98b01b6aca1342e5 /llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
parent8e71301637584643cca7ce2a7fe09e6dcd06f24b (diff)
downloadbcm5719-llvm-7595447b15608fe60378b472b759cb5c5187eaa2.tar.gz
bcm5719-llvm-7595447b15608fe60378b472b759cb5c5187eaa2.zip
Handle (at least don't crash on) relocations with no symbols.
Should fix the MCJIT tests on PPC. llvm-svn: 183288
Diffstat (limited to 'llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp')
-rw-r--r--llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
index e552cea1bc0..722ed10f733 100644
--- a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
+++ b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
@@ -780,23 +780,28 @@ void RuntimeDyldELF::processRelocationRef(unsigned SectionID,
// Obtain the symbol name which is referenced in the relocation
StringRef TargetName;
- Symbol->getName(TargetName);
+ if (Symbol != Obj.end_symbols())
+ Symbol->getName(TargetName);
DEBUG(dbgs() << "\t\tRelType: " << RelType
<< " Addend: " << Addend
<< " TargetName: " << TargetName
<< "\n");
RelocationValueRef Value;
// First search for the symbol in the local symbol table
- SymbolTableMap::const_iterator lsi = Symbols.find(TargetName.data());
- SymbolRef::Type SymType;
- Symbol->getType(SymType);
+ SymbolTableMap::const_iterator lsi = Symbols.end();
+ SymbolRef::Type SymType = SymbolRef::ST_Unknown;
+ if (Symbol != Obj.end_symbols()) {
+ lsi = Symbols.find(TargetName.data());
+ Symbol->getType(SymType);
+ }
if (lsi != Symbols.end()) {
Value.SectionID = lsi->second.first;
Value.Addend = lsi->second.second + Addend;
} else {
// Search for the symbol in the global symbol table
- SymbolTableMap::const_iterator gsi =
- GlobalSymbolTable.find(TargetName.data());
+ SymbolTableMap::const_iterator gsi = GlobalSymbolTable.end();
+ if (Symbol != Obj.end_symbols())
+ gsi = GlobalSymbolTable.find(TargetName.data());
if (gsi != GlobalSymbolTable.end()) {
Value.SectionID = gsi->second.first;
Value.Addend = gsi->second.second + Addend;
OpenPOWER on IntegriCloud