[Openmp-commits] [openmp] 71e3082 - [OpenMP] Enable position independent code for libomptarget

Joseph Huber via Openmp-commits openmp-commits at lists.llvm.org
Mon Nov 27 12:51:58 PST 2023


Author: Joseph Huber
Date: 2023-11-27T14:51:48-06:00
New Revision: 71e3082d8572fd335dcc994fd63a75d69b9d2b2e

URL: https://github.com/llvm/llvm-project/commit/71e3082d8572fd335dcc994fd63a75d69b9d2b2e
DIFF: https://github.com/llvm/llvm-project/commit/71e3082d8572fd335dcc994fd63a75d69b9d2b2e.diff

LOG: [OpenMP] Enable position independent code for libomptarget

Summary:
This option used to be passed manually by the `-fPIC` option that was
always enabled by the LLVM flags. Since we now do this manually we want
to specify that these are supposed for use fPIC code.

Added: 
    

Modified: 
    openmp/libomptarget/plugins-nextgen/CMakeLists.txt
    openmp/libomptarget/src/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/openmp/libomptarget/plugins-nextgen/CMakeLists.txt b/openmp/libomptarget/plugins-nextgen/CMakeLists.txt
index d81e5d37d7c08df..5f97a77327c0fef 100644
--- a/openmp/libomptarget/plugins-nextgen/CMakeLists.txt
+++ b/openmp/libomptarget/plugins-nextgen/CMakeLists.txt
@@ -70,6 +70,7 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "${tmachine}$")
       LIBRARY DESTINATION "${OPENMP_INSTALL_LIBDIR}")
     set_target_properties("omptarget.rtl.${tmachine_libname}" PROPERTIES
       INSTALL_RPATH "$ORIGIN" BUILD_RPATH "$ORIGIN:${CMAKE_CURRENT_BINARY_DIR}/.."
+      POSITION_INDEPENDENT_CODE ON
       CXX_VISIBILITY_PRESET protected)
 
     target_include_directories( "omptarget.rtl.${tmachine_libname}" PRIVATE

diff  --git a/openmp/libomptarget/src/CMakeLists.txt b/openmp/libomptarget/src/CMakeLists.txt
index bf6c23bd5eb5fe2..34a8273cfaf645c 100644
--- a/openmp/libomptarget/src/CMakeLists.txt
+++ b/openmp/libomptarget/src/CMakeLists.txt
@@ -46,5 +46,8 @@ 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}/..")
+set_target_properties(omptarget PROPERTIES
+                      POSITION_INDEPENDENT_CODE ON
+                      INSTALL_RPATH "$ORIGIN"
+                      BUILD_RPATH "$ORIGIN:${CMAKE_CURRENT_BINARY_DIR}/..")
 install(TARGETS omptarget LIBRARY COMPONENT omptarget DESTINATION "${OPENMP_INSTALL_LIBDIR}")


        


More information about the Openmp-commits mailing list