[llvm-objdump] Fix mach-o binding decompression error

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220119 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Nick Kledzik 2014-10-18 01:21:02 +00:00
parent 2402e6315d
commit 50ede1623d
3 changed files with 8 additions and 3 deletions

View File

@ -1974,20 +1974,20 @@ void MachOBindEntry::moveNext() {
SegmentOffset) << "\n");
return;
case MachO::BIND_OPCODE_DO_BIND_ADD_ADDR_ULEB:
AdvanceAmount = readULEB128();
AdvanceAmount = readULEB128() + PointerSize;
RemainingLoopCount = 0;
if (TableKind == Kind::Lazy)
Malformed = true;
DEBUG_WITH_TYPE(
"mach-o-bind",
llvm::dbgs() << "BIND_OPCODE_DO_BIND_IMM_TIMES: "
llvm::dbgs() << "BIND_OPCODE_DO_BIND_ADD_ADDR_ULEB: "
<< format("SegmentOffset=0x%06X", SegmentOffset)
<< ", AdvanceAmount=" << AdvanceAmount
<< ", RemainingLoopCount=" << RemainingLoopCount
<< "\n");
return;
case MachO::BIND_OPCODE_DO_BIND_ADD_ADDR_IMM_SCALED:
AdvanceAmount = ImmValue * PointerSize;
AdvanceAmount = ImmValue * PointerSize + PointerSize;
RemainingLoopCount = 0;
if (TableKind == Kind::Lazy)
Malformed = true;

Binary file not shown.

View File

@ -0,0 +1,5 @@
# RUN: llvm-objdump -macho -bind %p/Inputs/bind2.macho-x86_64 | FileCheck %s
# CHECK: __DATA __data 0x00001008 pointer 0 libSystem _malloc
# CHECK: __DATA __data 0x00001050 pointer 0 libSystem _malloc
# CHECK: __DATA __data 0x00001458 pointer 0 libSystem _malloc