[llvm] [OFFLOAD] Support host plugin on Windows (PR #180401)

Alex Duran via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 10 01:41:21 PST 2026


https://github.com/adurang updated https://github.com/llvm/llvm-project/pull/180401

>From 1e67632b3ecea2b68a0c09daa19697ad8aa4739d Mon Sep 17 00:00:00 2001
From: Alex Duran <alejandro.duran at intel.com>
Date: Fri, 6 Feb 2026 13:53:25 +0100
Subject: [PATCH 01/10] [OFFLOAD][Host] Use OS-agnostic routines for temp files

---
 offload/plugins-nextgen/host/src/rtl.cpp | 43 +++++++++++-------------
 1 file changed, 19 insertions(+), 24 deletions(-)

diff --git a/offload/plugins-nextgen/host/src/rtl.cpp b/offload/plugins-nextgen/host/src/rtl.cpp
index 603379630ae8e..5d09ad07cda2e 100644
--- a/offload/plugins-nextgen/host/src/rtl.cpp
+++ b/offload/plugins-nextgen/host/src/rtl.cpp
@@ -30,6 +30,8 @@
 #include "llvm/Frontend/OpenMP/OMPDeviceConstants.h"
 #include "llvm/Frontend/OpenMP/OMPGridValues.h"
 #include "llvm/Support/DynamicLibrary.h"
+#include "llvm/Support/FileSystem.h"
+#include "llvm/Support/raw_ostream.h"
 
 #if !defined(__BYTE_ORDER__) || !defined(__ORDER_LITTLE_ENDIAN__) ||           \
     !defined(__ORDER_BIG_ENDIAN__)
@@ -198,37 +200,30 @@ struct GenELF64DeviceTy : public GenericDeviceTy {
     GenELF64DeviceImageTy *Image = Plugin.allocate<GenELF64DeviceImageTy>();
     new (Image) GenELF64DeviceImageTy(ImageId, *this, std::move(TgtImage));
 
-    // Create a temporary file.
-    char TmpFileName[] = "/tmp/tmpfile_XXXXXX";
-    int TmpFileFd = mkstemp(TmpFileName);
-    if (TmpFileFd == -1)
-      return Plugin::error(ErrorCode::HOST_IO,
-                           "failed to create tmpfile for loading target image");
-
-    // Open the temporary file.
-    FILE *TmpFile = fdopen(TmpFileFd, "wb");
-    if (!TmpFile)
-      return Plugin::error(ErrorCode::HOST_IO,
-                           "failed to open tmpfile %s for loading target image",
-                           TmpFileName);
+    SmallString<128> TmpFileName;
+    int TmpFileFd;
+    if (auto EC = llvm::sys::fs::createTemporaryFile("tmpfile", "tmp",
+                                                     TmpFileFd, TmpFileName))
+      return Plugin::error(
+          ErrorCode::HOST_IO,
+          "failed to create tmpfile for loading target image: %s",
+          EC.message().c_str());
 
     // Write the image into the temporary file.
-    size_t Written = fwrite(Image->getStart(), Image->getSize(), 1, TmpFile);
-    if (Written != 1)
-      return Plugin::error(ErrorCode::HOST_IO,
-                           "failed to write target image to tmpfile %s",
-                           TmpFileName);
+    llvm::raw_fd_ostream TmpFile(TmpFileFd, /*shouldClose=*/true);
+    TmpFile.write(static_cast<const char *>(Image->getStart()),
+                  Image->getSize());
+    TmpFile.close();
 
-    // Close the temporary file.
-    int Ret = fclose(TmpFile);
-    if (Ret)
+    if (TmpFile.has_error())
       return Plugin::error(ErrorCode::HOST_IO,
-                           "failed to close tmpfile %s with the target image",
-                           TmpFileName);
+                           "failed to write target image to tmpfile %s",
+                           TmpFileName.c_str());
 
     // Load the temporary file as a dynamic library.
     std::string ErrMsg;
-    DynamicLibrary DynLib = DynamicLibrary::getLibrary(TmpFileName, &ErrMsg);
+    DynamicLibrary DynLib =
+        DynamicLibrary::getLibrary(TmpFileName.c_str(), &ErrMsg);
 
     // Check if the loaded library is valid.
     if (!DynLib.isValid())

>From 3c863d341eeed603bac8813e69ca45f9ea44871f Mon Sep 17 00:00:00 2001
From: Alex Duran <alejandro.duran at intel.com>
Date: Fri, 6 Feb 2026 22:53:29 +0100
Subject: [PATCH 02/10] Return error when launching kernel on Windows

---
 offload/plugins-nextgen/host/src/rtl.cpp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/offload/plugins-nextgen/host/src/rtl.cpp b/offload/plugins-nextgen/host/src/rtl.cpp
index 5d09ad07cda2e..5ac8eecfdd02b 100644
--- a/offload/plugins-nextgen/host/src/rtl.cpp
+++ b/offload/plugins-nextgen/host/src/rtl.cpp
@@ -99,6 +99,10 @@ struct GenELF64KernelTy : public GenericKernelTy {
                    uint32_t NumBlocks[3], KernelArgsTy &KernelArgs,
                    KernelLaunchParamsTy LaunchParams,
                    AsyncInfoWrapperTy &AsyncInfoWrapper) const override {
+#if _WIN32
+    return Plugin::error(ErrorCode::UNSUPPORTED,
+                         "kernel launching is not supported on Windows");
+#else
     // Create a vector of ffi_types, one per argument.
     SmallVector<ffi_type *, 16> ArgTypes(KernelArgs.NumArgs, &ffi_type_pointer);
     ffi_type **ArgTypesPtr = (ArgTypes.size()) ? &ArgTypes[0] : nullptr;
@@ -116,6 +120,7 @@ struct GenELF64KernelTy : public GenericKernelTy {
     ffi_call(&Cif, Func, &Return, (void **)LaunchParams.Ptrs);
 
     return Plugin::success();
+#endif
   }
 
   /// Return maximum block size for maximum occupancy

>From e52dabc7d7693cbc7acbcebef9987f81952a9ada Mon Sep 17 00:00:00 2001
From: Alex Duran <alejandro.duran at intel.com>
Date: Sat, 7 Feb 2026 23:58:28 +0100
Subject: [PATCH 03/10] Makefile changes

---
 offload/CMakeLists.txt                      | 5 -----
 offload/plugins-nextgen/host/CMakeLists.txt | 9 +++++++--
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/offload/CMakeLists.txt b/offload/CMakeLists.txt
index 81e246d9f8892..75a1bb435916b 100644
--- a/offload/CMakeLists.txt
+++ b/offload/CMakeLists.txt
@@ -158,11 +158,6 @@ if(LIBOMPTARGET_PLUGINS_TO_BUILD STREQUAL "all")
   set(LIBOMPTARGET_PLUGINS_TO_BUILD ${LIBOMPTARGET_ALL_PLUGIN_TARGETS})
 endif()
 
-if(NOT CMAKE_SYSTEM_NAME MATCHES "Linux" AND
-   "host" IN_LIST LIBOMPTARGET_PLUGINS_TO_BUILD)
-  message(STATUS "Not building host plugin: only Linux systems are supported")
-  list(REMOVE_ITEM LIBOMPTARGET_PLUGINS_TO_BUILD "host")
-endif()
 if(NOT (CMAKE_SYSTEM_PROCESSOR MATCHES "(x86_64)|(ppc64le)|(aarch64)$"
         AND CMAKE_SYSTEM_NAME MATCHES "Linux"))
   if("amdgpu" IN_LIST LIBOMPTARGET_PLUGINS_TO_BUILD)
diff --git a/offload/plugins-nextgen/host/CMakeLists.txt b/offload/plugins-nextgen/host/CMakeLists.txt
index 26750bd62d406..e1d66b67cbb53 100644
--- a/offload/plugins-nextgen/host/CMakeLists.txt
+++ b/offload/plugins-nextgen/host/CMakeLists.txt
@@ -1,10 +1,15 @@
+if(WIN32)
+set(supported_targets AMD64 IA64 ARM64 EM64T X86)
+else()
 set(supported_targets x86_64 aarch64 ppc64 ppc64le riscv64 s390x loongarch64)
-if(NOT ${CMAKE_SYSTEM_PROCESSOR} IN_LIST supported_targets)
+endif()
+
+set(machine ${CMAKE_SYSTEM_PROCESSOR})
+if(NOT ${machine} IN_LIST supported_targets)
   message(STATUS "Not building ${machine} NextGen offloading plugin")
   return()
 endif()
 
-set(machine ${CMAKE_SYSTEM_PROCESSOR})
 if(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64le$")
   set(machine ppc64)
 endif()

>From a3077a588af6f89da29c8df0e9cf75efbbcf0b1b Mon Sep 17 00:00:00 2001
From: Alex Duran <alejandro.duran at intel.com>
Date: Sun, 8 Feb 2026 08:46:17 +0100
Subject: [PATCH 04/10] Make plugin work partially without ffi support

---
 offload/plugins-nextgen/host/src/rtl.cpp | 37 +++++++++++++++---------
 1 file changed, 24 insertions(+), 13 deletions(-)

diff --git a/offload/plugins-nextgen/host/src/rtl.cpp b/offload/plugins-nextgen/host/src/rtl.cpp
index 5ac8eecfdd02b..390ff30c07e26 100644
--- a/offload/plugins-nextgen/host/src/rtl.cpp
+++ b/offload/plugins-nextgen/host/src/rtl.cpp
@@ -65,7 +65,8 @@ using namespace error;
 /// Class implementing kernel functionalities for GenELF64.
 struct GenELF64KernelTy : public GenericKernelTy {
   /// Construct the kernel with a name and an execution mode.
-  GenELF64KernelTy(const char *Name) : GenericKernelTy(Name), Func(nullptr) {}
+  GenELF64KernelTy(const char *Name, bool SupportsFFI)
+      : GenericKernelTy(Name), Func(nullptr), supportsFFI(SupportsFFI) {}
 
   /// Initialize the kernel.
   Error initImpl(GenericDeviceTy &Device, DeviceImageTy &Image) override {
@@ -99,10 +100,9 @@ struct GenELF64KernelTy : public GenericKernelTy {
                    uint32_t NumBlocks[3], KernelArgsTy &KernelArgs,
                    KernelLaunchParamsTy LaunchParams,
                    AsyncInfoWrapperTy &AsyncInfoWrapper) const override {
-#if _WIN32
-    return Plugin::error(ErrorCode::UNSUPPORTED,
-                         "kernel launching is not supported on Windows");
-#else
+    if (!supportsFFI)
+      return Plugin::error(ErrorCode::UNSUPPORTED,
+                           "libffi is not available, cannot launch kernel");
     // Create a vector of ffi_types, one per argument.
     SmallVector<ffi_type *, 16> ArgTypes(KernelArgs.NumArgs, &ffi_type_pointer);
     ffi_type **ArgTypesPtr = (ArgTypes.size()) ? &ArgTypes[0] : nullptr;
@@ -120,7 +120,6 @@ struct GenELF64KernelTy : public GenericKernelTy {
     ffi_call(&Cif, Func, &Return, (void **)LaunchParams.Ptrs);
 
     return Plugin::success();
-#endif
   }
 
   /// Return maximum block size for maximum occupancy
@@ -134,6 +133,8 @@ struct GenELF64KernelTy : public GenericKernelTy {
 private:
   /// The kernel function to execute.
   void (*Func)(void);
+  /// Whether this kernel supports FFI-based launch.
+  bool supportsFFI;
 };
 
 /// Class implementing the GenELF64 device images properties.
@@ -156,8 +157,9 @@ struct GenELF64DeviceImageTy : public DeviceImageTy {
 struct GenELF64DeviceTy : public GenericDeviceTy {
   /// Create the device with a specific id.
   GenELF64DeviceTy(GenericPluginTy &Plugin, int32_t DeviceId,
-                   int32_t NumDevices)
-      : GenericDeviceTy(Plugin, DeviceId, NumDevices, GenELF64GridValues) {}
+                   int32_t NumDevices, bool SupportsFFI)
+      : GenericDeviceTy(Plugin, DeviceId, NumDevices, GenELF64GridValues),
+        supportsFFI(SupportsFFI) {}
 
   ~GenELF64DeviceTy() {}
 
@@ -189,7 +191,7 @@ struct GenELF64DeviceTy : public GenericDeviceTy {
       return Plugin::error(ErrorCode::OUT_OF_RESOURCES,
                            "failed to allocate memory for GenELF64 kernel");
 
-    new (GenELF64Kernel) GenELF64KernelTy(Name);
+    new (GenELF64Kernel) GenELF64KernelTy(Name, supportsFFI);
 
     return *GenELF64Kernel;
   }
@@ -405,6 +407,9 @@ struct GenELF64DeviceTy : public GenericDeviceTy {
       1, // GV_Max_WG_Size
       1, // GV_Default_WG_Size
   };
+
+  /// Whether this device supports FFI-based launch.
+  bool supportsFFI;
 };
 
 class GenELF64GlobalHandlerTy final : public GenericGlobalHandlerTy {
@@ -441,12 +446,10 @@ struct GenELF64PluginTy final : public GenericPluginTy {
   /// This class should not be copied.
   GenELF64PluginTy(const GenELF64PluginTy &) = delete;
   GenELF64PluginTy(GenELF64PluginTy &&) = delete;
-
   /// Initialize the plugin and return the number of devices.
   Expected<int32_t> initImpl() override {
 #ifdef USES_DYNAMIC_FFI
-    if (auto Err = Plugin::check(ffi_init(), "failed to initialize libffi"))
-      return std::move(Err);
+    supportsFFI = ffi_init() == DYNAMIC_FFI_SUCCESS ? true : false;
 #endif
     ODBG(OLDT_Init) << "GenELF64 plugin detected " << ODBG_IF_LEVEL(2)
                     << NUM_DEVICES << " " << ODBG_RESET_LEVEL() << "devices";
@@ -460,7 +463,7 @@ struct GenELF64PluginTy final : public GenericPluginTy {
   /// Creates a generic ELF device.
   GenericDeviceTy *createDevice(GenericPluginTy &Plugin, int32_t DeviceId,
                                 int32_t NumDevices) override {
-    return new GenELF64DeviceTy(Plugin, DeviceId, NumDevices);
+    return new GenELF64DeviceTy(Plugin, DeviceId, NumDevices, SupportsFFI);
   }
 
   /// Creates a generic global handler.
@@ -510,6 +513,14 @@ struct GenELF64PluginTy final : public GenericPluginTy {
   }
 
   const char *getName() const override { return GETNAME(TARGET_NAME); }
+
+private:
+  /// Whether this plugin supports FFI-based launch.
+#ifdef USES_DYNAMIC_FFI
+  bool SupportsFFI = false;
+#else
+  static constexpr bool SupportsFFI = true;
+#endif
 };
 
 template <typename... ArgsTy>

>From 58d9f5e2891e8585d027df2a8bba856227b79af4 Mon Sep 17 00:00:00 2001
From: Alex Duran <alejandro.duran at intel.com>
Date: Sun, 8 Feb 2026 08:52:49 +0100
Subject: [PATCH 05/10] small cleanup

---
 offload/plugins-nextgen/host/src/rtl.cpp | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/offload/plugins-nextgen/host/src/rtl.cpp b/offload/plugins-nextgen/host/src/rtl.cpp
index 390ff30c07e26..389161a2adaa1 100644
--- a/offload/plugins-nextgen/host/src/rtl.cpp
+++ b/offload/plugins-nextgen/host/src/rtl.cpp
@@ -450,6 +450,9 @@ struct GenELF64PluginTy final : public GenericPluginTy {
   Expected<int32_t> initImpl() override {
 #ifdef USES_DYNAMIC_FFI
     supportsFFI = ffi_init() == DYNAMIC_FFI_SUCCESS ? true : false;
+    if (!supportsFFI)
+      ODBG(OLDT_Init) << "libffi is not available, kernels will not be launched "
+                         "through libffi, and some features may be unavailable";
 #endif
     ODBG(OLDT_Init) << "GenELF64 plugin detected " << ODBG_IF_LEVEL(2)
                     << NUM_DEVICES << " " << ODBG_RESET_LEVEL() << "devices";
@@ -516,11 +519,7 @@ struct GenELF64PluginTy final : public GenericPluginTy {
 
 private:
   /// Whether this plugin supports FFI-based launch.
-#ifdef USES_DYNAMIC_FFI
-  bool SupportsFFI = false;
-#else
-  static constexpr bool SupportsFFI = true;
-#endif
+  bool SupportsFFI = true;
 };
 
 template <typename... ArgsTy>

>From 24b1bca90a62341ffba6d3027e8745549e69a130 Mon Sep 17 00:00:00 2001
From: Alex Duran <alejandro.duran at intel.com>
Date: Sun, 8 Feb 2026 08:59:22 +0100
Subject: [PATCH 06/10] fixes

---
 offload/plugins-nextgen/host/src/rtl.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/offload/plugins-nextgen/host/src/rtl.cpp b/offload/plugins-nextgen/host/src/rtl.cpp
index 389161a2adaa1..48e863afdee84 100644
--- a/offload/plugins-nextgen/host/src/rtl.cpp
+++ b/offload/plugins-nextgen/host/src/rtl.cpp
@@ -449,8 +449,8 @@ struct GenELF64PluginTy final : public GenericPluginTy {
   /// Initialize the plugin and return the number of devices.
   Expected<int32_t> initImpl() override {
 #ifdef USES_DYNAMIC_FFI
-    supportsFFI = ffi_init() == DYNAMIC_FFI_SUCCESS ? true : false;
-    if (!supportsFFI)
+    SupportsFFI = ffi_init() == FFI_OK ? true : false;
+    if (!SupportsFFI)
       ODBG(OLDT_Init) << "libffi is not available, kernels will not be launched "
                          "through libffi, and some features may be unavailable";
 #endif

>From 14fd937d5102f236641d27aadc76e75c10b7d606 Mon Sep 17 00:00:00 2001
From: Alex Duran <alejandro.duran at intel.com>
Date: Sun, 8 Feb 2026 11:28:48 +0100
Subject: [PATCH 07/10] format

---
 offload/plugins-nextgen/host/src/rtl.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/offload/plugins-nextgen/host/src/rtl.cpp b/offload/plugins-nextgen/host/src/rtl.cpp
index 48e863afdee84..11405ac4f1e05 100644
--- a/offload/plugins-nextgen/host/src/rtl.cpp
+++ b/offload/plugins-nextgen/host/src/rtl.cpp
@@ -451,8 +451,9 @@ struct GenELF64PluginTy final : public GenericPluginTy {
 #ifdef USES_DYNAMIC_FFI
     SupportsFFI = ffi_init() == FFI_OK ? true : false;
     if (!SupportsFFI)
-      ODBG(OLDT_Init) << "libffi is not available, kernels will not be launched "
-                         "through libffi, and some features may be unavailable";
+      ODBG(OLDT_Init)
+          << "libffi is not available, kernels will not be launched "
+             "through libffi, and some features may be unavailable";
 #endif
     ODBG(OLDT_Init) << "GenELF64 plugin detected " << ODBG_IF_LEVEL(2)
                     << NUM_DEVICES << " " << ODBG_RESET_LEVEL() << "devices";

>From dd8d731afa2eb27b8273a2a954f40ff748ac7126 Mon Sep 17 00:00:00 2001
From: Alex Duran <alejandro.duran at intel.com>
Date: Sun, 8 Feb 2026 15:31:50 +0100
Subject: [PATCH 08/10] Remove supported archs check from Makefile

---
 offload/plugins-nextgen/host/CMakeLists.txt | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/offload/plugins-nextgen/host/CMakeLists.txt b/offload/plugins-nextgen/host/CMakeLists.txt
index e1d66b67cbb53..e0bde74f24d8d 100644
--- a/offload/plugins-nextgen/host/CMakeLists.txt
+++ b/offload/plugins-nextgen/host/CMakeLists.txt
@@ -1,15 +1,4 @@
-if(WIN32)
-set(supported_targets AMD64 IA64 ARM64 EM64T X86)
-else()
-set(supported_targets x86_64 aarch64 ppc64 ppc64le riscv64 s390x loongarch64)
-endif()
-
 set(machine ${CMAKE_SYSTEM_PROCESSOR})
-if(NOT ${machine} IN_LIST supported_targets)
-  message(STATUS "Not building ${machine} NextGen offloading plugin")
-  return()
-endif()
-
 if(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64le$")
   set(machine ppc64)
 endif()

>From eade554164a1bdae6a743d2cbc4c9ce0a44ed1e1 Mon Sep 17 00:00:00 2001
From: Alex Duran <alejandro.duran at intel.com>
Date: Mon, 9 Feb 2026 09:20:58 +0100
Subject: [PATCH 09/10] fix case

---
 offload/plugins-nextgen/host/src/rtl.cpp | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/offload/plugins-nextgen/host/src/rtl.cpp b/offload/plugins-nextgen/host/src/rtl.cpp
index 11405ac4f1e05..cba87d68142a8 100644
--- a/offload/plugins-nextgen/host/src/rtl.cpp
+++ b/offload/plugins-nextgen/host/src/rtl.cpp
@@ -66,7 +66,7 @@ using namespace error;
 struct GenELF64KernelTy : public GenericKernelTy {
   /// Construct the kernel with a name and an execution mode.
   GenELF64KernelTy(const char *Name, bool SupportsFFI)
-      : GenericKernelTy(Name), Func(nullptr), supportsFFI(SupportsFFI) {}
+      : GenericKernelTy(Name), Func(nullptr), SupportsFFI(SupportsFFI) {}
 
   /// Initialize the kernel.
   Error initImpl(GenericDeviceTy &Device, DeviceImageTy &Image) override {
@@ -100,7 +100,7 @@ struct GenELF64KernelTy : public GenericKernelTy {
                    uint32_t NumBlocks[3], KernelArgsTy &KernelArgs,
                    KernelLaunchParamsTy LaunchParams,
                    AsyncInfoWrapperTy &AsyncInfoWrapper) const override {
-    if (!supportsFFI)
+    if (!SupportsFFI)
       return Plugin::error(ErrorCode::UNSUPPORTED,
                            "libffi is not available, cannot launch kernel");
     // Create a vector of ffi_types, one per argument.
@@ -134,7 +134,7 @@ struct GenELF64KernelTy : public GenericKernelTy {
   /// The kernel function to execute.
   void (*Func)(void);
   /// Whether this kernel supports FFI-based launch.
-  bool supportsFFI;
+  bool SupportsFFI;
 };
 
 /// Class implementing the GenELF64 device images properties.
@@ -159,7 +159,7 @@ struct GenELF64DeviceTy : public GenericDeviceTy {
   GenELF64DeviceTy(GenericPluginTy &Plugin, int32_t DeviceId,
                    int32_t NumDevices, bool SupportsFFI)
       : GenericDeviceTy(Plugin, DeviceId, NumDevices, GenELF64GridValues),
-        supportsFFI(SupportsFFI) {}
+        SupportsFFI(SupportsFFI) {}
 
   ~GenELF64DeviceTy() {}
 
@@ -191,7 +191,7 @@ struct GenELF64DeviceTy : public GenericDeviceTy {
       return Plugin::error(ErrorCode::OUT_OF_RESOURCES,
                            "failed to allocate memory for GenELF64 kernel");
 
-    new (GenELF64Kernel) GenELF64KernelTy(Name, supportsFFI);
+    new (GenELF64Kernel) GenELF64KernelTy(Name, SupportsFFI);
 
     return *GenELF64Kernel;
   }
@@ -409,7 +409,7 @@ struct GenELF64DeviceTy : public GenericDeviceTy {
   };
 
   /// Whether this device supports FFI-based launch.
-  bool supportsFFI;
+  bool SupportsFFI;
 };
 
 class GenELF64GlobalHandlerTy final : public GenericGlobalHandlerTy {

>From 51d613864b3b46600bd127aa5b425f77ddd5e8d9 Mon Sep 17 00:00:00 2001
From: Alex Duran <alejandro.duran at intel.com>
Date: Tue, 10 Feb 2026 10:41:04 +0100
Subject: [PATCH 10/10] Disable ELF images on windows

---
 offload/plugins-nextgen/host/src/rtl.cpp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/offload/plugins-nextgen/host/src/rtl.cpp b/offload/plugins-nextgen/host/src/rtl.cpp
index cba87d68142a8..c49e4eb048da3 100644
--- a/offload/plugins-nextgen/host/src/rtl.cpp
+++ b/offload/plugins-nextgen/host/src/rtl.cpp
@@ -487,7 +487,12 @@ struct GenELF64PluginTy final : public GenericPluginTy {
 
   /// All images (ELF-compatible) should be compatible with this plugin.
   Expected<bool> isELFCompatible(uint32_t, StringRef) const override {
+#if _WIN32
+    // Windows does not support ELF binaries, so return false for all images.
+    return false;
+#else
     return true;
+#endif // _WIN32
   }
 
   Triple::ArchType getTripleArch() const override {



More information about the llvm-commits mailing list