[lld] f301806 - [lld] Enabling loading LLVM pass plugins

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 23 14:19:15 PDT 2020


Author: Eli Friedman
Date: 2020-03-23T14:18:32-07:00
New Revision: f3018068517e350f509b40f50207db25f80ff6fc

URL: https://github.com/llvm/llvm-project/commit/f3018068517e350f509b40f50207db25f80ff6fc
DIFF: https://github.com/llvm/llvm-project/commit/f3018068517e350f509b40f50207db25f80ff6fc.diff

LOG: [lld] Enabling loading LLVM pass plugins

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

Added: 
    

Modified: 
    lld/tools/lld/CMakeLists.txt
    lld/tools/lld/lld.cpp

Removed: 
    


################################################################################
diff  --git a/lld/tools/lld/CMakeLists.txt b/lld/tools/lld/CMakeLists.txt
index a15e296e31df..a37c2c702bd5 100644
--- a/lld/tools/lld/CMakeLists.txt
+++ b/lld/tools/lld/CMakeLists.txt
@@ -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

diff  --git a/lld/tools/lld/lld.cpp b/lld/tools/lld/lld.cpp
index 72ff758164d8..646fc3d6468e 100644
--- a/lld/tools/lld/lld.cpp
+++ b/lld/tools/lld/lld.cpp
@@ -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;


        


More information about the llvm-commits mailing list