Skip to content

Commit

Permalink
[openmp] [elf_common] Fix linking against LLVM dylib
Browse files Browse the repository at this point in the history
The hand-rolled linking logic in elf_common does not account for
the possibility of using LLVM dylib rather than a dozen static
libraries.  Since it does not seem to be easily convertible
to add_llvm_library, just hand-roll support for LLVM_LINK_LLVM_DYLIB.
This is necessary to support stand-alone builds against installed LLVM.

Differential Revision: https://reviews.llvm.org/D111038

(cherry picked from commit 0873b9b)
  • Loading branch information
mgorny authored and tstellar committed Oct 27, 2021
1 parent eb84552 commit 26e2c97
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions openmp/libomptarget/plugins/common/elf_common/CMakeLists.txt
Expand Up @@ -16,6 +16,9 @@ add_library(elf_common OBJECT elf_common.cpp)
set_property(TARGET elf_common PROPERTY POSITION_INDEPENDENT_CODE ON)
llvm_update_compile_flags(elf_common)
set(LINK_LLVM_LIBS LLVMBinaryFormat LLVMObject LLVMSupport)
if (LLVM_LINK_LLVM_DYLIB)
set(LINK_LLVM_LIBS LLVM)
endif()
target_link_libraries(elf_common INTERFACE ${LINK_LLVM_LIBS})
include_directories(${LIBOMPTARGET_LLVM_INCLUDE_DIRS})
add_dependencies(elf_common ${LINK_LLVM_LIBS})
Expand Down

0 comments on commit 26e2c97

Please sign in to comment.