Skip to content

Commit a472a16

Browse files
author
walter erquinigo
committed
[LLDB] Allow specifying a custom exports file
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 `third-party/llvm-project/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 #67851
1 parent 8fd02d5 commit a472a16

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

lldb/cmake/modules/LLDBConfig.cmake

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,10 @@ if(APPLE AND CMAKE_GENERATOR STREQUAL Xcode)
123123
endif()
124124

125125
set(LLDB_EXPORT_ALL_SYMBOLS 0 CACHE BOOL
126-
"Causes lldb to export all symbols when building liblldb.")
126+
"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.")
127+
128+
set(LLDB_EXPORT_ALL_SYMBOLS_EXPORTS_FILE "" CACHE PATH
129+
"When `LLDB_EXPORT_ALL_SYMBOLS` is enabled, this specifies the exports file to use when building liblldb.")
127130

128131
if ((NOT MSVC) OR MSVC12)
129132
add_definitions( -DHAVE_ROUND )

lldb/source/API/CMakeLists.txt

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,11 +177,18 @@ if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
177177
# from working on some systems but limits the liblldb size.
178178
MESSAGE("-- Symbols (liblldb): exporting all symbols from the lldb namespace")
179179
add_llvm_symbol_exports(liblldb ${CMAKE_CURRENT_SOURCE_DIR}/liblldb.exports)
180-
else()
181-
# Don't use an explicit export. Instead, tell the linker to
182-
# export all symbols.
180+
elseif (NOT LLDB_EXPORT_ALL_SYMBOLS_EXPORTS_FILE)
181+
# Don't use an explicit export. Instead, tell the linker to export all symbols.
183182
MESSAGE("-- Symbols (liblldb): exporting all symbols from the lldb and lldb_private namespaces")
183+
MESSAGE(WARNING "Private LLDB symbols frequently change and no API stability is guaranteed. "
184+
"Only the SB API is guaranteed to be stable.")
184185
add_llvm_symbol_exports(liblldb ${CMAKE_CURRENT_SOURCE_DIR}/liblldb-private.exports)
186+
else ()
187+
MESSAGE("-- Symbols (liblldb): exporting all symbols specified in the exports "
188+
" file '${LLDB_EXPORT_ALL_SYMBOLS_EXPORTS_FILE}'")
189+
MESSAGE(WARNING "Private LLDB symbols frequently change and no API stability is guaranteed. "
190+
"Only the SB API is guaranteed to be stable.")
191+
add_llvm_symbol_exports(liblldb "${LLDB_EXPORT_ALL_SYMBOLS_EXPORTS_FILE}")
185192
endif()
186193
set_target_properties(liblldb_exports PROPERTIES FOLDER "lldb misc")
187194
elseif (LLDB_EXPORT_ALL_SYMBOLS)

0 commit comments

Comments
 (0)