aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/MC/MCObjectSymbolizer.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/MC/MCObjectSymbolizer.h')
-rw-r--r--include/llvm/MC/MCObjectSymbolizer.h32
1 files changed, 19 insertions, 13 deletions
diff --git a/include/llvm/MC/MCObjectSymbolizer.h b/include/llvm/MC/MCObjectSymbolizer.h
index 555cf51..64b932e 100644
--- a/include/llvm/MC/MCObjectSymbolizer.h
+++ b/include/llvm/MC/MCObjectSymbolizer.h
@@ -32,22 +32,14 @@ class MCObjectSymbolizer : public MCSymbolizer {
protected:
const object::ObjectFile *Obj;
- typedef DenseMap<uint64_t, object::RelocationRef> AddrToRelocMap;
- typedef std::vector<object::SectionRef> SortedSectionList;
- SortedSectionList SortedSections;
-
// Map a load address to the first relocation that applies there. As far as I
// know, if there are several relocations at the exact same address, they are
// related and the others can be determined from the first that was found in
// the relocation table. For instance, on x86-64 mach-o, a SUBTRACTOR
// relocation (referencing the minuend symbol) is followed by an UNSIGNED
// relocation (referencing the subtrahend symbol).
- AddrToRelocMap AddrToReloc;
-
- // Helpers around SortedSections.
- SortedSectionList::const_iterator findSectionContaining(uint64_t Addr) const;
- void insertSection(object::SectionRef Section);
-
+ const object::RelocationRef *findRelocationAt(uint64_t Addr);
+ const object::SectionRef *findSectionContaining(uint64_t Addr);
MCObjectSymbolizer(MCContext &Ctx, OwningPtr<MCRelocationInfo> &RelInfo,
const object::ObjectFile *Obj);
@@ -56,18 +48,32 @@ public:
/// \name Overridden MCSymbolizer methods:
/// @{
bool tryAddingSymbolicOperand(MCInst &MI, raw_ostream &cStream,
- int64_t Value,
- uint64_t Address, bool IsBranch,
- uint64_t Offset, uint64_t InstSize);
+ int64_t Value, uint64_t Address,
+ bool IsBranch, uint64_t Offset,
+ uint64_t InstSize);
void tryAddingPcLoadReferenceComment(raw_ostream &cStream,
int64_t Value, uint64_t Address);
/// @}
+ /// \brief Look for an external function symbol at \p Addr.
+ /// (References through the ELF PLT, Mach-O stubs, and similar).
+ /// \returns An MCExpr representing the external symbol, or 0 if not found.
+ virtual StringRef findExternalFunctionAt(uint64_t Addr);
+
/// \brief Create an object symbolizer for \p Obj.
static MCObjectSymbolizer *
createObjectSymbolizer(MCContext &Ctx, OwningPtr<MCRelocationInfo> &RelInfo,
const object::ObjectFile *Obj);
+
+private:
+ typedef DenseMap<uint64_t, object::RelocationRef> AddrToRelocMap;
+ typedef std::vector<object::SectionRef> SortedSectionList;
+ SortedSectionList SortedSections;
+ AddrToRelocMap AddrToReloc;
+
+ void buildSectionList();
+ void buildRelocationByAddrMap();
};
}