Index: include/llvm/DebugInfo/DIContext.h =================================================================== --- include/llvm/DebugInfo/DIContext.h +++ include/llvm/DebugInfo/DIContext.h @@ -16,6 +16,7 @@ #define LLVM_DEBUGINFO_DICONTEXT_H #include "llvm/ADT/SmallVector.h" +#include "llvm/DebugInfo/DWARF/DWARFRelocMap.h" #include "llvm/Object/ObjectFile.h" #include #include @@ -221,6 +222,18 @@ return false; } + // Client may overload this method to perform relocations on its side. + // + // RelSec is a relocation section, client code is responsible for filling Map + // with relocated values. It that case method should return true, to say that + // client proccessed relocations and nothing else should be done on parser + // side. If method returns false (default), parser is responsible for + // performing relocations. + virtual bool relocate(const object::SectionRef &RelSec, + RelocAddrMap *Map) const { + return false; + } + /// Obtain a copy of this LoadedObjectInfo. /// /// The caller is responsible for deallocation once the copy is no longer required. Index: lib/DebugInfo/DWARF/DWARFContext.cpp =================================================================== --- lib/DebugInfo/DWARF/DWARFContext.cpp +++ lib/DebugInfo/DWARF/DWARFContext.cpp @@ -1041,6 +1041,9 @@ if (Section.relocation_begin() == Section.relocation_end()) continue; + if (L && L->relocate(Section, Map)) + continue; + // Symbol to [address, section index] cache mapping. std::map AddrCache; for (const RelocationRef &Reloc : Section.relocations()) {