diff options
author | Ahmed Bougacha <ahmed.bougacha@gmail.com> | 2013-05-14 22:41:29 +0000 |
---|---|---|
committer | Ahmed Bougacha <ahmed.bougacha@gmail.com> | 2013-05-14 22:41:29 +0000 |
commit | 9dab0cc6c3caa7fe6b5c8a3f94c4c49b7a4a3b1c (patch) | |
tree | a766ccd7beccd2d939aa9e255667fa4f3be7e057 /llvm/lib/Object/MachOObjectFile.cpp | |
parent | af85f6083af0f2819714dedc70fe0691f32ed1b5 (diff) | |
download | llvm-9dab0cc6c3caa7fe6b5c8a3f94c4c49b7a4a3b1c.zip llvm-9dab0cc6c3caa7fe6b5c8a3f94c4c49b7a4a3b1c.tar.gz llvm-9dab0cc6c3caa7fe6b5c8a3f94c4c49b7a4a3b1c.tar.bz2 |
Object: Fix Mach-O relocation printing.
There were two problems that made llvm-objdump -r crash:
- for non-scattered relocations, the symbol/section index is actually in the
(aptly named) symbolnum field.
- sections are 1-indexed.
llvm-svn: 181843
Diffstat (limited to 'llvm/lib/Object/MachOObjectFile.cpp')
-rw-r--r-- | llvm/lib/Object/MachOObjectFile.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Object/MachOObjectFile.cpp b/llvm/lib/Object/MachOObjectFile.cpp index af14c72..654af08 100644 --- a/llvm/lib/Object/MachOObjectFile.cpp +++ b/llvm/lib/Object/MachOObjectFile.cpp @@ -339,7 +339,7 @@ static void printRelocationTargetName(const MachOObjectFile *O, StringRef S; bool isExtern = O->getPlainRelocationExternal(RE); - uint64_t Val = O->getAnyRelocationAddress(RE); + uint64_t Val = O->getPlainRelocationSymbolNum(RE); if (isExtern) { symbol_iterator SI = O->begin_symbols(); @@ -347,7 +347,8 @@ static void printRelocationTargetName(const MachOObjectFile *O, SI->getName(S); } else { section_iterator SI = O->begin_sections(); - advanceTo(SI, Val); + // Adjust for the fact that sections are 1-indexed. + advanceTo(SI, Val - 1); SI->getName(S); } |