Fix llvm-objdump's MachO mode to not depend on the value returned by RelocationRef...
authorOwen Anderson <resistor@mac.com>
Mon, 7 Nov 2011 17:21:36 +0000 (17:21 +0000)
committerOwen Anderson <resistor@mac.com>
Mon, 7 Nov 2011 17:21:36 +0000 (17:21 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143966 91177308-0d34-0410-b5e6-96231b3b80d8

tools/llvm-objdump/MachODump.cpp

index a539f1d2cb3eefa9ec36c8a99e7f925880d3d927..4ccae5148bd5f17c7a615fcdc4c97ba25a89d1a6 100644 (file)
@@ -385,7 +385,7 @@ void llvm::DisassembleInputMachO(StringRef Filename) {
     bool symbolTableWorked = false;
 
     // Parse relocations.
-    std::vector<std::pair<uint64_t, uint32_t> > Relocs;
+    std::vector<std::pair<uint64_t, SymbolRef> > Relocs;
     error_code ec;
     for (relocation_iterator RI = Sections[SectIdx].begin_relocations(),
          RE = Sections[SectIdx].end_relocations(); RI != RE; RI.increment(ec)) {
@@ -394,10 +394,10 @@ void llvm::DisassembleInputMachO(StringRef Filename) {
       Sections[SectIdx].getAddress(SectionAddress);
       RelocOffset -= SectionAddress;
 
-      uint64_t RelocInfo;
-      RI->getType(RelocInfo);
+      SymbolRef RelocSym;
+      RI->getSymbol(RelocSym);
 
-      Relocs.push_back(std::make_pair(RelocOffset, RelocInfo));
+      Relocs.push_back(std::make_pair(RelocOffset, RelocSym));
     }
     array_pod_sort(Relocs.begin(), Relocs.end());
 
@@ -594,8 +594,8 @@ void llvm::DisassembleInputMachO(StringRef Filename) {
                   Relocs[j].first < SectAddress + Inst.Address + Inst.Size) {
                 StringRef SymName;
                 uint64_t Addr;
-                UnsortedSymbols[Relocs[j].second].getName(SymName);
-                UnsortedSymbols[Relocs[j].second].getAddress(Addr);
+                Relocs[j].second.getAddress(Addr);
+                Relocs[j].second.getName(SymName);
 
                 outs() << "\t# " << SymName << ' ';
                 DumpAddress(Addr, Sections, MachOObj, outs());