[PATCH] D78033: [cmake] Restrict symbols exported from libclang-cpp

Pirama Arumuga Nainar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 13 10:12:16 PDT 2020


pirama created this revision.
pirama added reviewers: beanz, mgorny.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

In libclang-cpp, export only symbols from the clang namespace or clang_*
(functions for the C interface).  This fixes the use case where a tool
depends on both libclang-cpp and libLLVM.  Without this change,
command-line registries from libLLVMSupport are exported by libclang-cpp
and gets deduped with symbols of the same name from libLLVM .  But, the
arguments get registered separately from both the libraries during
startup, resulting in an error.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D78033

Files:
  clang/tools/clang-shlib/CMakeLists.txt
  clang/tools/clang-shlib/libclang-cpp.exports


Index: clang/tools/clang-shlib/libclang-cpp.exports
===================================================================
--- /dev/null
+++ clang/tools/clang-shlib/libclang-cpp.exports
@@ -0,0 +1,2 @@
+_Z*5clang*
+clang_*
Index: clang/tools/clang-shlib/CMakeLists.txt
===================================================================
--- clang/tools/clang-shlib/CMakeLists.txt
+++ clang/tools/clang-shlib/CMakeLists.txt
@@ -36,6 +36,8 @@
   set(INSTALL_WITH_TOOLCHAIN INSTALL_WITH_TOOLCHAIN)
 endif()
 
+set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/libclang-cpp.exports)
+
 add_clang_library(clang-cpp
                   SHARED
                   ${INSTALL_WITH_TOOLCHAIN}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78033.257009.patch
Type: text/x-patch
Size: 686 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200413/42d7d1a9/attachment.bin>


More information about the cfe-commits mailing list