Fix llvm-objdump disassembly for interesting Mach-O binaries, e.g. any MacOS
authorCameron Zwarich <zwarich@apple.com>
Fri, 3 Feb 2012 04:13:37 +0000 (04:13 +0000)
committerCameron Zwarich <zwarich@apple.com>
Fri, 3 Feb 2012 04:13:37 +0000 (04:13 +0000)
dylib. This regressed with r145408. I will try to make a test case and add it
so that this doesn't happen again.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149667 91177308-0d34-0410-b5e6-96231b3b80d8

tools/llvm-objdump/llvm-objdump.cpp

index fded8a1f35600aea6f8dea60aafb5e4505bb8429..44d681fc1cd9a97d92d2b2eeb005369a4818cf36 100644 (file)
@@ -189,6 +189,8 @@ static void DisassembleObject(const ObjectFile *Obj, bool InlineRelocs) {
       if (!error(i->containsSymbol(*si, contains)) && contains) {
         uint64_t Address;
         if (error(si->getAddress(Address))) break;
+        Address -= SectionAddr;
+
         StringRef Name;
         if (error(si->getName(Name))) break;
         Symbols.push_back(std::make_pair(Address, Name));