[Lldb-commits] [PATCH] D100898: [CMake][lldb] add_lldb_library's functions require default visibility

Jim Radford via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Apr 20 15:29:18 PDT 2021


radford created this revision.
radford added a reviewer: arphaman.
Herald added a subscriber: mgorny.
radford requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Compiling lldb, in a cmake sub-project that compiles with visibility
hidden, will generate a "cannot export hidden symbol" error because we
require default visibility.  Even though we export using
-Wl,-exported_symbols_list,liblldb.exports, if each .cpp file is
compiled with -fvisibility=hidden, then you'll get this warning and
linking will fail. Essentially -exported_symbols_list is not strong
enough to reverse the -fvisibility=hidden.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D100898

Files:
  lldb/cmake/modules/AddLLDB.cmake


Index: lldb/cmake/modules/AddLLDB.cmake
===================================================================
--- lldb/cmake/modules/AddLLDB.cmake
+++ lldb/cmake/modules/AddLLDB.cmake
@@ -97,6 +97,7 @@
     else()
       target_link_libraries(${name} PRIVATE ${PARAM_CLANG_LIBS})
     endif()
+    set_target_properties(${name} PROPERTIES CXX_VISIBILITY_PRESET default)
   endif()
 
   # A target cannot be changed to a FRAMEWORK after calling install() because


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100898.339015.patch
Type: text/x-patch
Size: 460 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210420/14fab97b/attachment.bin>


More information about the lldb-commits mailing list