summaryrefslogtreecommitdiff
path: root/tools/llvm-readobj/ELFDumper.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-06-05 01:33:53 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-06-05 01:33:53 +0000
commit6c1202c459ffa6d693ad92fa84e43902bc780bca (patch)
tree7b105f95ab50dfb164f274ae463085af780e3262 /tools/llvm-readobj/ELFDumper.cpp
parentcc5a6cb0a22736e133a17cf4de23e3d76de8058e (diff)
Handle relocations that don't point to symbols.
In ELF (as in MachO), not all relocations point to symbols. Represent this properly by using a symbol_iterator instead of a SymbolRef. Update llvm-readobj ELF's dumper to handle relocatios without symbols. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183284 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-readobj/ELFDumper.cpp')
-rw-r--r--tools/llvm-readobj/ELFDumper.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/llvm-readobj/ELFDumper.cpp b/tools/llvm-readobj/ELFDumper.cpp
index 2427b7d3b14..67bbafaf6f2 100644
--- a/tools/llvm-readobj/ELFDumper.cpp
+++ b/tools/llvm-readobj/ELFDumper.cpp
@@ -571,7 +571,6 @@ void ELFDumper<ELFT>::printRelocation(section_iterator Sec,
SmallString<32> RelocName;
int64_t Addend;
StringRef SymbolName;
- SymbolRef Symbol;
if (Obj->getElfHeader()->e_type == ELF::ET_REL){
if (error(RelI->getOffset(Offset))) return;
} else {
@@ -580,8 +579,9 @@ void ELFDumper<ELFT>::printRelocation(section_iterator Sec,
if (error(RelI->getType(RelocType))) return;
if (error(RelI->getTypeName(RelocName))) return;
if (error(getELFRelocationAddend(*RelI, Addend))) return;
- if (error(RelI->getSymbol(Symbol))) return;
- if (error(Symbol.getName(SymbolName))) return;
+ symbol_iterator Symbol = RelI->getSymbol();
+ if (Symbol != Obj->end_symbols() && error(Symbol->getName(SymbolName)))
+ return;
if (opts::ExpandRelocs) {
DictScope Group(W, "Relocation");