diff --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake index 380016ce48015..ce5e666a6f5e1 100644 --- a/lldb/cmake/modules/LLDBConfig.cmake +++ b/lldb/cmake/modules/LLDBConfig.cmake @@ -123,7 +123,10 @@ if(APPLE AND CMAKE_GENERATOR STREQUAL Xcode) endif() set(LLDB_EXPORT_ALL_SYMBOLS 0 CACHE BOOL - "Causes lldb to export all symbols when building liblldb.") + "Causes lldb to export some private symbols when building liblldb. See lldb/source/API/liblldb-private.exports for the full list of symbols that get exported.") + +set(LLDB_EXPORT_ALL_SYMBOLS_EXPORTS_FILE "" CACHE PATH + "When `LLDB_EXPORT_ALL_SYMBOLS` is enabled, this specifies the exports file to use when building liblldb.") if ((NOT MSVC) OR MSVC12) add_definitions( -DHAVE_ROUND ) diff --git a/lldb/source/API/CMakeLists.txt b/lldb/source/API/CMakeLists.txt index 7cfa3aaafdae1..a574a461d4920 100644 --- a/lldb/source/API/CMakeLists.txt +++ b/lldb/source/API/CMakeLists.txt @@ -177,11 +177,18 @@ if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows") # from working on some systems but limits the liblldb size. 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. + elseif (NOT LLDB_EXPORT_ALL_SYMBOLS_EXPORTS_FILE) + # 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") + MESSAGE(WARNING "Private LLDB symbols frequently change and no API stability is guaranteed. " + "Only the SB API is guaranteed to be stable.") add_llvm_symbol_exports(liblldb ${CMAKE_CURRENT_SOURCE_DIR}/liblldb-private.exports) + else () + MESSAGE("-- Symbols (liblldb): exporting all symbols specified in the exports " + " file '${LLDB_EXPORT_ALL_SYMBOLS_EXPORTS_FILE}'") + MESSAGE(WARNING "Private LLDB symbols frequently change and no API stability is guaranteed. " + "Only the SB API is guaranteed to be stable.") + add_llvm_symbol_exports(liblldb "${LLDB_EXPORT_ALL_SYMBOLS_EXPORTS_FILE}") endif() set_target_properties(liblldb_exports PROPERTIES FOLDER "lldb misc") elseif (LLDB_EXPORT_ALL_SYMBOLS)