Disable release of code and data sections

This is required until CallFunc is informed about unloading, and can
re-generate the wrapper (if the decl is still available).
This commit is contained in:
Jonas Hahnfeld 2022-11-23 11:58:40 +01:00 committed by jenkins
parent 4f3af1dc2c
commit 1f237a50ee

View File

@ -27,6 +27,35 @@ using namespace llvm::orc;
namespace {
class ClingMMapper final : public SectionMemoryManager::MemoryMapper {
public:
sys::MemoryBlock
allocateMappedMemory(SectionMemoryManager::AllocationPurpose Purpose,
size_t NumBytes,
const sys::MemoryBlock* const NearBlock,
unsigned Flags, std::error_code& EC) override {
return sys::Memory::allocateMappedMemory(NumBytes, NearBlock, Flags, EC);
}
std::error_code protectMappedMemory(const sys::MemoryBlock& Block,
unsigned Flags) override {
return sys::Memory::protectMappedMemory(Block, Flags);
}
std::error_code releaseMappedMemory(sys::MemoryBlock& M) override {
// Disabled until CallFunc is informed about unloading, and can
// re-generate the wrapper (if the decl is still available). See
// https://github.com/root-project/root/issues/10898
#if 0
return sys::Memory::releaseMappedMemory(M);
#else
return {};
#endif
}
};
ClingMMapper MMapperInstance;
// A memory manager for Cling that reserves memory for code and data sections
// to keep them contiguous for the emission of one module. This is required
// for working exception handling support since one .eh_frame section will
@ -88,7 +117,7 @@ namespace {
AllocInfo m_RWData;
public:
ClingMemoryManager() {}
ClingMemoryManager() : Super(&MMapperInstance) {}
uint8_t* allocateCodeSection(uintptr_t Size, unsigned Alignment,
unsigned SectionID,