diff --git a/openmp/libomptarget/plugins/common/elf_common/CMakeLists.txt b/openmp/libomptarget/plugins/common/elf_common/CMakeLists.txt --- a/openmp/libomptarget/plugins/common/elf_common/CMakeLists.txt +++ b/openmp/libomptarget/plugins/common/elf_common/CMakeLists.txt @@ -12,6 +12,8 @@ add_library(elf_common OBJECT elf_common.cpp) +# Build elf_common with PIC to be able to link it with plugin shared libraries. +set_property(TARGET elf_common PROPERTY POSITION_INDEPENDENT_CODE ON) llvm_update_compile_flags(elf_common) set(LINK_LLVM_LIBS LLVMBinaryFormat LLVMObject LLVMSupport) target_link_libraries(elf_common INTERFACE ${LINK_LLVM_LIBS} ${LIBOMPTARGET_DEP_LIBELF_LIBRARIES})