mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-13 04:38:24 +00:00
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181843 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -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);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user