[Openmp-commits] [PATCH] D149555: [OpenMP] Only enable version script if supported

Shilei Tian via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Sun Apr 30 20:35:09 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rGfb53a7044a04: [OpenMP] Only enable version script if supported (authored by tianshilei1992).

Changed prior to commit:
  https://reviews.llvm.org/D149555?vs=518351&id=518388#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D149555/new/

https://reviews.llvm.org/D149555

Files:
  openmp/libomptarget/plugins-nextgen/CMakeLists.txt
  openmp/libomptarget/plugins-nextgen/amdgpu/CMakeLists.txt
  openmp/libomptarget/plugins-nextgen/cuda/CMakeLists.txt
  openmp/libomptarget/src/CMakeLists.txt


Index: openmp/libomptarget/src/CMakeLists.txt
===================================================================
--- openmp/libomptarget/src/CMakeLists.txt
+++ openmp/libomptarget/src/CMakeLists.txt
@@ -31,13 +31,15 @@
   Support
   Object
 
-  LINK_LIBS
-  PRIVATE
-  "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/exports"
   NO_INSTALL_RPATH
 )
 target_include_directories(omptarget PRIVATE ${LIBOMPTARGET_INCLUDE_DIR})
 
+if (LIBOMP_HAVE_VERSION_SCRIPT_FLAG)
+  target_link_libraries(omptarget PRIVATE
+    "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/exports")
+endif()
+
 # libomptarget.so needs to be aware of where the plugins live as they
 # are now separated in the build directory.
 set_target_properties(omptarget PROPERTIES INSTALL_RPATH "$ORIGIN" BUILD_RPATH "$ORIGIN:${CMAKE_CURRENT_BINARY_DIR}/..")
Index: openmp/libomptarget/plugins-nextgen/cuda/CMakeLists.txt
===================================================================
--- openmp/libomptarget/plugins-nextgen/cuda/CMakeLists.txt
+++ openmp/libomptarget/plugins-nextgen/cuda/CMakeLists.txt
@@ -38,11 +38,16 @@
   MemoryManager
   PluginInterface
   ${OPENMP_PTHREAD_LIB}
-  "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/../exports,-z,defs"
 
   NO_INSTALL_RPATH
 )
 
+if (LIBOMP_HAVE_VERSION_SCRIPT_FLAG)
+  target_link_libraries(omptarget.rtl.cuda.nextgen PRIVATE
+  "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/../exports,-z,defs")
+endif()
+
+
 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.nextgen PRIVATE CUDA::cuda_driver)
Index: openmp/libomptarget/plugins-nextgen/amdgpu/CMakeLists.txt
===================================================================
--- openmp/libomptarget/plugins-nextgen/amdgpu/CMakeLists.txt
+++ openmp/libomptarget/plugins-nextgen/amdgpu/CMakeLists.txt
@@ -85,12 +85,16 @@
   PluginInterface
   ${LIBOMPTARGET_DEP_LIBRARIES}
   ${OPENMP_PTHREAD_LIB}
-  "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/../exports"
   ${LDFLAGS_UNDEFINED}
 
   NO_INSTALL_RPATH
 )
 
+if (LIBOMP_HAVE_VERSION_SCRIPT_FLAG)
+  target_link_libraries(omptarget.rtl.amdgpu.nextgen PRIVATE
+    "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/../exports")
+endif()
+
 target_include_directories(
   omptarget.rtl.amdgpu.nextgen
   PRIVATE
Index: openmp/libomptarget/plugins-nextgen/CMakeLists.txt
===================================================================
--- openmp/libomptarget/plugins-nextgen/CMakeLists.txt
+++ openmp/libomptarget/plugins-nextgen/CMakeLists.txt
@@ -52,11 +52,15 @@
         PluginInterface
         ${LIBOMPTARGET_DEP_LIBFFI_LIBRARIES}
         ${OPENMP_PTHREAD_LIB}
-        "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/../exports"
 
       NO_INSTALL_RPATH
     )
 
+    if (LIBOMP_HAVE_VERSION_SCRIPT_FLAG)
+      target_link_libraries("omptarget.rtl.${tmachine_libname}.nextgen" PRIVATE
+        "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/../exports")
+    endif()
+
     # Install plugin under the lib destination folder.
     install(TARGETS "omptarget.rtl.${tmachine_libname}.nextgen"
       LIBRARY DESTINATION "${OPENMP_INSTALL_LIBDIR}")


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149555.518388.patch
Type: text/x-patch
Size: 3233 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20230501/36e41894/attachment.bin>


More information about the Openmp-commits mailing list