[Lldb-commits] [lldb] [LLDB] Allow specifying a custom exports file (PR #68013)
Walter Erquinigo via lldb-commits
lldb-commits at lists.llvm.org
Wed Oct 4 18:13:18 PDT 2023
https://github.com/walter-erquinigo updated https://github.com/llvm/llvm-project/pull/68013
>From a472a16e6032ce0cef0acae6957f690f7e6cc4a3 Mon Sep 17 00:00:00 2001
From: walter erquinigo <walter at modular.com>
Date: Mon, 2 Oct 2023 13:56:00 -0400
Subject: [PATCH] [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 https://github.com/llvm/llvm-project/pull/67851
---
lldb/cmake/modules/LLDBConfig.cmake | 5 ++++-
lldb/source/API/CMakeLists.txt | 13 ++++++++++---
2 files changed, 14 insertions(+), 4 deletions(-)
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