@@ -198,7 +198,6 @@ JITModule::Symbol compile_and_get_function(llvm::orc::LLJIT &JIT, const string &
198198// Expand LLVM's search for symbols to include code contained in a set of JITModule.
199199class HalideJITMemoryManager : public SectionMemoryManager {
200200 std::vector<JITModule> modules;
201- std::vector<std::pair<uint8_t *, size_t >> code_pages;
202201
203202public:
204203 HalideJITMemoryManager (const std::vector<JITModule> &modules)
@@ -240,11 +239,10 @@ class HalideJITMemoryManager : public SectionMemoryManager {
240239 return result;
241240 }
242241
243- uint8_t *allocateCodeSection (uintptr_t size, unsigned alignment, unsigned section_id, StringRef section_name) override {
244- uint8_t *result = SectionMemoryManager::allocateCodeSection (size, alignment, section_id, section_name);
245- code_pages.emplace_back (result, size);
246- return result;
247- }
242+ // We don't support throwing C++ exceptions through JIT-compiled code. Avoid
243+ // any issues with it by just opting out.
244+ void registerEHFrames (uint8_t *, uint64_t , size_t ) override {};
245+ void deregisterEHFrames () override {};
248246};
249247
250248} // namespace
@@ -261,7 +259,8 @@ JITModule::JITModule(const Module &m, const LoweredFunc &fn,
261259 std::vector<JITModule> shared_runtime = JITSharedRuntime::get (llvm_module.get (), m.target ());
262260 deps_with_runtime.insert (deps_with_runtime.end (), shared_runtime.begin (), shared_runtime.end ());
263261 compile_module (std::move (llvm_module), fn.name , m.target (), deps_with_runtime);
264- // If -time-passes is in HL_LLVM_ARGS, this will print llvm passes time statstics otherwise its no-op.
262+ // If -time-passes is in HL_LLVM_ARGS, this will print llvm pass time
263+ // statistics. Otherwise it's a no-op.
265264 llvm::reportAndResetTimings ();
266265}
267266
@@ -316,10 +315,12 @@ void JITModule::compile_module(std::unique_ptr<llvm::Module> m, const string &fu
316315
317316 llvm::orc::LLJITBuilderState::ObjectLinkingLayerCreator linkerBuilder;
318317 if ((target.arch == Target::Arch::X86 && target.bits == 32 ) ||
319- (target.arch == Target::Arch::ARM && target.bits == 32 )) {
318+ (target.arch == Target::Arch::ARM && target.bits == 32 ) ||
319+ target.os == Target::Windows) {
320320// Fallback to RTDyld-based linking to workaround errors:
321321// i386: "JIT session error: Unsupported i386 relocation:4" (R_386_PLT32)
322322// ARM 32bit: Unsupported target machine architecture in ELF object shared runtime-jitted-objectbuffer
323+ // Windows 64-bit: JIT session error: could not register eh-frame: __register_frame function not found
323324#if LLVM_VERSION >= 210
324325 linkerBuilder = [&](llvm::orc::ExecutionSession &session) {
325326 return std::make_unique<llvm::orc::RTDyldObjectLinkingLayer>(session, [&]() {
0 commit comments