[Openmp-commits] [PATCH] D130298: [Libomptarget] Only export needed definitions in the BC library

Joseph Huber via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Fri Jul 22 05:24:54 PDT 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG908054df4f15: [Libomptarget] Only export needed definitions in the BC library (authored by jhuber6).

Changed prior to commit:
  https://reviews.llvm.org/D130298?vs=446679&id=446800#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130298

Files:
  openmp/libomptarget/DeviceRTL/CMakeLists.txt
  openmp/libomptarget/DeviceRTL/src/exports


Index: openmp/libomptarget/DeviceRTL/src/exports
===================================================================
--- /dev/null
+++ openmp/libomptarget/DeviceRTL/src/exports
@@ -0,0 +1,3 @@
+omp_*
+*llvm_*
+__kmpc_*
Index: openmp/libomptarget/DeviceRTL/CMakeLists.txt
===================================================================
--- openmp/libomptarget/DeviceRTL/CMakeLists.txt
+++ openmp/libomptarget/DeviceRTL/CMakeLists.txt
@@ -108,6 +108,7 @@
 
 set(clang_opt_flags -O3 -mllvm -openmp-opt-disable -DSHARED_SCRATCHPAD_SIZE=512)
 set(link_opt_flags  -O3        -openmp-opt-disable)
+set(link_export_flag -passes=internalize -internalize-public-api-file=${source_directory}/exports)
 
 # Prepend -I to each list element
 set (LIBOMPTARGET_LLVM_INCLUDE_DIRS_DEVICERTL "${LIBOMPTARGET_LLVM_INCLUDE_DIRS}")
@@ -173,10 +174,17 @@
       COMMENT "Linking LLVM bitcode ${bclib_name}"
   )
 
+  add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/internalized_${bclib_name}
+      COMMAND ${OPT_TOOL} ${link_export_flag} ${CMAKE_CURRENT_BINARY_DIR}/linked_${bclib_name}
+                      -o ${CMAKE_CURRENT_BINARY_DIR}/internalized_${bclib_name}
+      DEPENDS ${source_directory}/exports ${CMAKE_CURRENT_BINARY_DIR}/linked_${bclib_name}
+      COMMENT "Internalizing LLVM bitcode ${bclib_name}"
+  )
+
   add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${bclib_name}
-      COMMAND ${OPT_TOOL} ${link_opt_flags} ${CMAKE_CURRENT_BINARY_DIR}/linked_${bclib_name}
+      COMMAND ${OPT_TOOL} ${link_opt_flags} ${CMAKE_CURRENT_BINARY_DIR}/internalized_${bclib_name}
                       -o ${CMAKE_CURRENT_BINARY_DIR}/${bclib_name}
-      DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/linked_${bclib_name}
+      DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/internalized_${bclib_name}
       COMMENT "Optimizing LLVM bitcode ${bclib_name}"
   )
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D130298.446800.patch
Type: text/x-patch
Size: 1843 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20220722/8115fa29/attachment.bin>


More information about the Openmp-commits mailing list