[Openmp-commits] [openmp] 3f62314 - [Libomptarget] Make the plugins ingore undefined exported symbols

Joseph Huber via Openmp-commits openmp-commits at lists.llvm.org
Thu Oct 13 06:13:19 PDT 2022


Author: Joseph Huber
Date: 2022-10-13T08:13:03-05:00
New Revision: 3f62314c235bd2475c8e2b5b874b2932a444e823

URL: https://github.com/llvm/llvm-project/commit/3f62314c235bd2475c8e2b5b874b2932a444e823
DIFF: https://github.com/llvm/llvm-project/commit/3f62314c235bd2475c8e2b5b874b2932a444e823.diff

LOG: [Libomptarget] Make the plugins ingore undefined exported symbols

Summary:
Recent changes made the default behaviour to error when given an
undefined symbol in a version script. A previous patch fixed this for
`libomptarget` by removing the single undefined symbol. However, the
plguins are expected to only define a subset of the availible functions
so we shouldn't treat it as an error. This patch updates the build flags
to work appropriately.

Added: 
    

Modified: 
    openmp/libomptarget/plugins/CMakeLists.txt
    openmp/libomptarget/plugins/amdgpu/CMakeLists.txt
    openmp/libomptarget/plugins/cuda/CMakeLists.txt
    openmp/libomptarget/plugins/remote/server/CMakeLists.txt
    openmp/libomptarget/plugins/remote/src/CMakeLists.txt
    openmp/libomptarget/plugins/ve/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/openmp/libomptarget/plugins/CMakeLists.txt b/openmp/libomptarget/plugins/CMakeLists.txt
index 8ec24b5956736..de0f41f8d4732 100644
--- a/openmp/libomptarget/plugins/CMakeLists.txt
+++ b/openmp/libomptarget/plugins/CMakeLists.txt
@@ -38,12 +38,13 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "${tmachine}$")
       ${LIBOMPTARGET_INCLUDE_DIR}
       ${LIBOMPTARGET_DEP_LIBFFI_INCLUDE_DIR}
 
-        LINK_LIBS 
-        PRIVATE
-        elf_common
-        ${LIBOMPTARGET_DEP_LIBFFI_LIBRARIES}
-        ${OPENMP_PTHREAD_LIB}
-        "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/../exports"
+      LINK_LIBS 
+      PRIVATE
+      elf_common
+      ${LIBOMPTARGET_DEP_LIBFFI_LIBRARIES}
+      ${OPENMP_PTHREAD_LIB}
+      "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/../exports"
+      "-Wl,--undefined-version"
 
       NO_INSTALL_RPATH
     )

diff  --git a/openmp/libomptarget/plugins/amdgpu/CMakeLists.txt b/openmp/libomptarget/plugins/amdgpu/CMakeLists.txt
index dfd3671b9a8f5..60d5139692b28 100644
--- a/openmp/libomptarget/plugins/amdgpu/CMakeLists.txt
+++ b/openmp/libomptarget/plugins/amdgpu/CMakeLists.txt
@@ -85,6 +85,7 @@ add_llvm_library(omptarget.rtl.amdgpu SHARED
   ${LIBOMPTARGET_DEP_LIBRARIES}
   ${OPENMP_PTHREAD_LIB}
   "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/../exports"
+  "-Wl,--undefined-version"
   ${LDFLAGS_UNDEFINED}
 
   NO_INSTALL_RPATH

diff  --git a/openmp/libomptarget/plugins/cuda/CMakeLists.txt b/openmp/libomptarget/plugins/cuda/CMakeLists.txt
index 244060efca606..40774808edb58 100644
--- a/openmp/libomptarget/plugins/cuda/CMakeLists.txt
+++ b/openmp/libomptarget/plugins/cuda/CMakeLists.txt
@@ -55,6 +55,7 @@ if (LIBOMPTARGET_CAN_LINK_LIBCUDA AND NOT LIBOMPTARGET_FORCE_DLOPEN_LIBCUDA)
     ${LIBOMPTARGET_DEP_CUDA_DRIVER_LIBRARIES}
     ${OPENMP_PTHREAD_LIB}
     "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/../exports"
+    "-Wl,--undefined-version"
     "-Wl,-z,defs"
 
     NO_INSTALL_RPATH
@@ -77,6 +78,7 @@ else()
     MemoryManager
     ${OPENMP_PTHREAD_LIB}
     "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/../exports"
+    "-Wl,--undefined-version"
     "-Wl,-z,defs"
 
     NO_INSTALL_RPATH

diff  --git a/openmp/libomptarget/plugins/remote/server/CMakeLists.txt b/openmp/libomptarget/plugins/remote/server/CMakeLists.txt
index 9712642509314..ca3905a8163a2 100644
--- a/openmp/libomptarget/plugins/remote/server/CMakeLists.txt
+++ b/openmp/libomptarget/plugins/remote/server/CMakeLists.txt
@@ -29,4 +29,5 @@ target_link_libraries(openmp-offloading-server
         absl::synchronization
         ${OPENMP_PTHREAD_LIB}
         omp
-        "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/../../exports")
+        "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/../../exports"
+        "-Wl,--undefined-version")

diff  --git a/openmp/libomptarget/plugins/remote/src/CMakeLists.txt b/openmp/libomptarget/plugins/remote/src/CMakeLists.txt
index 6299fb38ee8b4..fbad626985ed1 100644
--- a/openmp/libomptarget/plugins/remote/src/CMakeLists.txt
+++ b/openmp/libomptarget/plugins/remote/src/CMakeLists.txt
@@ -37,7 +37,8 @@ target_link_libraries(omptarget.rtl.rpc
   absl::synchronization
   ${OPENMP_PTHREAD_LIB}
   omp
-  "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/../../exports")
+  "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/../../exports"
+  "-Wl,--undefined-version")
 
 # Report to the parent scope that we are building a plugin for RPC.
 set(LIBOMPTARGET_SYSTEM_TARGETS "${LIBOMPTARGET_SYSTEM_TARGETS} rpc" PARENT_SCOPE)

diff  --git a/openmp/libomptarget/plugins/ve/CMakeLists.txt b/openmp/libomptarget/plugins/ve/CMakeLists.txt
index ef2906fd6e395..4d6144aea26dd 100644
--- a/openmp/libomptarget/plugins/ve/CMakeLists.txt
+++ b/openmp/libomptarget/plugins/ve/CMakeLists.txt
@@ -37,6 +37,7 @@ if(${LIBOMPTARGET_DEP_VEO_FOUND})
     ${LIBOMPTARGET_DEP_LIBFFI_LIBRARIES}
     ${additional_libs}
     "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/../exports -Wl,-z,defs"
+    "-Wl,--undefined-version"
 
     NO_INSTALL_RPATH
   )
@@ -55,7 +56,8 @@ if(${LIBOMPTARGET_DEP_VEO_FOUND})
     elf_common
     ${LIBOMPTARGET_DEP_LIBFFI_LIBRARIES}
     ${additional_libs}
-    "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/../exports -Wl,-z,defs")
+    "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/../exports -Wl,-z,defs"
+    "-Wl,--undefined-version")
 
   # Report to the parent scope that we are building a plugin.
   set(LIBOMPTARGET_SYSTEM_TARGETS


        


More information about the Openmp-commits mailing list