[Libomptarget] Make the plugins ingore undefined exported symbols
authorJoseph Huber <jhuber6@vols.utk.edu>
Thu, 13 Oct 2022 13:08:46 +0000 (08:08 -0500)
committerJoseph Huber <jhuber6@vols.utk.edu>
Thu, 13 Oct 2022 13:13:03 +0000 (08:13 -0500)
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.

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

index 8ec24b5..de0f41f 100644 (file)
@@ -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
     )
index dfd3671..60d5139 100644 (file)
@@ -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
index 244060e..4077480 100644 (file)
@@ -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
index 9712642..ca3905a 100644 (file)
@@ -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")
index 6299fb3..fbad626 100644 (file)
@@ -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)
index ef2906f..4d6144a 100644 (file)
@@ -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