]> granicus.if.org Git - clang/commitdiff
Fix LLVMgold plugin name/path for non-Linux.
authorDan Albert <danalbert@google.com>
Mon, 14 Aug 2017 23:19:38 +0000 (23:19 +0000)
committerDan Albert <danalbert@google.com>
Mon, 14 Aug 2017 23:19:38 +0000 (23:19 +0000)
Summary:
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.

Reviewers: srhines, pirama

Reviewed By: srhines

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@310895 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/ToolChains/CommonArgs.cpp

index 1273b7aabc029d65ce000077fec81c10b80fb33f..b9b5b2cbe6edd7a043c80f1c158d3614286de07d 100644 (file)
@@ -376,8 +376,20 @@ void tools::AddGoldPlugin(const ToolChain &ToolChain, const ArgList &Args,
   // 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