[llvm] [offload] - Fix issue with standalone debug offload build (PR #104647)

via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 16 16:03:07 PDT 2024


https://github.com/estewart08 created https://github.com/llvm/llvm-project/pull/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.

>From ef15d8946e449ab0cc73182cbf7283fd7d0c1223 Mon Sep 17 00:00:00 2001
From: Ethan Stewart <ethan.stewart at amd.com>
Date: Fri, 16 Aug 2024 18:59:24 -0400
Subject: [PATCH] [offload] - Fix issue with standalone debug offload build

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 | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/offload/plugins-nextgen/common/CMakeLists.txt b/offload/plugins-nextgen/common/CMakeLists.txt
index 284f98875170cd..fb3bf9591b1429 100644
--- a/offload/plugins-nextgen/common/CMakeLists.txt
+++ b/offload/plugins-nextgen/common/CMakeLists.txt
@@ -13,8 +13,12 @@ add_dependencies(PluginCommon intrinsics_gen)
 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_compile_definitions(PluginCommon PRIVATE "LIBOMPTARGET_JIT_${target}")
+    if (LLVM_LINK_LLVM_DYLIB)
+      set(llvm_libs LLVM)
+    else()
+      llvm_map_components_to_libnames(llvm_libs ${target})
+    endif()
     target_link_libraries(PluginCommon PRIVATE ${llvm_libs})
   endif()
 endforeach()



More information about the llvm-commits mailing list