Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Libomptarget] Unify and simplify plugin CMake #86191

Merged
merged 1 commit into from
Mar 22, 2024
Merged

Conversation

jhuber6
Copy link
Contributor

@jhuber6 jhuber6 commented Mar 21, 2024

Summary:
This patch reworks the CMake handling for building plugins. All this
does is pull a lot of shared and common logic into a single helper function.
This also simplifies the OMPT libraries from being built separately instead of just added.

@llvmbot
Copy link
Collaborator

llvmbot commented Mar 21, 2024

@llvm/pr-subscribers-backend-amdgpu

Author: Joseph Huber (jhuber6)

Changes

Summary:
Currently we use a CMake object library to provide the unified interface
between all the plugins that depend on the common utilities. We then use
the public targets to propagate these to the actual plugins themselves.
The problem with this is that it requires that the plugin interface
files all be identical. For examplle, currently when you compile with
debugging on the common utilities will show up as PluginInterface
despite which plugin they are a part of.

This is an issue for moving to a shared library interface. The shared
libraries will need to provide a separate namespace for each RTL
function, which means that they will all be separate implementations.
This patch instead moves all of this logic into a helper function that
sets up the target and the default arguments. In the future this will be
changed to a STATIC target, but for now the interface is unchanged.
The only effect this has is that the plugins will now always state
TARGET AMDGPU RTL if it is executing from the AMDGPU plugin.


Patch is 21.81 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/86191.diff

8 Files Affected:

  • (modified) openmp/libomptarget/plugins-nextgen/CMakeLists.txt (+96-1)
  • (modified) openmp/libomptarget/plugins-nextgen/amdgpu/CMakeLists.txt (+13-67)
  • (removed) openmp/libomptarget/plugins-nextgen/common/CMakeLists.txt (-110)
  • (removed) openmp/libomptarget/plugins-nextgen/common/OMPT/CMakeLists.txt (-70)
  • (modified) openmp/libomptarget/plugins-nextgen/cuda/CMakeLists.txt (+5-35)
  • (modified) openmp/libomptarget/plugins-nextgen/host/CMakeLists.txt (+4-25)
  • (modified) openmp/libomptarget/test/offloading/ompx_bare.c (+1-1)
  • (modified) openmp/libomptarget/test/offloading/struct_mapping_with_pointers.cpp (+3-3)
diff --git a/openmp/libomptarget/plugins-nextgen/CMakeLists.txt b/openmp/libomptarget/plugins-nextgen/CMakeLists.txt
index 75540f0558442e..998e033d7d5624 100644
--- a/openmp/libomptarget/plugins-nextgen/CMakeLists.txt
+++ b/openmp/libomptarget/plugins-nextgen/CMakeLists.txt
@@ -10,7 +10,102 @@
 #
 ##===----------------------------------------------------------------------===##
 
-add_subdirectory(common)
+# Common interface to handle creating a plugin library.
+set(common_dir ${CMAKE_CURRENT_SOURCE_DIR}/common)
+function(add_target_library target_name lib_name)
+  llvm_map_components_to_libnames(llvm_libs
+    ${LLVM_TARGETS_TO_BUILD}
+    AggressiveInstCombine
+    Analysis
+    BinaryFormat
+    BitReader
+    BitWriter
+    CodeGen
+    Core
+    Extensions
+    InstCombine
+    Instrumentation
+    IPO
+    IRReader
+    Linker
+    MC
+    Object
+    Passes
+    Remarks
+    ScalarOpts
+    Support
+    Target
+    TargetParser
+    TransformUtils
+    Vectorize
+  )
+
+  add_llvm_library(${target_name} SHARED
+    ${common_dir}/src/PluginInterface.cpp
+    ${common_dir}/src/GlobalHandler.cpp
+    ${common_dir}/src/JIT.cpp
+    ${common_dir}/src/RPC.cpp
+    ${common_dir}/src/Utils/ELF.cpp
+
+    NO_INSTALL_RPATH
+    BUILDTREE_ONLY
+  )
+
+  target_link_libraries(${target_name} PUBLIC ${llvm_libs} ${OPENMP_PTHREAD_LIB})
+  llvm_update_compile_flags(${target_name})
+
+  # Include the RPC server from the `libc` project if availible.
+  if(TARGET llvmlibc_rpc_server AND ${LIBOMPTARGET_GPU_LIBC_SUPPORT})
+    target_link_libraries(${target_name} PRIVATE llvmlibc_rpc_server)
+    target_compile_definitions(${target_name} PRIVATE LIBOMPTARGET_RPC_SUPPORT)
+  elseif(${LIBOMPTARGET_GPU_LIBC_SUPPORT})
+    find_library(llvmlibc_rpc_server NAMES llvmlibc_rpc_server
+                 PATHS ${LIBOMPTARGET_LLVM_LIBRARY_DIR} NO_DEFAULT_PATH)
+    if(llvmlibc_rpc_server)
+      target_link_libraries(${target_name} PRIVATE ${llvmlibc_rpc_server})
+      target_compile_definitions(${target_name} PRIVATE LIBOMPTARGET_RPC_SUPPORT)
+      # We may need to get the headers directly from the 'libc' source directory.
+      target_include_directories(${target_name} PRIVATE
+                                 ${CMAKE_SOURCE_DIR}/../libc/utils/gpu/server
+                                 ${CMAKE_SOURCE_DIR}/../libc/include)
+    endif()
+  endif()
+
+  # Only enable JIT for those targets that LLVM can support.
+  string(TOUPPER "${LLVM_TARGETS_TO_BUILD}" TargetsSupported)
+  foreach(Target ${TargetsSupported})
+    target_compile_definitions(${target_name} PRIVATE "LIBOMPTARGET_JIT_${Target}")
+  endforeach()
+
+  target_compile_definitions(${target_name} PRIVATE TARGET_NAME=${lib_name})
+  target_compile_definitions(${target_name} PRIVATE 
+                             DEBUG_PREFIX="TARGET ${lib_name} RTL")
+
+  # If we have OMPT enabled include it in the list of sourced.
+  if (OMPT_TARGET_DEFAULT AND LIBOMPTARGET_OMPT_SUPPORT)
+    target_sources(${target_name} PRIVATE ${common_dir}/OMPT/OmptCallback.cpp)
+  endif()
+
+  if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
+    # On FreeBSD, the 'environ' symbol is undefined at link time, but resolved by
+    # the dynamic linker at runtime. Therefore, allow the symbol to be undefined
+    # when creating a shared library.
+    target_link_libraries(${target_name} PRIVATE "-Wl,--allow-shlib-undefined")
+  else()
+    target_link_libraries(${target_name} PRIVATE "-Wl,-z,defs")
+  endif()
+
+  target_include_directories(${target_name} PRIVATE
+    ${LIBOMPTARGET_INCLUDE_DIR}
+    ${common_dir}/include
+  )
+  if(LIBOMP_HAVE_VERSION_SCRIPT_FLAG)
+    target_link_libraries(${target_name} PRIVATE
+    "-Wl,--version-script=${common_dir}/../exports")
+  endif()
+  set_target_properties(${target_name} PROPERTIES CXX_VISIBILITY_PRESET protected)
+endfunction()
+
 add_subdirectory(amdgpu)
 add_subdirectory(cuda)
 add_subdirectory(host)
diff --git a/openmp/libomptarget/plugins-nextgen/amdgpu/CMakeLists.txt b/openmp/libomptarget/plugins-nextgen/amdgpu/CMakeLists.txt
index 8fbfe4d9b13f73..40df77102c78fb 100644
--- a/openmp/libomptarget/plugins-nextgen/amdgpu/CMakeLists.txt
+++ b/openmp/libomptarget/plugins-nextgen/amdgpu/CMakeLists.txt
@@ -27,76 +27,23 @@ if(NOT (CMAKE_SYSTEM_PROCESSOR MATCHES "(x86_64)|(ppc64le)|(aarch64)$" AND CMAKE
   return()
 endif()
 
-################################################################################
-# Define the suffix for the runtime messaging dumps.
-add_definitions(-DTARGET_NAME=AMDGPU)
-
-# Define debug prefix. TODO: This should be automatized in the Debug.h but it
-# requires changing the original plugins.
-add_definitions(-DDEBUG_PREFIX="TARGET AMDGPU RTL")
+# Create the library and add the default arguments.
+add_target_library(omptarget.rtl.amdgpu AMDGPU)
 
-set(LIBOMPTARGET_DLOPEN_LIBHSA OFF)
-option(LIBOMPTARGET_FORCE_DLOPEN_LIBHSA "Build with dlopened libhsa" ${LIBOMPTARGET_DLOPEN_LIBHSA})
-
-if (${hsa-runtime64_FOUND} AND NOT LIBOMPTARGET_FORCE_DLOPEN_LIBHSA)
-  libomptarget_say("Building AMDGPU NextGen plugin linked against libhsa")
-  set(LIBOMPTARGET_EXTRA_SOURCE)
-  set(LIBOMPTARGET_DEP_LIBRARIES hsa-runtime64::hsa-runtime64)
-else()
-  libomptarget_say("Building AMDGPU NextGen plugin for dlopened libhsa")
-  include_directories(dynamic_hsa)
-  set(LIBOMPTARGET_EXTRA_SOURCE dynamic_hsa/hsa.cpp)
-  set(LIBOMPTARGET_DEP_LIBRARIES)
-endif()
+target_sources(omptarget.rtl.amdgpu PRIVATE src/rtl.cpp)
+target_include_directories(omptarget.rtl.amdgpu PRIVATE
+                           ${CMAKE_CURRENT_SOURCE_DIR}/utils)
 
-if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
-  # On FreeBSD, the 'environ' symbol is undefined at link time, but resolved by
-  # the dynamic linker at runtime. Therefore, allow the symbol to be undefined
-  # when creating a shared library.
-  set(LDFLAGS_UNDEFINED "-Wl,--allow-shlib-undefined")
+option(LIBOMPTARGET_FORCE_DLOPEN_LIBHSA "Build with dlopened libhsa" OFF)
+if(hsa-runtime64_FOUND AND NOT LIBOMPTARGET_FORCE_DLOPEN_LIBHSA)
+  libomptarget_say("Building AMDGPU plugin linked against libhsa")
+  target_link_libraries(omptarget.rtl.amdgpu PRIVATE hsa-runtime64::hsa-runtime64)
 else()
-  set(LDFLAGS_UNDEFINED "-Wl,-z,defs")
+  libomptarget_say("Building AMDGPU plugin for dlopened libhsa")
+  target_include_directories(omptarget.rtl.amdgpu PRIVATE dynamic_hsa)
+  target_sources(omptarget.rtl.amdgpu PRIVATE dynamic_hsa/hsa.cpp)
 endif()
 
-add_llvm_library(omptarget.rtl.amdgpu SHARED
-  src/rtl.cpp
-  ${LIBOMPTARGET_EXTRA_SOURCE}
-
-  ADDITIONAL_HEADER_DIRS
-  ${LIBOMPTARGET_INCLUDE_DIR}
-  ${CMAKE_CURRENT_SOURCE_DIR}/utils
-
-  LINK_COMPONENTS
-  Support
-  Object
-
-  LINK_LIBS
-  PRIVATE
-  PluginCommon
-  ${LIBOMPTARGET_DEP_LIBRARIES}
-  ${OPENMP_PTHREAD_LIB}
-  ${LDFLAGS_UNDEFINED}
-
-  NO_INSTALL_RPATH
-  BUILDTREE_ONLY
-)
-
-if ((OMPT_TARGET_DEFAULT) AND (LIBOMPTARGET_OMPT_SUPPORT))
-  target_link_libraries(omptarget.rtl.amdgpu PRIVATE OMPT)
-endif()
-
-if (LIBOMP_HAVE_VERSION_SCRIPT_FLAG)
-  target_link_libraries(omptarget.rtl.amdgpu PRIVATE
-    "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/../exports")
-endif()
-
-target_include_directories(
-  omptarget.rtl.amdgpu
-  PRIVATE
-  ${LIBOMPTARGET_INCLUDE_DIR}
-  ${CMAKE_CURRENT_SOURCE_DIR}/utils
-)
-
 # Configure testing for the AMDGPU plugin. We will build tests if we could a
 # functional AMD GPU on the system, or if manually specifies by the user.
 option(LIBOMPTARGET_FORCE_AMDGPU_TESTS "Build AMDGPU libomptarget tests" OFF)
@@ -114,5 +61,4 @@ endif()
 # Install plugin under the lib destination folder.
 install(TARGETS omptarget.rtl.amdgpu LIBRARY DESTINATION "${OPENMP_INSTALL_LIBDIR}")
 set_target_properties(omptarget.rtl.amdgpu PROPERTIES
-  INSTALL_RPATH "$ORIGIN" BUILD_RPATH "$ORIGIN:${CMAKE_CURRENT_BINARY_DIR}/.."
-  CXX_VISIBILITY_PRESET protected)
+  INSTALL_RPATH "$ORIGIN" BUILD_RPATH "$ORIGIN:${CMAKE_CURRENT_BINARY_DIR}/..")
diff --git a/openmp/libomptarget/plugins-nextgen/common/CMakeLists.txt b/openmp/libomptarget/plugins-nextgen/common/CMakeLists.txt
deleted file mode 100644
index 085d443071650e..00000000000000
--- a/openmp/libomptarget/plugins-nextgen/common/CMakeLists.txt
+++ /dev/null
@@ -1,110 +0,0 @@
-##===----------------------------------------------------------------------===##
-#
-# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-# See https://llvm.org/LICENSE.txt for license information.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-#
-##===----------------------------------------------------------------------===##
-#
-# Common parts which can be used by all plugins
-#
-##===----------------------------------------------------------------------===##
-
-# NOTE: Don't try to build `PluginInterface` using `add_llvm_library` because we
-# don't want to export `PluginInterface` while `add_llvm_library` requires that.
-add_library(PluginCommon OBJECT
-  src/PluginInterface.cpp
-  src/GlobalHandler.cpp
-  src/JIT.cpp
-  src/RPC.cpp
-  src/Utils/ELF.cpp
-)
-
-# Only enable JIT for those targets that LLVM can support.
-string(TOUPPER "${LLVM_TARGETS_TO_BUILD}" TargetsSupported)
-foreach(Target ${TargetsSupported})
-	target_compile_definitions(PluginCommon PRIVATE "LIBOMPTARGET_JIT_${Target}")
-endforeach()
-
-# This is required when using LLVM libraries.
-llvm_update_compile_flags(PluginCommon)
-
-if (LLVM_LINK_LLVM_DYLIB)
-  set(llvm_libs LLVM)
-else()
-  llvm_map_components_to_libnames(llvm_libs
-    ${LLVM_TARGETS_TO_BUILD}
-    AggressiveInstCombine
-    Analysis
-    BinaryFormat
-    BitReader
-    BitWriter
-    CodeGen
-    Core
-    Extensions
-    InstCombine
-    Instrumentation
-    IPO
-    IRReader
-    Linker
-    MC
-    Object
-    Passes
-    Remarks
-    ScalarOpts
-    Support
-    Target
-    TargetParser
-    TransformUtils
-    Vectorize
-  )
-endif()
-
-target_link_libraries(PluginCommon
-  PUBLIC
-    ${llvm_libs}
-)
-
-# Include the RPC server from the `libc` project if availible.
-if(TARGET llvmlibc_rpc_server AND ${LIBOMPTARGET_GPU_LIBC_SUPPORT})
-	target_link_libraries(PluginCommon PRIVATE llvmlibc_rpc_server)
-	target_compile_definitions(PluginCommon PRIVATE LIBOMPTARGET_RPC_SUPPORT)
-elseif(${LIBOMPTARGET_GPU_LIBC_SUPPORT})
-  find_library(llvmlibc_rpc_server NAMES llvmlibc_rpc_server
-               PATHS ${LIBOMPTARGET_LLVM_LIBRARY_DIR} NO_DEFAULT_PATH)
-  if(llvmlibc_rpc_server)
-		target_link_libraries(PluginCommon PRIVATE ${llvmlibc_rpc_server})
-		target_compile_definitions(PluginCommon PRIVATE LIBOMPTARGET_RPC_SUPPORT)
-    # We may need to get the headers directly from the 'libc' source directory.
-    target_include_directories(PluginCommon PRIVATE
-                               ${CMAKE_SOURCE_DIR}/../libc/utils/gpu/server
-                               ${CMAKE_SOURCE_DIR}/../libc/include)
-  endif()
-endif()
-
-if ((OMPT_TARGET_DEFAULT) AND (LIBOMPTARGET_OMPT_SUPPORT))
-	target_link_libraries(PluginCommon PUBLIC OMPT)
-endif()
-
-# Define the TARGET_NAME and DEBUG_PREFIX.
-target_compile_definitions(PluginCommon PRIVATE
-  TARGET_NAME="PluginInterface"
-  DEBUG_PREFIX="PluginInterface"
-)
-
-target_compile_options(PluginCommon PUBLIC ${offload_compile_flags})
-target_link_options(PluginCommon PUBLIC ${offload_link_flags})
-
-target_include_directories(PluginCommon
-  PRIVATE
-  ${LIBOMPTARGET_INCLUDE_DIR}
-  PUBLIC
-  ${CMAKE_CURRENT_SOURCE_DIR}/include
-)
-
-set_target_properties(PluginCommon PROPERTIES
-  POSITION_INDEPENDENT_CODE ON
-  CXX_VISIBILITY_PRESET protected)
-
-add_subdirectory(OMPT)
-
diff --git a/openmp/libomptarget/plugins-nextgen/common/OMPT/CMakeLists.txt b/openmp/libomptarget/plugins-nextgen/common/OMPT/CMakeLists.txt
deleted file mode 100644
index be4c743665b3e9..00000000000000
--- a/openmp/libomptarget/plugins-nextgen/common/OMPT/CMakeLists.txt
+++ /dev/null
@@ -1,70 +0,0 @@
-##===----------------------------------------------------------------------===##
-#
-# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-# See https://llvm.org/LICENSE.txt for license information.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-#
-##===----------------------------------------------------------------------===##
-#
-# Aggregation of parts which can be used by OpenMP tools
-#
-##===----------------------------------------------------------------------===##
-
-# NOTE: Don't try to build `OMPT` using `add_llvm_library` because we
-# don't want to export `OMPT` while `add_llvm_library` requires that.
-add_library(OMPT OBJECT
-  OmptCallback.cpp)
-
-# This is required when using LLVM libraries.
-llvm_update_compile_flags(OMPT)
-
-if (LLVM_LINK_LLVM_DYLIB)
-  set(llvm_libs LLVM)
-else()
-  llvm_map_components_to_libnames(llvm_libs
-    ${LLVM_TARGETS_TO_BUILD}
-    AggressiveInstCombine
-    Analysis
-    BinaryFormat
-    BitReader
-    BitWriter
-    CodeGen
-    Core
-    Extensions
-    InstCombine
-    Instrumentation
-    IPO
-    IRReader
-    Linker
-    MC
-    Object
-    Passes
-    Remarks
-    ScalarOpts
-    Support
-    Target
-    TargetParser
-    TransformUtils
-    Vectorize
-  )
-endif()
-
-target_link_libraries(OMPT
-  PUBLIC
-    ${llvm_libs}
-)
-
-# Define the TARGET_NAME and DEBUG_PREFIX.
-target_compile_definitions(OMPT PRIVATE
-  TARGET_NAME="OMPT"
-  DEBUG_PREFIX="OMPT"
-)
-
-target_include_directories(OMPT
-  INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}
-  PRIVATE ${LIBOMPTARGET_INCLUDE_DIR}
-)
-
-set_target_properties(OMPT PROPERTIES
-  POSITION_INDEPENDENT_CODE ON
-  CXX_VISIBILITY_PRESET protected)
diff --git a/openmp/libomptarget/plugins-nextgen/cuda/CMakeLists.txt b/openmp/libomptarget/plugins-nextgen/cuda/CMakeLists.txt
index 2bfb47168a7f3b..b3530462aa19ba 100644
--- a/openmp/libomptarget/plugins-nextgen/cuda/CMakeLists.txt
+++ b/openmp/libomptarget/plugins-nextgen/cuda/CMakeLists.txt
@@ -23,34 +23,12 @@ endif()
 
 libomptarget_say("Building CUDA NextGen offloading plugin.")
 
-set(LIBOMPTARGET_DLOPEN_LIBCUDA OFF)
-option(LIBOMPTARGET_FORCE_DLOPEN_LIBCUDA "Build with dlopened libcuda" ${LIBOMPTARGET_DLOPEN_LIBCUDA})
-
-add_llvm_library(omptarget.rtl.cuda SHARED
-  src/rtl.cpp
-
-  LINK_COMPONENTS
-  Support
-  Object
-
-  LINK_LIBS PRIVATE
-  PluginCommon
-  ${OPENMP_PTHREAD_LIB}
-
-  NO_INSTALL_RPATH
-  BUILDTREE_ONLY
-)
-
-if ((OMPT_TARGET_DEFAULT) AND (LIBOMPTARGET_OMPT_SUPPORT))
-  target_link_libraries(omptarget.rtl.cuda PRIVATE OMPT)
-endif()
-
-if (LIBOMP_HAVE_VERSION_SCRIPT_FLAG)
-  target_link_libraries(omptarget.rtl.cuda PRIVATE
-  "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/../exports,-z,defs")
-endif()
+# Create the library and add the default arguments.
+add_target_library(omptarget.rtl.cuda CUDA)
 
+target_sources(omptarget.rtl.cuda PRIVATE src/rtl.cpp)
 
+option(LIBOMPTARGET_FORCE_DLOPEN_LIBCUDA "Build with dlopened libcuda" OFF)
 if(LIBOMPTARGET_DEP_CUDA_FOUND AND NOT LIBOMPTARGET_FORCE_DLOPEN_LIBCUDA)
   libomptarget_say("Building CUDA plugin linked against libcuda")
   target_link_libraries(omptarget.rtl.cuda PRIVATE CUDA::cuda_driver)
@@ -60,13 +38,6 @@ else()
   target_sources(omptarget.rtl.cuda PRIVATE dynamic_cuda/cuda.cpp)
 endif()
 
-# Define debug prefix. TODO: This should be automatized in the Debug.h but it
-# requires changing the original plugins.
-target_compile_definitions(omptarget.rtl.cuda PRIVATE TARGET_NAME="CUDA")
-target_compile_definitions(omptarget.rtl.cuda PRIVATE DEBUG_PREFIX="TARGET CUDA RTL")
-
-target_include_directories(omptarget.rtl.cuda PRIVATE ${LIBOMPTARGET_INCLUDE_DIR})
-
 # Configure testing for the CUDA plugin. We will build tests if we could a
 # functional NVIDIA GPU on the system, or if manually specifies by the user.
 option(LIBOMPTARGET_FORCE_NVIDIA_TESTS "Build NVIDIA libomptarget tests" OFF)
@@ -84,5 +55,4 @@ endif()
 # Install plugin under the lib destination folder.
 install(TARGETS omptarget.rtl.cuda LIBRARY DESTINATION "${OPENMP_INSTALL_LIBDIR}")
 set_target_properties(omptarget.rtl.cuda PROPERTIES
-  INSTALL_RPATH "$ORIGIN" BUILD_RPATH "$ORIGIN:${CMAKE_CURRENT_BINARY_DIR}/.."
-  CXX_VISIBILITY_PRESET protected)
+  INSTALL_RPATH "$ORIGIN" BUILD_RPATH "$ORIGIN:${CMAKE_CURRENT_BINARY_DIR}/..")
diff --git a/openmp/libomptarget/plugins-nextgen/host/CMakeLists.txt b/openmp/libomptarget/plugins-nextgen/host/CMakeLists.txt
index 5ccb20e305e81b..1d1398edfd023a 100644
--- a/openmp/libomptarget/plugins-nextgen/host/CMakeLists.txt
+++ b/openmp/libomptarget/plugins-nextgen/host/CMakeLists.txt
@@ -2,11 +2,6 @@ if(NOT CMAKE_SYSTEM_NAME MATCHES "Linux")
   return()
 endif()
 
-  # build_generic_elf64("s390x" "S390X" "s390x" "systemz" "s390x-ibm-linux-gnu" "22")
-  # build_generic_elf64("aarch64" "aarch64" "aarch64" "aarch64" "aarch64-unknown-linux-gnu" "183")
-  # build_generic_elf64("ppc64" "PPC64" "ppc64" "ppc64" "powerpc64-ibm-linux-gnu" "21")
-  # build_generic_elf64("x86_64" "x86_64" "x86_64" "x86_64" "x86_64-pc-linux-gnu" "62")
-  # build_generic_elf64("ppc64le" "PPC64le" "ppc64" "ppc64le" "powerpc64le-ibm-linux-gnu" "21")
 set(supported_targets x86_64 aarch64 ppc64 ppc64le s390x)
 if(NOT ${CMAKE_SYSTEM_PROCESSOR} IN_LIST supported_targets)
   libomptarget_say("Not building ${machine} NextGen offloading plugin")
@@ -18,16 +13,10 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64le$")
   set(machine ppc64)
 endif()
 
-add_llvm_library(omptarget.rtl.${machine} SHARED
-  src/rtl.cpp
-  ADDITIONAL_HEADER_DIRS
-    ${LIBOMPTARGET_INCLUDE_DIR}
-  LINK_LIBS PRIVATE
-    PluginCommon
-    ${OPENMP_PTHREAD_LIB}
-  NO_INSTALL_RPATH
-  BUILDTREE_ONLY
-)
+# Create the library and add the default arguments.
+add_target_library(omptarget.rtl.${machine} ${machine})
+
+target_sources(omptarget.rtl.${machine} PRIVATE src/rtl.cpp)
 
 if(LIBOMPTARGET_DEP_LIBFFI_FOUND)
   libomptarget_say("Building ${machine} plugin linked with libffi")
@@ -42,10 +31,6 @@ else()
   target_include_directories(omptarget.rtl.${machine} PRIVATE dynamic_ffi)
 endif()
 
-if(OMPT_TARGET_DEFAULT AND LIBOMPTARGET_OMPT_SUPPORT)
-  target_link_libraries(omptarget.rtl.${machine} PRIVATE OMPT)
-endif()
-
 if(LIBOMP_HAVE_VERSION_SCRIPT_FLAG)
   target_link_libraries(omptarget.rtl.${machine} PRIVATE
     "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/../exports")
@@ -70,12 +55,6 @@ else()
   libomptarget_say("Not generating ${tmachine_name} tests. LibFFI not found.")
 endif()
 
-# Define macro to be used as prefix of the runtime messages for this target.
-target_compile_definitions(omptarget.rtl.${machine} PRIVATE TARGET_NAME=${machine})
-# TODO: This should be automatized in Debug.h.
-target_compile_definitions(omptarget.rtl.${machine} PRIVATE
-                           DEBUG_PREFIX="TARGET ${machine} RTL")
-
 # Define the target specific triples and ELF machine values.
 if(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64le$" OR
    CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64$")
diff --git a/openmp/libomptarget/test/offloading/ompx_bare.c b/openmp/libomptarget/test/offloading/ompx_bare.c
index 3dabdcd15e0d8d..5216b4d6246777 100644
--- a/openmp/libomptarget/test/offloading/ompx_bare.c
+++ b/openmp/libomptarget/test/offloading/ompx_bare.c
@@ -20,7 +20,7 @@ int main(int argc, char *argv[]) {
   const int N = num_blocks * block_size;
   int *data = (int *)malloc(N * sizeof(int));
 
-  // CHECK: "PluginInterface" device 0 info: Launching kernel __omp_offloading_{{.*}} with 64 blocks and 64 threads in SPMD mode
+  // CHECK: {{.*}} device 0 info: Launching kernel __omp_offloading_{{.*}} with 64 blocks and 64 threads in SPMD mode
 
 #pragma omp target teams ompx_bare num_teams(num_blocks) thread_limit(block_size) map(from: data[0:N])
   {
diff --git a/openmp/libomptarget/test/offloading/struct_mapping_with_pointers.cpp b/openmp/libomptarget/test/offloading/struct_mapping_with_pointers.cpp
index f0fde50889dace..49a5d0cf8db2af 100644
--- a/openmp/libomptarget/test/offloading/struct_mapping_with_pointers.cpp
+++ b/openmp/libomptarget/test/offloading/struct_mapping_with_pointers.cpp
@@ -49,7 +49,7 @@ int main() {
 
   // clang-format off
   // CHECK: omptarget --> Looking up mapping(HstPtrBegin=[[DAT_HST_PTR_BASE]], Size=288)...
-  // CHECK: PluginInterface --> MemoryManagerTy::allocate: size 288 with host pointer [[DAT_HST_PTR_BASE]].
+  // CHECK: {{.*}} --> MemoryManagerTy::allocate: size 288 with host pointer [[DAT_HST_PTR_BASE]].
   // CHECK: omptarget --> Creating new map entry with HstPtrBase=[[DAT_HST_PTR_BASE]], HstPtrBegin=[[DAT_HST_PTR_BASE]], TgtAllocBegin=[[DAT_DEVICE_PTR_BASE:0x.*]], TgtP...
[truncated]

Copy link

github-actions bot commented Mar 21, 2024

✅ With the latest revision this PR passed the C/C++ code formatter.

@jhuber6 jhuber6 force-pushed the Unify branch 2 times, most recently from 3d01a6f to 731ebcb Compare March 22, 2024 13:19
@jhuber6
Copy link
Contributor Author

jhuber6 commented Mar 22, 2024

jhuber6 added a commit to jhuber6/llvm-project that referenced this pull request Mar 22, 2024
Summary:
Currently, we get to avoid function collisions due to the fact that
these are built as shared libraries. However, when moving to static
libraries these interface functions will all conflict with eachother.
This patch changes the existing `plugin::` namespace to be a macro
defined by the built library. This means that the resulting symbols will
look like `omp::target::amdgpu::...`.

Depends on llvm#86191
Summary:
Currently we use a CMake object library to provide the unified interface
between all the plugins that depend on the common utilities. We then use
the public targets to propagate these to the actual plugins themselves.
The problem with this is that it requires that the plugin interface
files all be identical. For examplle, currently when you compile with
debugging on the common utilities will show up as `PluginInterface`
despite which plugin they are a part of.

This is an issue for moving to a shared library interface. The shared
libraries will need to provide a separate namespace for each RTL
function, which means that they will all be separate implementations.
This patch instead moves all of this logic into a helper function that
sets up the target and the default arguments. In the future this will be
changed to a `STATIC` target, but for now the interface is unchanged.
The only effect this has is that the plugins will now always state
`TARGET AMDGPU RTL` if it is executing from the AMDGPU plugin.
@jhuber6 jhuber6 changed the title [Libomptarget] Unify interface and compile each plugin separately [Libomptarget] Unify and simplify plugin CMake Mar 22, 2024
Copy link

✅ With the latest revision this PR passed the Python code formatter.

Copy link
Member

@jdoerfert jdoerfert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assuming this is NFC, LG.

@jhuber6 jhuber6 merged commit dcbddc2 into llvm:main Mar 22, 2024
4 checks passed
@uweigand
Copy link
Member

Looks like this broke SystemZ: https://lab.llvm.org/buildbot/#/builders/277/builds/4281

13.515 [409/26/460] Linking CXX shared library /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libomptarget.rtl.s390x.so.19.0git
FAILED: /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libomptarget.rtl.s390x.so.19.0git 
: && /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/./bin/clang++ --target=s390x-ibm-linux -fPIC -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Wall -fcolor-diagnostics -Wcast-qual -Wformat-pedantic -Wimplicit-fallthrough -Wsign-compare -Wno-extra -Wno-pedantic -fno-semantic-interposition -fdata-sections -O3 -DNDEBUG  -Wl,-z,defs -Wl,-z,nodelete   -Wl,--gc-sections -shared -Wl,-soname,libomptarget.rtl.s390x.so.19.0git -o /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libomptarget.rtl.s390x.so.19.0git openmp/libomptarget/plugins-nextgen/common/CMakeFiles/PluginCommon.dir/src/PluginInterface.cpp.o openmp/libomptarget/plugins-nextgen/common/CMakeFiles/PluginCommon.dir/src/GlobalHandler.cpp.o openmp/libomptarget/plugins-nextgen/common/CMakeFiles/PluginCommon.dir/src/JIT.cpp.o openmp/libomptarget/plugins-nextgen/common/CMakeFiles/PluginCommon.dir/src/RPC.cpp.o openmp/libomptarget/plugins-nextgen/common/CMakeFiles/PluginCommon.dir/src/Utils/ELF.cpp.o openmp/libomptarget/plugins-nextgen/common/CMakeFiles/PluginCommon.dir/OMPT/OmptCallback.cpp.o openmp/libomptarget/plugins-nextgen/host/CMakeFiles/omptarget.rtl.s390x.dir/src/rtl.cpp.o  -Wl,-rpath,"\$ORIGIN:/home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/runtimes/runtimes-bins/openmp/libomptarget/plugins-nextgen/host/..:"  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMAArch64CodeGen.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMAArch64AsmParser.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMAArch64Desc.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMAArch64Disassembler.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMAArch64Info.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMAArch64Utils.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMAMDGPUCodeGen.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMAMDGPUAsmParser.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMAMDGPUDesc.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMAMDGPUDisassembler.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMAMDGPUInfo.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMAMDGPUUtils.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMARMCodeGen.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMARMAsmParser.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMARMDesc.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMARMDisassembler.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMARMInfo.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMARMUtils.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMAVRCodeGen.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMAVRAsmParser.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMAVRDesc.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMAVRDisassembler.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMAVRInfo.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMBPFCodeGen.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMBPFAsmParser.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMBPFDesc.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMBPFDisassembler.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMBPFInfo.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMHexagonCodeGen.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMHexagonAsmParser.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMHexagonDesc.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMHexagonDisassembler.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMHexagonInfo.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMLanaiCodeGen.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMLanaiAsmParser.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMLanaiDesc.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMLanaiDisassembler.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMLanaiInfo.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMLoongArchCodeGen.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMLoongArchAsmParser.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMLoongArchDesc.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMLoongArchDisassembler.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMLoongArchInfo.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMMipsCodeGen.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMMipsAsmParser.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMMipsDesc.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMMipsDisassembler.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMMipsInfo.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMMSP430CodeGen.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMMSP430AsmParser.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMMSP430Desc.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMMSP430Disassembler.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMMSP430Info.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMNVPTXCodeGen.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMNVPTXDesc.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMNVPTXInfo.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMPowerPCCodeGen.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMPowerPCAsmParser.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMPowerPCDesc.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMPowerPCDisassembler.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMPowerPCInfo.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMRISCVCodeGen.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMRISCVAsmParser.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMRISCVDesc.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMRISCVDisassembler.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMRISCVInfo.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMSparcCodeGen.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMSparcAsmParser.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMSparcDesc.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMSparcDisassembler.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMSparcInfo.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMSystemZCodeGen.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMSystemZAsmParser.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMSystemZDesc.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMSystemZDisassembler.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMSystemZInfo.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMVECodeGen.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMVEAsmParser.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMVEDesc.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMVEDisassembler.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMVEInfo.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMWebAssemblyCodeGen.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMWebAssemblyAsmParser.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMWebAssemblyDesc.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMWebAssemblyDisassembler.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMWebAssemblyInfo.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMWebAssemblyUtils.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMX86CodeGen.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMX86AsmParser.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMX86Desc.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMX86Disassembler.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMX86Info.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMXCoreCodeGen.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMXCoreDesc.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMXCoreDisassembler.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMXCoreInfo.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMAggressiveInstCombine.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMAnalysis.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMBinaryFormat.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMBitReader.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMBitWriter.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMCodeGen.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMCore.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMExtensions.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMInstCombine.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMInstrumentation.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMipo.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMIRReader.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMLinker.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMMC.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMObject.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMPasses.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMRemarks.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMScalarOpts.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMSupport.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMTarget.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMTargetParser.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMTransformUtils.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMVectorize.a  -lpthread  -Wl,-z,defs  -Wl,--version-script=/home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.src/openmp/libomptarget/plugins-nextgen/common/../exports  /usr/lib/s390x-linux-gnu/libffi.a  -Wl,--version-script=/home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.src/openmp/libomptarget/plugins-nextgen/host/../exports  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMAArch64Desc.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMAArch64Info.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMAArch64Utils.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMCoroutines.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMHipStdPar.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMMIRParser.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMAMDGPUDesc.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMAMDGPUInfo.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMAMDGPUUtils.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMARMDesc.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMARMInfo.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMARMUtils.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMHexagonDesc.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMHexagonInfo.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMLanaiDesc.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMLanaiInfo.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMLoongArchDesc.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMLoongArchInfo.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMipo.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMLinker.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMVectorize.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMFrontendOpenMP.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMFrontendOffloading.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMRISCVDesc.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMRISCVInfo.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMSystemZDesc.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMSystemZInfo.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMWebAssemblyDesc.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMWebAssemblyInfo.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMInstrumentation.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMCFGuard.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMGlobalISel.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMIRPrinter.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMAsmPrinter.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMSelectionDAG.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMCodeGen.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMBitWriter.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMScalarOpts.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMAggressiveInstCombine.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMInstCombine.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMObjCARCOpts.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMTarget.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMTransformUtils.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMAnalysis.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMProfileData.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMSymbolize.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMDebugInfoDWARF.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMDebugInfoPDB.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMObject.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMIRReader.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMBitReader.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMAsmParser.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMMCParser.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMTextAPI.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMDebugInfoMSF.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMDebugInfoBTF.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMCore.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMRemarks.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMBitstreamReader.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMCodeGenTypes.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMMCDisassembler.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMMC.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMBinaryFormat.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMDebugInfoCodeView.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMTargetParser.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMSupport.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMDemangle.a  -lrt  -ldl  -lpthread  -lm  /usr/lib/s390x-linux-gnu/libz.so && :
/usr/bin/ld: duplicate version tag `VERS1.0'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)

Not sure what this is about ...

@jhuber6
Copy link
Contributor Author

jhuber6 commented Mar 23, 2024

Looks like this broke SystemZ: https://lab.llvm.org/buildbot/#/builders/277/builds/4281

13.515 [409/26/460] Linking CXX shared library /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libomptarget.rtl.s390x.so.19.0git
FAILED: /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libomptarget.rtl.s390x.so.19.0git 
: && /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/./bin/clang++ --target=s390x-ibm-linux -fPIC -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Wall -fcolor-diagnostics -Wcast-qual -Wformat-pedantic -Wimplicit-fallthrough -Wsign-compare -Wno-extra -Wno-pedantic -fno-semantic-interposition -fdata-sections -O3 -DNDEBUG  -Wl,-z,defs -Wl,-z,nodelete   -Wl,--gc-sections -shared -Wl,-soname,libomptarget.rtl.s390x.so.19.0git -o /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libomptarget.rtl.s390x.so.19.0git openmp/libomptarget/plugins-nextgen/common/CMakeFiles/PluginCommon.dir/src/PluginInterface.cpp.o openmp/libomptarget/plugins-nextgen/common/CMakeFiles/PluginCommon.dir/src/GlobalHandler.cpp.o openmp/libomptarget/plugins-nextgen/common/CMakeFiles/PluginCommon.dir/src/JIT.cpp.o openmp/libomptarget/plugins-nextgen/common/CMakeFiles/PluginCommon.dir/src/RPC.cpp.o openmp/libomptarget/plugins-nextgen/common/CMakeFiles/PluginCommon.dir/src/Utils/ELF.cpp.o openmp/libomptarget/plugins-nextgen/common/CMakeFiles/PluginCommon.dir/OMPT/OmptCallback.cpp.o openmp/libomptarget/plugins-nextgen/host/CMakeFiles/omptarget.rtl.s390x.dir/src/rtl.cpp.o  -Wl,-rpath,"\$ORIGIN:/home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/runtimes/runtimes-bins/openmp/libomptarget/plugins-nextgen/host/..:"  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMAArch64CodeGen.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMAArch64AsmParser.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMAArch64Desc.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMAArch64Disassembler.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMAArch64Info.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMAArch64Utils.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMAMDGPUCodeGen.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMAMDGPUAsmParser.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMAMDGPUDesc.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMAMDGPUDisassembler.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMAMDGPUInfo.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMAMDGPUUtils.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMARMCodeGen.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMARMAsmParser.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMARMDesc.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMARMDisassembler.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMARMInfo.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMARMUtils.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMAVRCodeGen.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMAVRAsmParser.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMAVRDesc.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMAVRDisassembler.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMAVRInfo.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMBPFCodeGen.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMBPFAsmParser.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMBPFDesc.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMBPFDisassembler.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMBPFInfo.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMHexagonCodeGen.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMHexagonAsmParser.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMHexagonDesc.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMHexagonDisassembler.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMHexagonInfo.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMLanaiCodeGen.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMLanaiAsmParser.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMLanaiDesc.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMLanaiDisassembler.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMLanaiInfo.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMLoongArchCodeGen.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMLoongArchAsmParser.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMLoongArchDesc.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMLoongArchDisassembler.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMLoongArchInfo.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMMipsCodeGen.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMMipsAsmParser.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMMipsDesc.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMMipsDisassembler.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMMipsInfo.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMMSP430CodeGen.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMMSP430AsmParser.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMMSP430Desc.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMMSP430Disassembler.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMMSP430Info.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMNVPTXCodeGen.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMNVPTXDesc.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMNVPTXInfo.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMPowerPCCodeGen.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMPowerPCAsmParser.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMPowerPCDesc.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMPowerPCDisassembler.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMPowerPCInfo.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMRISCVCodeGen.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMRISCVAsmParser.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMRISCVDesc.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMRISCVDisassembler.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMRISCVInfo.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMSparcCodeGen.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMSparcAsmParser.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMSparcDesc.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMSparcDisassembler.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMSparcInfo.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMSystemZCodeGen.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMSystemZAsmParser.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMSystemZDesc.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMSystemZDisassembler.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMSystemZInfo.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMVECodeGen.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMVEAsmParser.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMVEDesc.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMVEDisassembler.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMVEInfo.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMWebAssemblyCodeGen.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMWebAssemblyAsmParser.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMWebAssemblyDesc.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMWebAssemblyDisassembler.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMWebAssemblyInfo.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMWebAssemblyUtils.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMX86CodeGen.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMX86AsmParser.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMX86Desc.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMX86Disassembler.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMX86Info.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMXCoreCodeGen.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMXCoreDesc.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMXCoreDisassembler.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMXCoreInfo.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMAggressiveInstCombine.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMAnalysis.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMBinaryFormat.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMBitReader.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMBitWriter.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMCodeGen.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMCore.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMExtensions.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMInstCombine.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMInstrumentation.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMipo.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMIRReader.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMLinker.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMMC.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMObject.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMPasses.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMRemarks.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMScalarOpts.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMSupport.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMTarget.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMTargetParser.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMTransformUtils.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMVectorize.a  -lpthread  -Wl,-z,defs  -Wl,--version-script=/home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.src/openmp/libomptarget/plugins-nextgen/common/../exports  /usr/lib/s390x-linux-gnu/libffi.a  -Wl,--version-script=/home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.src/openmp/libomptarget/plugins-nextgen/host/../exports  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMAArch64Desc.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMAArch64Info.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMAArch64Utils.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMCoroutines.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMHipStdPar.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMMIRParser.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMAMDGPUDesc.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMAMDGPUInfo.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMAMDGPUUtils.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMARMDesc.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMARMInfo.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMARMUtils.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMHexagonDesc.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMHexagonInfo.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMLanaiDesc.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMLanaiInfo.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMLoongArchDesc.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMLoongArchInfo.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMipo.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMLinker.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMVectorize.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMFrontendOpenMP.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMFrontendOffloading.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMRISCVDesc.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMRISCVInfo.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMSystemZDesc.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMSystemZInfo.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMWebAssemblyDesc.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMWebAssemblyInfo.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMInstrumentation.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMCFGuard.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMGlobalISel.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMIRPrinter.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMAsmPrinter.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMSelectionDAG.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMCodeGen.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMBitWriter.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMScalarOpts.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMAggressiveInstCombine.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMInstCombine.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMObjCARCOpts.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMTarget.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMTransformUtils.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMAnalysis.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMProfileData.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMSymbolize.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMDebugInfoDWARF.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMDebugInfoPDB.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMObject.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMIRReader.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMBitReader.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMAsmParser.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMMCParser.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMTextAPI.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMDebugInfoMSF.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMDebugInfoBTF.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMCore.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMRemarks.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMBitstreamReader.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMCodeGenTypes.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMMCDisassembler.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMMC.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMBinaryFormat.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMDebugInfoCodeView.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMTargetParser.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMSupport.a  /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/lib/libLLVMDemangle.a  -lrt  -ldl  -lpthread  -lm  /usr/lib/s390x-linux-gnu/libz.so && :
/usr/bin/ld: duplicate version tag `VERS1.0'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)

Not sure what this is about ...

Let me know if 20e0bac fixes it.

searlmc1 pushed a commit to ROCm/llvm-project that referenced this pull request Mar 23, 2024
Reverts: breaks openmp aomp build
needs more merge work
dcbddc2 [Libomptarget] Unify and simplify plugin CMake (llvm#86191)

Change-Id: I682ddd72d5cef4d4057825b825a92455a41b0980
@uweigand
Copy link
Member

Yes, this fixed it. Thanks!

@mgorny
Copy link
Member

mgorny commented Mar 23, 2024

This also broke linking against LLVM dylib (i.e. single libLLVM*.so). It insists on linking to static libraries that don't exist on Gentoo:

FAILED: libomptarget/libomptarget.rtl.amdgpu.so.19.0git51268a57 
: && /usr/lib/ccache/bin/x86_64-pc-linux-gnu-g++ -fPIC -march=znver2 --param=l1-cache-size=32 --param=l1-cache-line-size=64 -O2 -pipe -frecord-gcc-switches -Wall -Wcast-qual -Wimplicit-fallthrough -Wsign-compare -Wno-extra -Wno-pedantic -Wno-maybe-uninitialized -fno-semantic-interposition -fdata-sections  -Wl,-O1 -Wl,--as-needed -Wl,--defsym=__gentoo_check_ldflags__=0   -Wl,--gc-sections -shared -Wl,-soname,libomptarget.rtl.amdgpu.so.19.0git51268a57 -o libomptarget/libomptarget.rtl.amdgpu.so.19.0git51268a57 libomptarget/plugins-nextgen/common/CMakeFiles/PluginCommon.dir/src/PluginInterface.cpp.o libomptarget/plugins-nextgen/common/CMakeFiles/PluginCommon.dir/src/GlobalHandler.cpp.o libomptarget/plugins-nextgen/common/CMakeFiles/PluginCommon.dir/src/JIT.cpp.o libomptarget/plugins-nextgen/common/CMakeFiles/PluginCommon.dir/src/RPC.cpp.o libomptarget/plugins-nextgen/common/CMakeFiles/PluginCommon.dir/src/Utils/ELF.cpp.o libomptarget/plugins-nextgen/common/CMakeFiles/PluginCommon.dir/OMPT/OmptCallback.cpp.o libomptarget/plugins-nextgen/amdgpu/CMakeFiles/omptarget.rtl.amdgpu.dir/src/rtl.cpp.o  -Wl,-rpath,"\$ORIGIN:/tmp/portage/sys-libs/libomp-19.0.0_pre20240322/work/openmp_build-abi_x86_64.amd64/libomptarget/plugins-nextgen/amdgpu/..:/usr/lib/llvm/19/lib64:"  /usr/lib/llvm/19/lib64/libLLVM.so.19.0git51268a57  -lLLVMAArch64CodeGen […]
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lLLVMAArch64CodeGen: No such file or directory
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lLLVMAArch64AsmParser: No such file or directory
[…]

add_llvm_library's LINK_COMPONENTS takes care of doing this correctly. I don't really understand why add_target_library attempts to reinvent the wheel.

@mgorny
Copy link
Member

mgorny commented Mar 23, 2024

Filed #86397 with a proposed fix.

@jhuber6
Copy link
Contributor Author

jhuber6 commented Mar 24, 2024

@ronlieb @dhruvachak Sorry I forgot to make the OMPT header interface PUBLIC after changing something else. I updated https://gist.github.com/jhuber6/3cdcd37c4a2134e8a5043fe492ab4634 as well with some of the fixes that came after this patch.

@sylvestre
Copy link
Collaborator

I guess it caused also #86446

searlmc1 pushed a commit to ROCm/llvm-project that referenced this pull request Mar 26, 2024
Summary:
This patch reworks the CMake handling for building plugins. All
this does is pull a lot of shared and common logic into a single helper
function. This also simplifies the OMPT libraries from being built
separately instead of just added.

Change-Id: I62210d506c1e51f4412c69162a91da2db8939600
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants