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

Dan Albert via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 14 16:20:35 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL310895: Fix LLVMgold plugin name/path for non-Linux. (authored by danalbert).

Repository:
  rL LLVM

https://reviews.llvm.org/D35739

Files:
  cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp


Index: cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp
===================================================================
--- cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp
+++ cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp
@@ -376,8 +376,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.111097.patch
Type: text/x-patch
Size: 1015 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170814/1cc5f0b7/attachment.bin>


More information about the cfe-commits mailing list