[PATCH] D100899: [CMake][llvm] add_llvm_library's functions require default visibility

Jim Radford via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 20 15:30:17 PDT 2021


radford created this revision.
Herald added a subscriber: mgorny.
radford requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Compiling LLVM, as 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,libllvm.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/D100899

Files:
  llvm/cmake/modules/AddLLVM.cmake


Index: llvm/cmake/modules/AddLLVM.cmake
===================================================================
--- llvm/cmake/modules/AddLLVM.cmake
+++ llvm/cmake/modules/AddLLVM.cmake
@@ -819,6 +819,7 @@
   else()
     set_target_properties(${name} PROPERTIES FOLDER "Libraries")
   endif()
+  set_target_properties(${name} PROPERTIES CXX_VISIBILITY_PRESET default)
 endmacro(add_llvm_library name)
 
 macro(add_llvm_executable name)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100899.339016.patch
Type: text/x-patch
Size: 432 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210420/7d7bfeab/attachment.bin>


More information about the llvm-commits mailing list