BaseLayer.mapSectionAddress(H, LocalAddress, TargetAddr);
}
- // Ownership hack.
- // FIXME: Remove this as soon as RuntimeDyldELF can apply relocations without
- // referencing the original object.
- template <typename OwningMBSet>
- void takeOwnershipOfBuffers(ObjSetHandleT H, OwningMBSet MBs) {
- BaseLayer.takeOwnershipOfBuffers(H, std::move(MBs));
- }
-
/// @brief Access the transform functor directly.
TransformFtor &getTransform() { return Transform; }
doPreallocation(MemMgr);
RuntimeDyld Dyld(MemMgr, MemMgr);
- // FIXME: Preserve buffers until resolveRelocations time to work around a bug
- // in RuntimeDyldELF.
- // This fixme should be fixed ASAP. This is a very brittle workaround.
- std::vector<std::unique_ptr<MemoryBuffer>> InputBuffers;
-
// If we don't have any input files, read from stdin.
if (!InputFileList.size())
InputFileList.push_back("-");
return Error("unable to create object file: '" + EC.message() + "'");
ObjectFile &Obj = **MaybeObj;
- InputBuffers.push_back(std::move(*InputBuffer));
// Load the object file
Dyld.loadObject(Obj);
RuntimeDyldChecker Checker(Dyld, Disassembler.get(), InstPrinter.get(),
llvm::dbgs());
- // FIXME: Preserve buffers until resolveRelocations time to work around a bug
- // in RuntimeDyldELF.
- // This fixme should be fixed ASAP. This is a very brittle workaround.
- std::vector<std::unique_ptr<MemoryBuffer>> InputBuffers;
-
// If we don't have any input files, read from stdin.
if (!InputFileList.size())
InputFileList.push_back("-");
return Error("unable to create object file: '" + EC.message() + "'");
ObjectFile &Obj = **MaybeObj;
- InputBuffers.push_back(std::move(*InputBuffer));
// Load the object file
Dyld.loadObject(Obj);
resetExpectations();
}
- template <typename OwningMBSet>
- void takeOwnershipOfBuffers(ObjSetHandleT H, OwningMBSet MBs) {
- EXPECT_EQ(MockObjSetHandle, H);
- EXPECT_EQ(MockBufferSet, *MBs);
- LastCalled = "takeOwnershipOfBuffers";
- }
- void expectTakeOwnershipOfBuffers(ObjSetHandleT H, MockMemoryBufferSet *MBs) {
- MockObjSetHandle = H;
- MockBufferSet = *MBs;
- }
- void verifyTakeOwnershipOfBuffers() {
- EXPECT_EQ("takeOwnershipOfBuffers", LastCalled);
- resetExpectations();
- }
-
private:
// Backing fields for remembering parameter/return values
std::string LastCalled;
T1.mapSectionAddress(H, Buffer, MockAddress);
M.verifyMapSectionAddress();
- // Test takeOwnershipOfBuffers, using unique pointer to buffer set
- auto MockBufferSetPtr = llvm::make_unique<MockMemoryBufferSet>(366);
- M.expectTakeOwnershipOfBuffers(H, MockBufferSetPtr.get());
- T2.takeOwnershipOfBuffers(H, std::move(MockBufferSetPtr));
- M.verifyTakeOwnershipOfBuffers();
-
- // Test takeOwnershipOfBuffers, using naked pointer to buffer set
- MockMemoryBufferSet MockBufferSet = 266;
- M.expectTakeOwnershipOfBuffers(H, &MockBufferSet);
- T1.takeOwnershipOfBuffers(H, &MockBufferSet);
- M.verifyTakeOwnershipOfBuffers();
-
// Verify transform getter (non-const)
MockObjectFile Mutatee = 277;
MockObjectFile *Out = T2.getTransform()(&Mutatee);