summary refs log tree commit diff
path: root/pkgs/development/compilers/llvm/5
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/compilers/llvm/5')
-rw-r--r--pkgs/development/compilers/llvm/5/clang/LLVMgold-path.patch14
-rw-r--r--pkgs/development/compilers/llvm/5/clang/default.nix11
2 files changed, 19 insertions, 6 deletions
diff --git a/pkgs/development/compilers/llvm/5/clang/LLVMgold-path.patch b/pkgs/development/compilers/llvm/5/clang/LLVMgold-path.patch
new file mode 100644
index 00000000000..6a09c91b513
--- /dev/null
+++ b/pkgs/development/compilers/llvm/5/clang/LLVMgold-path.patch
@@ -0,0 +1,14 @@
+diff --git a/lib/Driver/ToolChains/CommonArgs.cpp b/lib/Driver/ToolChains/CommonArgs.cpp
+index 00bd60bc24bb..17416b0bd3c0 100644
+--- a/lib/Driver/ToolChains/CommonArgs.cpp
++++ b/lib/Driver/ToolChains/CommonArgs.cpp
+@@ -376,8 +376,7 @@ 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";
++  std::string Plugin = "@libllvmLibdir@" "/LLVMgold.so";
+   CmdArgs.push_back(Args.MakeArgString(Plugin));
+ 
+   // Try to pass driver level flags relevant to LTO code generation down to
diff --git a/pkgs/development/compilers/llvm/5/clang/default.nix b/pkgs/development/compilers/llvm/5/clang/default.nix
index b5887a23c65..df3d2613986 100644
--- a/pkgs/development/compilers/llvm/5/clang/default.nix
+++ b/pkgs/development/compilers/llvm/5/clang/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, llvm_meta, fetch, cmake, libxml2, libllvm, version, clang-tools-extra_src, python3
+{ lib, stdenv, llvm_meta, fetch, substituteAll, cmake, libxml2, libllvm, version, clang-tools-extra_src, python3
 , buildLlvmTools
 , fixDarwinDylibNames
 , enableManpages ? false
@@ -43,6 +43,10 @@ let
     patches = [
       ./purity.patch
       ./gnu-install-dirs.patch
+      (substituteAll {
+        src = ./LLVMgold-path.patch;
+        libllvmLibdir = "${libllvm.lib}/lib";
+      })
     ];
 
     postPatch = ''
@@ -58,12 +62,7 @@ let
 
     outputs = [ "out" "lib" "dev" "python" ];
 
-    # Clang expects to find LLVMgold in its own prefix
     postInstall = ''
-      if [ -e ${libllvm.lib}/lib/LLVMgold.so ]; then
-        ln -sv ${libllvm.lib}/lib/LLVMgold.so $lib/lib
-      fi
-
       ln -sv $out/bin/clang $out/bin/cpp
 
       # Move libclang to 'lib' output