summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorDan Albert <danalbert@google.com>2017-08-15 21:31:17 +0000
committerDan Albert <danalbert@google.com>2017-08-15 21:31:17 +0000
commitfe9f1e60c517e71bd819cab9e90b110457ca42b6 (patch)
tree883390223c3abf3d7220a8f094fd921265fb831a /clang/lib
parentbb93483c119b92c1ec2b7a58505e21b9dce6a333 (diff)
downloadbcm5719-llvm-fe9f1e60c517e71bd819cab9e90b110457ca42b6.tar.gz
bcm5719-llvm-fe9f1e60c517e71bd819cab9e90b110457ca42b6.zip
Revert "Revert "Fix LLVMgold plugin name/path for non-Linux.""
Summary: Relanding https://reviews.llvm.org/D35739 which was reverted because it broke the tests on non-Linux. The tests have been fixed to be platform agnostic, and additional tests have been added to make sure that the plugin has the correct extension on each platform (%pluginext doesn't work in CHECK lines). Reviewers: srhines, pirama Reviewed By: srhines Subscribers: emaste, mehdi_amini, eraman, cfe-commits Differential Revision: https://reviews.llvm.org/D36769 llvm-svn: 310960
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Driver/ToolChains/CommonArgs.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp
index 1273b7aabc0..b9b5b2cbe6e 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -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
OpenPOWER on IntegriCloud