labath created this revision. labath added reviewers: beanz, zturner, tfiala, clayborg, abidh. labath added a subscriber: lldb-commits. Herald added subscribers: mgorny, ki.stfu.
This "solves" the ODR violations by making the linker firewall a feature. llvm libraries used by liblldb are considered to be private implementation details and we do not provide them to the users. If some of them want to use llvm for their private purposes, they should include their own copy. LLDB_EXPORT_ALL_SYMBOLS=OFF is the official way of building liblldb, and the =ON version is a hack to make backtrace(3) output more useful on linux. It still should not affect the way dependant executables are linked, as none of them should be using lldb_private symbols in the first place. We need to be careful to not use llvm classes anywhere along the API boundary, or bad things will happen. With our current SB API policy this should not be a problem, but we may need to revisit this decision if that changes. This is my less preferred solution, as it increases code size, and has potential to introduce latent bugs. https://reviews.llvm.org/D26190 Files: tools/lldb-mi/CMakeLists.txt Index: tools/lldb-mi/CMakeLists.txt =================================================================== --- tools/lldb-mi/CMakeLists.txt +++ tools/lldb-mi/CMakeLists.txt @@ -1,5 +1,3 @@ -include(${LLDB_PROJECT_ROOT}/cmake/LLDBDependencies.cmake) - set(LLDB_MI_SOURCES MICmdArgContext.cpp MICmdArgSet.cpp @@ -83,15 +81,18 @@ ) endif () +# liblldb already contains a copy of the llvm support library. However, it is not +# a part of the interface provided by liblldb, so we need to include our own +# copy. We need to be careful to never pass llvm objects across SO boundary. +# This should be fine, as lldb SB API does not (by design) depend on llvm. +set(LLVM_LINK_COMPONENTS Support) add_lldb_executable(lldb-mi ${LLDB_MI_SOURCES}) target_link_libraries(lldb-mi liblldb) if ( NOT CMAKE_SYSTEM_NAME MATCHES "Windows" ) target_link_libraries(lldb-mi pthread) endif () -llvm_config(lldb-mi ${LLVM_LINK_COMPONENTS}) - set_target_properties(lldb-mi PROPERTIES VERSION ${LLDB_VERSION}) install(TARGETS lldb-mi
Index: tools/lldb-mi/CMakeLists.txt =================================================================== --- tools/lldb-mi/CMakeLists.txt +++ tools/lldb-mi/CMakeLists.txt @@ -1,5 +1,3 @@ -include(${LLDB_PROJECT_ROOT}/cmake/LLDBDependencies.cmake) - set(LLDB_MI_SOURCES MICmdArgContext.cpp MICmdArgSet.cpp @@ -83,15 +81,18 @@ ) endif () +# liblldb already contains a copy of the llvm support library. However, it is not +# a part of the interface provided by liblldb, so we need to include our own +# copy. We need to be careful to never pass llvm objects across SO boundary. +# This should be fine, as lldb SB API does not (by design) depend on llvm. +set(LLVM_LINK_COMPONENTS Support) add_lldb_executable(lldb-mi ${LLDB_MI_SOURCES}) target_link_libraries(lldb-mi liblldb) if ( NOT CMAKE_SYSTEM_NAME MATCHES "Windows" ) target_link_libraries(lldb-mi pthread) endif () -llvm_config(lldb-mi ${LLVM_LINK_COMPONENTS}) - set_target_properties(lldb-mi PROPERTIES VERSION ${LLDB_VERSION}) install(TARGETS lldb-mi
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits