[llvm] [Offload] Fix: Target JIT registers no backends when LLVM_LINK_LLVM_DYLIB=ON (PR #227370)

via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 29 09:54:44 PDT 2026


================
@@ -22,15 +22,15 @@ add_dependencies(PluginCommon intrinsics_gen PluginErrcodes OffloadAPI)
 
 # Only enable JIT for those targets that LLVM can support.
 set(supported_jit_targets AMDGPU NVPTX SPIRV)
-if (NOT LLVM_LINK_LLVM_DYLIB)
-  foreach(target IN LISTS supported_jit_targets)
-    if("${target}" IN_LIST LLVM_TARGETS_TO_BUILD)
-      target_compile_definitions(PluginCommon PRIVATE "LIBOMPTARGET_JIT_${target}")
+foreach(target IN LISTS supported_jit_targets)
+  if("${target}" IN_LIST LLVM_TARGETS_TO_BUILD)
+    target_compile_definitions(PluginCommon PRIVATE "LIBOMPTARGET_JIT_${target}")
+    if (NOT LLVM_LINK_LLVM_DYLIB)
       llvm_map_components_to_libnames(llvm_libs ${target})
       target_link_libraries(PluginCommon PRIVATE ${llvm_libs})
----------------
sgasho wrote:

My understanding is yes, we need to link libLLVM.so, and each plugin already links it, so we don't have to link libLLVM.so here.

inside def of add_target_library:

https://github.com/llvm/llvm-project/blob/91b08a503f4f712ea8ce83dc3887f8be7738e95a/offload/plugins-nextgen/CMakeLists.txt#L8-L21

each plugin and calls add_target_library, which means it links libLLVM.so
for example, cuda:

https://github.com/llvm/llvm-project/blob/91b08a503f4f712ea8ce83dc3887f8be7738e95a/offload/plugins-nextgen/cuda/CMakeLists.txt#L2

https://github.com/llvm/llvm-project/pull/227370


More information about the llvm-commits mailing list