summaryrefslogtreecommitdiff
path: root/include/llvm/MC/MCObjectDisassembler.h
diff options
context:
space:
mode:
authorAhmed Bougacha <ahmed.bougacha@gmail.com>2013-08-21 07:28:37 +0000
committerAhmed Bougacha <ahmed.bougacha@gmail.com>2013-08-21 07:28:37 +0000
commit484a6eb9cc22db9c78bb93969bc0341c19e7739e (patch)
tree7f41755b23366e24b4d26e9abfad2bff943eae7f /include/llvm/MC/MCObjectDisassembler.h
parent46937278fad5e47178b0c5f5e062eba71644231e (diff)
downloadllvm-484a6eb9cc22db9c78bb93969bc0341c19e7739e.tar.gz
llvm-484a6eb9cc22db9c78bb93969bc0341c19e7739e.tar.bz2
llvm-484a6eb9cc22db9c78bb93969bc0341c19e7739e.tar.xz
MC CFG: Add "dynamic disassembly" support to MCObjectDisassembler.
It can now disassemble code in situations where the effective load address is different than the load address declared in the object file. This happens for PIC, hence "dynamic". git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188884 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/MC/MCObjectDisassembler.h')
-rw-r--r--include/llvm/MC/MCObjectDisassembler.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/llvm/MC/MCObjectDisassembler.h b/include/llvm/MC/MCObjectDisassembler.h
index de2aae7c6a..edaf7dca5a 100644
--- a/include/llvm/MC/MCObjectDisassembler.h
+++ b/include/llvm/MC/MCObjectDisassembler.h
@@ -65,6 +65,22 @@ public:
virtual ArrayRef<uint64_t> getStaticExitFunctions();
/// @}
+ /// \name Translation between effective and objectfile load address.
+ /// @{
+ /// \brief Compute the effective load address, from an objectfile virtual
+ /// address. This is implemented in a format-specific way, to take into
+ /// account things like PIE/ASLR when doing dynamic disassembly.
+ /// For example, on Mach-O this would be done by adding the VM addr slide,
+ /// on glibc ELF by keeping a map between segment load addresses, filled
+ /// using dl_iterate_phdr, etc..
+ /// In most static situations and in the default impl., this returns \p Addr.
+ virtual uint64_t getEffectiveLoadAddr(uint64_t Addr);
+
+ /// \brief Compute the original load address, as specified in the objectfile.
+ /// This is the inverse of getEffectiveLoadAddr.
+ virtual uint64_t getOriginalLoadAddr(uint64_t EffectiveAddr);
+ /// @}
+
protected:
const object::ObjectFile &Obj;
const MCDisassembler &Dis;