[llvm-commits] [llvm] r143151 - /llvm/trunk/lib/Object/MachOObjectFile.cpp
Owen Anderson
resistor at mac.com
Thu Oct 27 14:53:50 PDT 2011
Author: resistor
Date: Thu Oct 27 16:53:50 2011
New Revision: 143151
URL: http://llvm.org/viewvc/llvm-project?rev=143151&view=rev
Log:
If we're searching for a symbol reference to pretty-print a scattered relocation address, and we don't find a symbol table entry, try section begin addresses as well.
Modified:
llvm/trunk/lib/Object/MachOObjectFile.cpp
Modified: llvm/trunk/lib/Object/MachOObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/MachOObjectFile.cpp?rev=143151&r1=143150&r2=143151&view=diff
==============================================================================
--- llvm/trunk/lib/Object/MachOObjectFile.cpp (original)
+++ llvm/trunk/lib/Object/MachOObjectFile.cpp Thu Oct 27 16:53:50 2011
@@ -821,6 +821,24 @@
return;
}
+ // If we couldn't find a symbol that this relocation refers to, try
+ // to find a section beginning instead.
+ for (section_iterator SI = begin_sections(), SE = end_sections(); SI != SE;
+ SI.increment(ec)) {
+ if (ec) report_fatal_error(ec.message());
+
+ uint64_t Addr;
+ StringRef Name;
+
+ if ((ec = SI->getAddress(Addr)))
+ report_fatal_error(ec.message());
+ if (Addr != Val) continue;
+ if ((ec = SI->getName(Name)))
+ report_fatal_error(ec.message());
+ fmt << Name;
+ return;
+ }
+
fmt << format("0x%x", Val);
return;
}
More information about the llvm-commits
mailing list