[Lldb-commits] [lldb] e538c6f - [LLDB] Ensure LLDB symbols are exported in LLDB_EXPORT_ALL_SYMBOLS is provided.

walter erquinigo via lldb-commits lldb-commits at lists.llvm.org
Mon Apr 3 13:42:22 PDT 2023


Author: walter erquinigo
Date: 2023-04-03T15:41:02-05:00
New Revision: e538c6fc3048e1fb1a58da879275d6804186856e

URL: https://github.com/llvm/llvm-project/commit/e538c6fc3048e1fb1a58da879275d6804186856e
DIFF: https://github.com/llvm/llvm-project/commit/e538c6fc3048e1fb1a58da879275d6804186856e.diff

LOG: [LLDB] Ensure LLDB symbols are exported in LLDB_EXPORT_ALL_SYMBOLS is provided.

If we want to export all lldb symbols (i.e LLDB_EXPORT_ALL_SYMBOLS=ON), we need to use default visibility for all LLDB libraries even if a global CMAKE_CXX_VISIBILITY_PRESET=hidden is present. In fact, there are cases in which a global llvm configuration wants CMAKE_CXX_VISIBILITY_PRESET as hidden but simultaneously LLDB_EXPORT_ALL_SYMBOLS=ON is also needed to be able to develop out-of-tree lldb plugins.

Differential Revision: https://reviews.llvm.org/D147453

Added: 
    

Modified: 
    lldb/cmake/modules/AddLLDB.cmake

Removed: 
    


################################################################################
diff  --git a/lldb/cmake/modules/AddLLDB.cmake b/lldb/cmake/modules/AddLLDB.cmake
index f2d96dfd68e00..d47a30f5e1092 100644
--- a/lldb/cmake/modules/AddLLDB.cmake
+++ b/lldb/cmake/modules/AddLLDB.cmake
@@ -165,6 +165,13 @@ function(add_lldb_library name)
   else()
     set_target_properties(${name} PROPERTIES FOLDER "lldb libraries")
   endif()
+
+  # If we want to export all lldb symbols (i.e LLDB_EXPORT_ALL_SYMBOLS=ON), we
+  # need to use default visibility for all LLDB libraries even if a global
+  # `CMAKE_CXX_VISIBILITY_PRESET=hidden`is present.
+  if (LLDB_EXPORT_ALL_SYMBOLS)
+    set_target_properties(${name} PROPERTIES CXX_VISIBILITY_PRESET default)
+  endif()
 endfunction(add_lldb_library)
 
 function(add_lldb_executable name)


        


More information about the lldb-commits mailing list