[PATCH] D35739: Fix LLVMgold plugin name/path for non-Linux.

Dan Albert via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 21 15:25:11 PDT 2017


danalbert created this revision.

It's only named LLVMgold.so on Linux. Fix the name for Windows and
Darwin.

      

Also fix the path for Windows so binutils doesn't have to.


Repository:
  rL LLVM

https://reviews.llvm.org/D35739

Files:
  lib/Driver/ToolChains/CommonArgs.cpp


Index: lib/Driver/ToolChains/CommonArgs.cpp
===================================================================
--- lib/Driver/ToolChains/CommonArgs.cpp
+++ lib/Driver/ToolChains/CommonArgs.cpp
@@ -357,8 +357,20 @@
   // as gold requires -plugin to come before any -plugin-opt that -Wl might
   // forward.
   CmdArgs.push_back("-plugin");
-  std::string Plugin =
-      ToolChain.getDriver().Dir + "/../lib" CLANG_LIBDIR_SUFFIX "/LLVMgold.so";
+
+#if defined(LLVM_ON_WIN32)
+  const char *Suffix = ".dll";
+#elif defined(__APPLE__)
+  const char *Suffix = ".dylib";
+#else
+  const char *Suffix = ".so";
+#endif
+
+  SmallString<1024> Plugin;
+  llvm::sys::path::native(Twine(ToolChain.getDriver().Dir) +
+                              "/../lib" CLANG_LIBDIR_SUFFIX "/LLVMgold" +
+                              Suffix,
+                          Plugin);
   CmdArgs.push_back(Args.MakeArgString(Plugin));
 
   // Try to pass driver level flags relevant to LTO code generation down to


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35739.107727.patch
Type: text/x-patch
Size: 985 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170721/bbde6a80/attachment.bin>


More information about the cfe-commits mailing list