Skip to content

Commit

Permalink
[OpenMP] Enable position independent code for libomptarget
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jhuber6 committed Nov 27, 2023
1 parent 4b7beab commit 71e3082
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions openmp/libomptarget/plugins-nextgen/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion openmp/libomptarget/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}")

0 comments on commit 71e3082

Please sign in to comment.