[PATCH] D53778: [CMAKE] Specify all_load when exporting symbols from an executable (macOS)

Joe Ranieri via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 26 14:51:47 PDT 2018


jranieri-grammatech created this revision.
jranieri-grammatech added a reviewer: beanz.
Herald added subscribers: llvm-commits, mgorny.
jranieri-grammatech edited the summary of this revision.

This changes the CMake export_executable_symbols function to force all symbols pulled in from static libraries to be linked into the final executable, even if they weren't directly referenced by the executable. This is necessary for plugins that wish to link against the executable and use LLVM functionality that the executable itself doesn't use.

In my specific use case, I'm writing a Clang plugin that wishes to use LLVM's JSON libraries.


Repository:
  rL LLVM

https://reviews.llvm.org/D53778

Files:
  cmake/modules/AddLLVM.cmake


Index: cmake/modules/AddLLVM.cmake
===================================================================
--- cmake/modules/AddLLVM.cmake
+++ cmake/modules/AddLLVM.cmake
@@ -856,7 +856,7 @@
     set_target_properties(${target} PROPERTIES ENABLE_EXPORTS 1)
     if (APPLE)
       set_property(TARGET ${target} APPEND_STRING PROPERTY
-        LINK_FLAGS " -rdynamic")
+        LINK_FLAGS " -rdynamic -all_load")
     endif()
   endif()
 endfunction()


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53778.171353.patch
Type: text/x-patch
Size: 446 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181026/5fde1430/attachment.bin>


More information about the llvm-commits mailing list