From ea8bb4d633683f5cbfd82491620be3056f347a02 Mon Sep 17 00:00:00 2001 From: estewart08 Date: Mon, 19 Aug 2024 17:59:21 -0500 Subject: [PATCH] [offload] - Fix issue with standalone debug offload build (#104647) Error: CommandLine Error: Option 'attributor-manifest-internal' registered more than once During the standalone debug build of offload the above error is seen at app runtime when using a prebuilt llvm with LLVM_LINK_LLVM_DYLIB=ON. This is caused by linking both libLLVM.so and various archives that are found via llvm_map_components_to_libnames for jit support. --- offload/plugins-nextgen/common/CMakeLists.txt | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/offload/plugins-nextgen/common/CMakeLists.txt b/offload/plugins-nextgen/common/CMakeLists.txt index 284f98875170..aea20c6ec314 100644 --- a/offload/plugins-nextgen/common/CMakeLists.txt +++ b/offload/plugins-nextgen/common/CMakeLists.txt @@ -11,13 +11,15 @@ add_dependencies(PluginCommon intrinsics_gen) # Only enable JIT for those targets that LLVM can support. set(supported_jit_targets AMDGPU NVPTX) -foreach(target IN LISTS supported_jit_targets) - if("${target}" IN_LIST LLVM_TARGETS_TO_BUILD) - target_compile_definitions(PluginCommon PRIVATE "LIBOMPTARGET_JIT_${target}") - llvm_map_components_to_libnames(llvm_libs ${target}) - target_link_libraries(PluginCommon PRIVATE ${llvm_libs}) - endif() -endforeach() +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}") + llvm_map_components_to_libnames(llvm_libs ${target}) + target_link_libraries(PluginCommon PRIVATE ${llvm_libs}) + endif() + endforeach() +endif() # Include the RPC server from the `libc` project if availible. if(TARGET llvmlibc_rpc_server AND ${LIBOMPTARGET_GPU_LIBC_SUPPORT})