[Openmp-commits] [PATCH] D92143: [libomptarget][cuda] Detect missing symbols in plugin at build time

Jon Chesterfield via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Wed Nov 25 16:39:04 PST 2020


JonChesterfield created this revision.
JonChesterfield added reviewers: jdoerfert, grokos, ABataev, tianshilei1992.
Herald added subscribers: openmp-commits, yaxunl, mgorny.
Herald added a project: OpenMP.
JonChesterfield requested review of this revision.
Herald added a subscriber: sstefan1.

[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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D92143

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


Index: openmp/libomptarget/plugins/cuda/CMakeLists.txt
===================================================================
--- openmp/libomptarget/plugins/cuda/CMakeLists.txt
+++ openmp/libomptarget/plugins/cuda/CMakeLists.txt
@@ -39,7 +39,8 @@
 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)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92143.307727.patch
Type: text/x-patch
Size: 693 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20201126/56d97ded/attachment.bin>


More information about the Openmp-commits mailing list