[llvm-branch-commits] [openmp] 89a0f48 - [libomptarget][cuda] Detect missing symbols in plugin at build time

Jon Chesterfield via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Nov 27 07:44:00 PST 2020


Author: Jon Chesterfield
Date: 2020-11-27T15:39:41Z
New Revision: 89a0f48c58f82262c7ce2b9ca51ffad0ffc559ea

URL: https://github.com/llvm/llvm-project/commit/89a0f48c58f82262c7ce2b9ca51ffad0ffc559ea
DIFF: https://github.com/llvm/llvm-project/commit/89a0f48c58f82262c7ce2b9ca51ffad0ffc559ea.diff

LOG: [libomptarget][cuda] Detect missing symbols in plugin at build time

[libomptarget][cuda] Detect missing symbols in plugin at build time

Passes -z,defs to the linker. Error on unresolved symbol references.

Otherwise, those unresolved symbols present as target code running on the host
as the plugin fails to load. This is significantly harder to debug than a link
time error. Flag matches that passed by amdgcn and ve plugins.

Reviewed By: tianshilei1992

Differential Revision: https://reviews.llvm.org/D92143

Added: 
    

Modified: 
    openmp/libomptarget/plugins/cuda/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/openmp/libomptarget/plugins/cuda/CMakeLists.txt b/openmp/libomptarget/plugins/cuda/CMakeLists.txt
index 54bcdf26e9e6..e0299b1f3270 100644
--- a/openmp/libomptarget/plugins/cuda/CMakeLists.txt
+++ b/openmp/libomptarget/plugins/cuda/CMakeLists.txt
@@ -39,7 +39,8 @@ install(TARGETS omptarget.rtl.cuda LIBRARY DESTINATION "${OPENMP_INSTALL_LIBDIR}
 target_link_libraries(omptarget.rtl.cuda
   ${LIBOMPTARGET_DEP_CUDA_DRIVER_LIBRARIES}
   ${LIBOMPTARGET_DEP_LIBELF_LIBRARIES}
-  "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/../exports")
+  "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/../exports"
+  "-Wl,-z,defs")
 
 # Report to the parent scope that we are building a plugin for CUDA.
 set(LIBOMPTARGET_SYSTEM_TARGETS "${LIBOMPTARGET_SYSTEM_TARGETS} nvptx64-nvidia-cuda" PARENT_SCOPE)


        


More information about the llvm-branch-commits mailing list