[Lldb-commits] [lldb] 87c6ff6 - [LLDB] Allow specifying a custom exports file (#68013)
via lldb-commits
lldb-commits at lists.llvm.org
Thu Oct 5 17:17:52 PDT 2023
Author: Walter Erquinigo
Date: 2023-10-05T20:17:48-04:00
New Revision: 87c6ff6da82a1288ce5c80370d5d8cdd4c20220d
URL: https://github.com/llvm/llvm-project/commit/87c6ff6da82a1288ce5c80370d5d8cdd4c20220d
DIFF: https://github.com/llvm/llvm-project/commit/87c6ff6da82a1288ce5c80370d5d8cdd4c20220d.diff
LOG: [LLDB] Allow specifying a custom exports file (#68013)
LLDB has the cmake flag `LLDB_EXPORT_ALL_SYMBOLS` that exports the lldb,
lldb_private namespaces, as well as other symbols like python and lua
(see `lldb/source/API/liblldb-private.exports`). However, not all
symbols in lldb fall into these categories and in order to get access to
some symbols that live in plugin folders (like dwarf parsing symbols),
it's useful to be able to specify a custom exports file giving more
control to the developer using lldb as a library.
This adds the new cmake flag `LLDB_EXPORT_ALL_SYMBOLS_EXPORTS_FILE` that
is used when `LLDB_EXPORT_ALL_SYMBOLS` is enabled to specify that custom
exports file.
This is a follow up of https://github.com/llvm/llvm-project/pull/67851
Added:
Modified:
lldb/cmake/modules/LLDBConfig.cmake
lldb/source/API/CMakeLists.txt
Removed:
################################################################################
diff --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake
index 380016ce48015fa..ce5e666a6f5e1ac 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 7cfa3aaafdae188..a574a461d4920ae 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)
More information about the lldb-commits
mailing list