[lld] Enabling loading LLVM pass plugins
authorEli Friedman <efriedma@quicinc.com>
Mon, 23 Mar 2020 19:20:05 +0000 (12:20 -0700)
committerEli Friedman <efriedma@quicinc.com>
Mon, 23 Mar 2020 21:18:32 +0000 (14:18 -0700)
Add the relevant magic bits to allow "-mllvm=-load=plugin.so" etc.

This is now using export_executable_symbols_for_plugins, so symbols are
only exported if plugins are enabled.

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

lld/tools/lld/CMakeLists.txt
lld/tools/lld/lld.cpp

index a15e296..a37c2c7 100644 (file)
@@ -4,7 +4,11 @@ set(LLVM_LINK_COMPONENTS
 
 add_lld_tool(lld
   lld.cpp
+
+  ENABLE_PLUGINS
+  SUPPORT_PLUGINS
   )
+export_executable_symbols_for_plugins(lld)
 
 target_link_libraries(lld
   PRIVATE
index 72ff758..646fc3d 100644 (file)
@@ -36,6 +36,7 @@
 #include "llvm/Support/Host.h"
 #include "llvm/Support/InitLLVM.h"
 #include "llvm/Support/Path.h"
+#include "llvm/Support/PluginLoader.h"
 #include <cstdlib>
 
 using namespace lld;