about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/compilers/llvm/7
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2020-04-01 15:50:50 +0000
committerAlyssa Ross <hi@alyssa.is>2020-04-01 15:50:50 +0000
commit75eafe97f7df0d653bec67f3962214d7c357831f (patch)
tree09f2cc901e0e637876cbb78d192dfe2fcfef8156 /nixpkgs/pkgs/development/compilers/llvm/7
parenta53b121bf4331497da63df3b1b7f1a7897dad146 (diff)
parenta2e06fc3423c4be53181b15c28dfbe0bcf67dd73 (diff)
downloadnixlib-75eafe97f7df0d653bec67f3962214d7c357831f.tar
nixlib-75eafe97f7df0d653bec67f3962214d7c357831f.tar.gz
nixlib-75eafe97f7df0d653bec67f3962214d7c357831f.tar.bz2
nixlib-75eafe97f7df0d653bec67f3962214d7c357831f.tar.lz
nixlib-75eafe97f7df0d653bec67f3962214d7c357831f.tar.xz
nixlib-75eafe97f7df0d653bec67f3962214d7c357831f.tar.zst
nixlib-75eafe97f7df0d653bec67f3962214d7c357831f.zip
Merge commit 'a2e06fc3423c4be53181b15c28dfbe0bcf67dd73'
Diffstat (limited to 'nixpkgs/pkgs/development/compilers/llvm/7')
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/7/clang/HIP-use-PATH-7.patch68
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/7/clang/default.nix14
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/7/compiler-rt.nix4
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/7/default.nix11
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/7/libc++/default.nix4
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/7/lldb.nix4
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/7/llvm.nix8
7 files changed, 93 insertions, 20 deletions
diff --git a/nixpkgs/pkgs/development/compilers/llvm/7/clang/HIP-use-PATH-7.patch b/nixpkgs/pkgs/development/compilers/llvm/7/clang/HIP-use-PATH-7.patch
new file mode 100644
index 000000000000..764dddd966cb
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/llvm/7/clang/HIP-use-PATH-7.patch
@@ -0,0 +1,68 @@
+From 8412cba68835f8f4cc527d02194b181faa5944d4 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Holger=20W=C3=BCnsche?= <holger.o.wuensche@t-online.de>
+Date: Tue, 21 Jan 2020 19:46:09 +0100
+Subject: [PATCH] [HIP] use GetProgramPath for executable discovery
+
+This change replaces the manual building of executable paths
+using llvm::sys::path::append with GetProgramPath.
+This enables adding other paths in case executables reside
+in different directories and makes the code easier to read.
+
+Differential Revision: https://reviews.llvm.org/D72903
+---
+ clang/lib/Driver/ToolChains/HIP.cpp | 18 ++++++------------
+ 1 file changed, 6 insertions(+), 12 deletions(-)
+
+diff --git a/lib/Driver/ToolChains/HIP.cpp b/lib/Driver/ToolChains/HIP.cpp
+index 03acf45a9b3..75fd3226c75 100644
+--- a/lib/Driver/ToolChains/HIP.cpp
++++ b/lib/Driver/ToolChains/HIP.cpp
+@@ -98,9 +98,8 @@ const char *AMDGCN::Linker::constructLLVMLinkCommand(
+   const char *OutputFileName =
+       C.addTempFile(C.getArgs().MakeArgString(TmpName));
+   CmdArgs.push_back(OutputFileName);
+-  SmallString<128> ExecPath(C.getDriver().Dir);
+-  llvm::sys::path::append(ExecPath, "llvm-link");
+-  const char *Exec = Args.MakeArgString(ExecPath);
++  const char *Exec =
++      Args.MakeArgString(getToolChain().GetProgramPath("llvm-link"));
+   C.addCommand(llvm::make_unique<Command>(JA, *this, Exec, CmdArgs, Inputs));
+   return OutputFileName;
+ }
+@@ -141,9 +140,8 @@ const char *AMDGCN::Linker::constructOptCommand(
+   const char *OutputFileName =
+       C.addTempFile(C.getArgs().MakeArgString(TmpFileName));
+   OptArgs.push_back(OutputFileName);
+-  SmallString<128> OptPath(C.getDriver().Dir);
+-  llvm::sys::path::append(OptPath, "opt");
+-  const char *OptExec = Args.MakeArgString(OptPath);
++  const char *OptExec =
++      Args.MakeArgString(getToolChain().GetProgramPath("opt"));
+   C.addCommand(llvm::make_unique<Command>(JA, *this, OptExec, OptArgs, Inputs));
+   return OutputFileName;
+ }
+@@ -161,9 +159,7 @@ const char *AMDGCN::Linker::constructLlcCommand(
+   const char *LlcOutputFile =
+       C.addTempFile(C.getArgs().MakeArgString(LlcOutputFileName));
+   LlcArgs.push_back(LlcOutputFile);
+-  SmallString<128> LlcPath(C.getDriver().Dir);
+-  llvm::sys::path::append(LlcPath, "llc");
+-  const char *Llc = Args.MakeArgString(LlcPath);
++  const char *Llc = Args.MakeArgString(getToolChain().GetProgramPath("llc"));
+   C.addCommand(llvm::make_unique<Command>(JA, *this, Llc, LlcArgs, Inputs));
+   return LlcOutputFile;
+ }
+@@ -178,9 +174,7 @@ void AMDGCN::Linker::constructLldCommand(Compilation &C, const JobAction &JA,
+   ArgStringList LldArgs{"-flavor",    "gnu", "--no-undefined",
+                         "-shared",    "-o",  Output.getFilename(),
+                         InputFileName};
+-  SmallString<128> LldPath(C.getDriver().Dir);
+-  llvm::sys::path::append(LldPath, "lld");
+-  const char *Lld = Args.MakeArgString(LldPath);
++  const char *Lld = Args.MakeArgString(getToolChain().GetProgramPath("lld"));
+   C.addCommand(llvm::make_unique<Command>(JA, *this, Lld, LldArgs, Inputs));
+ }
+ 
+-- 
+2.23.1
+
diff --git a/nixpkgs/pkgs/development/compilers/llvm/7/clang/default.nix b/nixpkgs/pkgs/development/compilers/llvm/7/clang/default.nix
index 5ac9a7a2672a..6e01f4259ee0 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/7/clang/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/7/clang/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetch, cmake, libxml2, llvm, version, clang-tools-extra_src, python
+{ stdenv, fetch, cmake, libxml2, llvm, version, clang-tools-extra_src, python3, lld
 , fixDarwinDylibNames
 , enableManpages ? false
 , enablePolly ? false # TODO: get this info from llvm (passthru?)
@@ -19,10 +19,10 @@ let
       mv clang-tools-extra-* $sourceRoot/tools/extra
     '';
 
-    nativeBuildInputs = [ cmake python ]
-      ++ stdenv.lib.optional enableManpages python.pkgs.sphinx;
+    nativeBuildInputs = [ cmake python3 ]
+      ++ stdenv.lib.optional enableManpages python3.pkgs.sphinx;
 
-    buildInputs = [ libxml2 llvm ]
+    buildInputs = [ libxml2 llvm lld ]
       ++ stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames;
 
     cmakeFlags = [
@@ -38,7 +38,11 @@ let
       "-DLINK_POLLY_INTO_TOOLS=ON"
     ];
 
-    patches = [ ./purity.patch ];
+    patches = [
+      ./purity.patch
+      # make clang -xhip use $PATH to find executables
+      ./HIP-use-PATH-7.patch
+    ];
 
     postPatch = ''
       sed -i -e 's/DriverArgs.hasArg(options::OPT_nostdlibinc)/true/' \
diff --git a/nixpkgs/pkgs/development/compilers/llvm/7/compiler-rt.nix b/nixpkgs/pkgs/development/compilers/llvm/7/compiler-rt.nix
index a7d4bcb86962..ae98940adeab 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/7/compiler-rt.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/7/compiler-rt.nix
@@ -1,10 +1,10 @@
-{ stdenv, version, fetch, cmake, python, llvm, libcxxabi }:
+{ stdenv, version, fetch, cmake, python3, llvm, libcxxabi }:
 stdenv.mkDerivation {
   pname = "compiler-rt";
   inherit version;
   src = fetch "compiler-rt" "1n48p8gjarihkws0i2bay5w9bdwyxyxxbpwyng7ba58jb30dlyq5";
 
-  nativeBuildInputs = [ cmake python llvm ];
+  nativeBuildInputs = [ cmake python3 llvm ];
   buildInputs = stdenv.lib.optional stdenv.hostPlatform.isDarwin libcxxabi;
 
   NIX_CFLAGS_COMPILE = [
diff --git a/nixpkgs/pkgs/development/compilers/llvm/7/default.nix b/nixpkgs/pkgs/development/compilers/llvm/7/default.nix
index 621a246225d7..04e1610fb791 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/7/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/7/default.nix
@@ -1,5 +1,5 @@
 { lowPrio, newScope, pkgs, stdenv, cmake, libstdcxxHook
-, libxml2, python, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith
+, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith
 , buildLlvmTools # tools, but from the previous stage, for cross
 , targetLlvmLibraries # libraries, but from the next stage, for cross
 }:
@@ -16,7 +16,7 @@ let
   clang-tools-extra_src = fetch "clang-tools-extra" "0lb4kdh7j2fhfz8kd6iv5df7m3pikiryk1vvwsf87spc90n09q0w";
 
   tools = stdenv.lib.makeExtensible (tools: let
-    callPackage = newScope (tools // { inherit stdenv cmake libxml2 python isl release_version version fetch; });
+    callPackage = newScope (tools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch; });
     mkExtraBuildCommands = cc: ''
       rsrc="$out/resource-root"
       mkdir "$rsrc"
@@ -32,6 +32,7 @@ let
     llvm-polly = callPackage ./llvm.nix { enablePolly = true; };
 
     clang-unwrapped = callPackage ./clang {
+      inherit (tools) lld;
       inherit clang-tools-extra_src;
     };
     clang-polly-unwrapped = callPackage ./clang {
@@ -42,12 +43,12 @@ let
 
     llvm-manpages = lowPrio (tools.llvm.override {
       enableManpages = true;
-      python = pkgs.python;  # don't use python-boot
+      python3 = pkgs.python3;  # don't use python-boot
     });
 
     clang-manpages = lowPrio (tools.clang-unwrapped.override {
       enableManpages = true;
-      python = pkgs.python;  # don't use python-boot
+      python3 = pkgs.python3;  # don't use python-boot
     });
 
     libclang = tools.clang-unwrapped.lib;
@@ -126,7 +127,7 @@ let
   });
 
   libraries = stdenv.lib.makeExtensible (libraries: let
-    callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake libxml2 python isl release_version version fetch; });
+    callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch; });
   in {
 
     compiler-rt = callPackage ./compiler-rt.nix {
diff --git a/nixpkgs/pkgs/development/compilers/llvm/7/libc++/default.nix b/nixpkgs/pkgs/development/compilers/llvm/7/libc++/default.nix
index f6f9970d7a6e..f2cdd2f6f5fa 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/7/libc++/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/7/libc++/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, fetch, cmake, python, libcxxabi, fixDarwinDylibNames, version
+{ lib, stdenv, fetch, cmake, python3, libcxxabi, fixDarwinDylibNames, version
 , enableShared ? ! stdenv.hostPlatform.isMusl }:
 
 stdenv.mkDerivation {
@@ -24,7 +24,7 @@ stdenv.mkDerivation {
   '' + lib.optionalString stdenv.hostPlatform.isMusl ''
     patchShebangs utils/cat_files.py
   '';
-  nativeBuildInputs = [ cmake ] ++ stdenv.lib.optional stdenv.hostPlatform.isMusl python;
+  nativeBuildInputs = [ cmake ] ++ stdenv.lib.optional stdenv.hostPlatform.isMusl python3;
 
   buildInputs = [ libcxxabi ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
 
diff --git a/nixpkgs/pkgs/development/compilers/llvm/7/lldb.nix b/nixpkgs/pkgs/development/compilers/llvm/7/lldb.nix
index 44687ead4d1c..ace6ae812fde 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/7/lldb.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/7/lldb.nix
@@ -10,7 +10,7 @@
 , llvm
 , clang-unwrapped
 , perl
-, python
+, python3
 , version
 , darwin
 }:
@@ -21,7 +21,7 @@ stdenv.mkDerivation {
 
   src = fetch "lldb" "0klsscg1sczc4nw2l53xggi969k361cng2sjjrfp3bv4g5x14s4v";
 
-  nativeBuildInputs = [ cmake perl python which swig ];
+  nativeBuildInputs = [ cmake perl python3 which swig ];
   buildInputs = [ ncurses zlib libedit libxml2 llvm ]
     ++ stdenv.lib.optionals stdenv.isDarwin [ darwin.libobjc darwin.apple_sdk.libs.xpc darwin.apple_sdk.frameworks.Foundation darwin.bootstrap_cmds darwin.apple_sdk.frameworks.Carbon darwin.apple_sdk.frameworks.Cocoa ];
 
diff --git a/nixpkgs/pkgs/development/compilers/llvm/7/llvm.nix b/nixpkgs/pkgs/development/compilers/llvm/7/llvm.nix
index c56bbfd0eab9..d7fb1fe4b93f 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/7/llvm.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/7/llvm.nix
@@ -2,7 +2,7 @@
 , fetch
 , fetchpatch
 , cmake
-, python
+, python3
 , libffi
 , libbfd
 , libpfm
@@ -48,8 +48,8 @@ in stdenv.mkDerivation ({
   outputs = [ "out" "python" ]
     ++ optional enableSharedLibraries "lib";
 
-  nativeBuildInputs = [ cmake python ]
-    ++ optional enableManpages python.pkgs.sphinx;
+  nativeBuildInputs = [ cmake python3 ]
+    ++ optional enableManpages python3.pkgs.sphinx;
 
   buildInputs = [ libxml2 libffi ]
     ++ optional enablePFM libpfm; # exegesis
@@ -141,7 +141,7 @@ in stdenv.mkDerivation ({
   '';
 
   preCheck = ''
-    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/lib
+    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH''${LD_LIBRARY_PATH:+:}$PWD/lib
   '';
 
   postInstall = ''