#include #include #ifdef __linux__ #include #endif #ifdef __APPLE__ #include #endif namespace pslang::jit { compiled_module make_host_executable(compiled_module module) { #if defined(__linux__) || defined(__APPLE__) if (module.abi != abi::itanium && module.abi != abi::armv8) throw std::runtime_error("Abi mismatch"); // Assume the module code memory was obtained via mmap mprotect(module.code.memory.data.get(), module.code.memory.size, PROT_READ | PROT_EXEC); return module; #else throw std::runtime_error("Host-executable modules are not supported for this platform"); #endif } }