diff options
Diffstat (limited to 'pkgs/development/compilers/llvm/rocm/default.nix')
-rw-r--r-- | pkgs/development/compilers/llvm/rocm/default.nix | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/pkgs/development/compilers/llvm/rocm/default.nix b/pkgs/development/compilers/llvm/rocm/default.nix index a2c269251d1..20c1a20b68a 100644 --- a/pkgs/development/compilers/llvm/rocm/default.nix +++ b/pkgs/development/compilers/llvm/rocm/default.nix @@ -10,23 +10,27 @@ let }; in rec { clang = wrapCCWith rec { - cc = clang-unwrapped; + cc = llvm; extraBuildCommands = '' clang_version=`${cc}/bin/clang -v 2>&1 | grep "clang version " | grep -E -o "[0-9.-]+"` rsrc="$out/resource-root" mkdir "$rsrc" ln -s "${cc}/lib/clang/$clang_version/include" "$rsrc" - ln -s "${compiler-rt}/lib" "$rsrc/lib" + ln -s "${cc}/lib/clang/$clang_version/lib" "$rsrc/lib" echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags echo "--gcc-toolchain=${stdenv.cc.cc}" >> $out/nix-support/cc-cflags - echo "-Wno-unused-command-line-argument" >> $out/nix-support/cc-cflags rm $out/nix-support/add-hardening.sh touch $out/nix-support/add-hardening.sh + # GPU compilation uses builtin lld + substituteInPlace $out/bin/clang \ + --replace '-MM) dontLink=1 ;;' $'-MM | --cuda-device-only) dontLink=1 ;;\n--cuda-host-only | --cuda-compile-host-device) dontLink=0 ;;' + substituteInPlace $out/bin/clang++ \ + --replace '-MM) dontLink=1 ;;' $'-MM | --cuda-device-only) dontLink=1 ;;\n--cuda-host-only | --cuda-compile-host-device) dontLink=0 ;;' ''; }; clangNoCompilerRt = wrapCCWith rec { - cc = clang-unwrapped; + cc = llvm; extraBuildCommands = '' clang_version=`${cc}/bin/clang -v 2>&1 | grep "clang version " | grep -E -o "[0-9.-]+"` rsrc="$out/resource-root" @@ -34,28 +38,17 @@ in rec { ln -s "${cc}/lib/clang/$clang_version/include" "$rsrc" echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags echo "--gcc-toolchain=${stdenv.cc.cc}" >> $out/nix-support/cc-cflags - echo "-Wno-unused-command-line-argument" >> $out/nix-support/cc-cflags rm $out/nix-support/add-hardening.sh touch $out/nix-support/add-hardening.sh + # GPU compilation uses builtin lld + substituteInPlace $out/bin/clang \ + --replace '-MM) dontLink=1 ;;' $'-MM | --cuda-device-only) dontLink=1 ;;\n--cuda-host-only | --cuda-compile-host-device) dontLink=0 ;;' + substituteInPlace $out/bin/clang++ \ + --replace '-MM) dontLink=1 ;;' $'-MM | --cuda-device-only) dontLink=1 ;;\n--cuda-host-only | --cuda-compile-host-device) dontLink=0 ;;' ''; }; - clang-unwrapped = callPackage ./clang.nix { - inherit lld llvm version; - src = "${src}/clang"; - }; - - compiler-rt = callPackage ./compiler-rt { - inherit version llvm; - inherit src; - stdenv = overrideCC stdenv clangNoCompilerRt; - }; - - lld = callPackage ./lld.nix { - inherit llvm src version; - }; - - llvm = callPackage ./llvm { + llvm = callPackage ./llvm.nix { inherit src version; }; } |