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 exporting all symbols in the llvm namespace to all users of liblldb, which can then avoid including their own copy of the llvm libraries. The LLDB_EXPORT_ALL_SYMBOLS=OFF option then becomes purely a size optimization for liblldb, and does not affect the way in which dependant executables are linked, and we can even consider turning it off by default (modulo backtrace(3) problems on Linux). This effect of this on the SB API firewall is that it would turn it into a sort of a gentlemans agreement: "If you only use the SB API of liblldb, we guarantee ABI compatibility. If you don't care about that, you can use the llvm utilities that are bundled in this library, but then don't blame us if your code gets broken by an update." This is my preferred solution. However, I am not sure if this will actually work on Windows. AFAIK, there you have to specially annotate the API in order for it to be exported, and I think llvm API don't have those annotations. https://reviews.llvm.org/D26188 Files: source/API/CMakeLists.txt source/API/liblldb.exports 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 @@ -90,8 +88,6 @@ 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: source/API/liblldb.exports =================================================================== --- source/API/liblldb.exports +++ source/API/liblldb.exports @@ -2,3 +2,5 @@ _ZNK4lldb* init_lld* PyInit__lldb* +_ZN4llvm* +_ZNK4llvm* Index: source/API/CMakeLists.txt =================================================================== --- source/API/CMakeLists.txt +++ source/API/CMakeLists.txt @@ -106,10 +106,6 @@ MESSAGE("-- Symbols (liblldb): exporting all symbols from the lldb namespace") add_llvm_symbol_exports(liblldb ${CMAKE_CURRENT_SOURCE_DIR}/liblldb.exports) else() - # Don't use an explicit export. Instead, tell the linker to - # export all symbols. - MESSAGE("-- Symbols (liblldb): exporting all symbols from the lldb and lldb_private namespaces") - add_llvm_symbol_exports(liblldb ${CMAKE_CURRENT_SOURCE_DIR}/liblldb-private.exports) endif() endif()
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 @@ -90,8 +88,6 @@ 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: source/API/liblldb.exports =================================================================== --- source/API/liblldb.exports +++ source/API/liblldb.exports @@ -2,3 +2,5 @@ _ZNK4lldb* init_lld* PyInit__lldb* +_ZN4llvm* +_ZNK4llvm* Index: source/API/CMakeLists.txt =================================================================== --- source/API/CMakeLists.txt +++ source/API/CMakeLists.txt @@ -106,10 +106,6 @@ MESSAGE("-- Symbols (liblldb): exporting all symbols from the lldb namespace") add_llvm_symbol_exports(liblldb ${CMAKE_CURRENT_SOURCE_DIR}/liblldb.exports) else() - # Don't use an explicit export. Instead, tell the linker to - # export all symbols. - MESSAGE("-- Symbols (liblldb): exporting all symbols from the lldb and lldb_private namespaces") - add_llvm_symbol_exports(liblldb ${CMAKE_CURRENT_SOURCE_DIR}/liblldb-private.exports) endif() endif()
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits