[PATCH] D95727: llvm-shlib: Create object libraries for each component and link against them
Tom Stellard via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 6 22:48:47 PDT 2021
tstellar updated this revision to Diff 335725.
tstellar added a comment.
Herald added a subscriber: hiraditya.
Updated patch with fixes for z3 and libffi build failures
https://bugs.llvm.org/show_bug.cgi?id=49818
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D95727/new/
https://reviews.llvm.org/D95727
Files:
llvm/cmake/modules/AddLLVM.cmake
llvm/lib/ExecutionEngine/Interpreter/CMakeLists.txt
llvm/tools/llvm-shlib/CMakeLists.txt
Index: llvm/tools/llvm-shlib/CMakeLists.txt
===================================================================
--- llvm/tools/llvm-shlib/CMakeLists.txt
+++ llvm/tools/llvm-shlib/CMakeLists.txt
@@ -33,6 +33,10 @@
add_llvm_library(LLVM SHARED DISABLE_LLVM_LINK_LLVM_DYLIB SONAME ${INSTALL_WITH_TOOLCHAIN} ${SOURCES})
list(REMOVE_DUPLICATES LIB_NAMES)
+
+ # Link against the object libraries instead of static libraries.
+ list(TRANSFORM LIB_NAMES PREPEND "obj.")
+
if(("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") OR (MINGW) OR (HAIKU)
OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD")
OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "GNU")
Index: llvm/lib/ExecutionEngine/Interpreter/CMakeLists.txt
===================================================================
--- llvm/lib/ExecutionEngine/Interpreter/CMakeLists.txt
+++ llvm/lib/ExecutionEngine/Interpreter/CMakeLists.txt
@@ -6,6 +6,10 @@
include_directories( ${FFI_INCLUDE_PATH} )
endif()
+if( LLVM_ENABLE_FFI )
+ set(link_libs ${FFI_LIBRARY_PATH})
+endif()
+
add_llvm_component_library(LLVMInterpreter
Execution.cpp
ExternalFunctions.cpp
@@ -14,13 +18,10 @@
DEPENDS
intrinsics_gen
+ LINK_LIBS PRIVATE ${link_libs}
LINK_COMPONENTS
CodeGen
Core
ExecutionEngine
Support
)
-
-if( LLVM_ENABLE_FFI )
- target_link_libraries( LLVMInterpreter PRIVATE ${FFI_LIBRARY_PATH} )
-endif()
Index: llvm/cmake/modules/AddLLVM.cmake
===================================================================
--- llvm/cmake/modules/AddLLVM.cmake
+++ llvm/cmake/modules/AddLLVM.cmake
@@ -488,7 +488,13 @@
add_dependencies(${obj_name} ${link_lib})
endif()
endforeach()
+ target_link_libraries(${obj_name} ${ARG_LINK_LIBS})
endif()
+
+ # Add target include directories from the main target. This makes it
+ # possible to call target_include_directories() with ${name} after
+ # calling llvm_add_library() and still have it apply to the object library.
+ set_target_properties(obj.${name} PROPERTIES INCLUDE_DIRECTORIES "$<TARGET_PROPERTY:${name},INCLUDE_DIRECTORIES>")
endif()
if(ARG_SHARED AND ARG_STATIC)
@@ -746,7 +752,7 @@
"COMPONENT_NAME;ADD_TO_COMPONENT"
""
${ARGN})
- add_llvm_library(${name} COMPONENT_LIB ${ARG_UNPARSED_ARGUMENTS})
+ add_llvm_library(${name} COMPONENT_LIB OBJECT ${ARG_UNPARSED_ARGUMENTS})
string(REGEX REPLACE "^LLVM" "" component_name ${name})
set_property(TARGET ${name} PROPERTY LLVM_COMPONENT_NAME ${component_name})
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95727.335725.patch
Type: text/x-patch
Size: 2508 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210407/40c597aa/attachment.bin>
More information about the llvm-commits
mailing list