namespace {
-class LoadedCOFFObjectInfo
+class LoadedCOFFObjectInfo final
: public RuntimeDyld::LoadedObjectInfoHelper<LoadedCOFFObjectInfo> {
public:
- LoadedCOFFObjectInfo(RuntimeDyldImpl &RTDyld, unsigned BeginIdx,
- unsigned EndIdx)
- : LoadedObjectInfoHelper(RTDyld, BeginIdx, EndIdx) {}
+ LoadedCOFFObjectInfo(RuntimeDyldImpl &RTDyld, ObjSectionToIDMap ObjSecToIDMap)
+ : LoadedObjectInfoHelper(RTDyld, std::move(ObjSecToIDMap)) {}
OwningBinary<ObjectFile>
getObjectForDebug(const ObjectFile &Obj) const override {
std::unique_ptr<RuntimeDyld::LoadedObjectInfo>
RuntimeDyldCOFF::loadObject(const object::ObjectFile &O) {
- unsigned SectionStartIdx, SectionEndIdx;
- std::tie(SectionStartIdx, SectionEndIdx) = loadObjectImpl(O);
- return llvm::make_unique<LoadedCOFFObjectInfo>(*this, SectionStartIdx,
- SectionEndIdx);
+ return llvm::make_unique<LoadedCOFFObjectInfo>(*this, loadObjectImpl(O));
}
uint64_t RuntimeDyldCOFF::getSymbolOffset(const SymbolRef &Sym) {
- uint64_t Address;
- if (Sym.getAddress(Address))
- return UnknownAddressOrSize;
-
- if (Address == UnknownAddressOrSize)
- return UnknownAddressOrSize;
-
- const ObjectFile *Obj = Sym.getObject();
- section_iterator SecI(Obj->section_end());
- if (Sym.getSection(SecI))
- return UnknownAddressOrSize;
-
- if (SecI == Obj->section_end())
- return UnknownAddressOrSize;
-
- uint64_t SectionAddress = SecI->getAddress();
- return Address - SectionAddress;
+ // The value in a relocatable COFF object is the offset.
+ return Sym.getValue();
}
bool RuntimeDyldCOFF::isCompatibleFile(const object::ObjectFile &Obj) const {