Do the same fix as r149667, but for the Mach-O disassembler.
authorCameron Zwarich <zwarich@apple.com>
Fri, 3 Feb 2012 05:42:17 +0000 (05:42 +0000)
committerCameron Zwarich <zwarich@apple.com>
Fri, 3 Feb 2012 05:42:17 +0000 (05:42 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149674 91177308-0d34-0410-b5e6-96231b3b80d8

tools/llvm-objdump/MachODump.cpp

index ffeea88bdc25c78dda57798ccc1ab32d197737aa..6ea03232edd47e21b020ddf4ab1e0abf59053fd5 100644 (file)
@@ -418,8 +418,11 @@ void llvm::DisassembleInputMachO(StringRef Filename) {
         continue;
 
       // Start at the address of the symbol relative to the section's address.
+      uint64_t SectionAddress = 0;
       uint64_t Start = 0;
+      Sections[SectIdx].getAddress(SectionAddress);
       Symbols[SymIdx].getAddress(Start);
+      Start -= SectionAddress;
 
       // Stop disassembling either at the beginning of the next symbol or at
       // the end of the section.
@@ -433,6 +436,7 @@ void llvm::DisassembleInputMachO(StringRef Filename) {
           Sections[SectIdx].containsSymbol(Symbols[NextSymIdx],
                                            containsNextSym);
           Symbols[NextSymIdx].getAddress(NextSym);
+          NextSym -= SectionAddress;
           break;
         }
         ++NextSymIdx;