summary refs log tree commit diff
path: root/pkgs/build-support/cc-wrapper
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2021-01-20 18:45:52 -0500
committerJohn Ericson <John.Ericson@Obsidian.Systems>2021-01-24 15:49:32 -0500
commit071030840252273acf05c9902458d4db5bdd71ab (patch)
tree6de26d921db33419ae2b783fdc56d79e80a2867a /pkgs/build-support/cc-wrapper
parenta7a61998e9a5da33c7540486cc0616271f5e5f73 (diff)
downloadnixpkgs-071030840252273acf05c9902458d4db5bdd71ab.tar
nixpkgs-071030840252273acf05c9902458d4db5bdd71ab.tar.gz
nixpkgs-071030840252273acf05c9902458d4db5bdd71ab.tar.bz2
nixpkgs-071030840252273acf05c9902458d4db5bdd71ab.tar.lz
nixpkgs-071030840252273acf05c9902458d4db5bdd71ab.tar.xz
nixpkgs-071030840252273acf05c9902458d4db5bdd71ab.tar.zst
nixpkgs-071030840252273acf05c9902458d4db5bdd71ab.zip
clang, cc-wrapper: Move `--gcc-toolchain` logic into CC wrapper
Take 2, after #94582 had to be reverted.

This reverts commit ac03cfa3c57027e82073ea7db71248d4ab78af66.
Diffstat (limited to 'pkgs/build-support/cc-wrapper')
-rw-r--r--pkgs/build-support/cc-wrapper/default.nix11
1 files changed, 11 insertions, 0 deletions
diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix
index e0153ffc17f..212fd6b570a 100644
--- a/pkgs/build-support/cc-wrapper/default.nix
+++ b/pkgs/build-support/cc-wrapper/default.nix
@@ -290,6 +290,17 @@ stdenv.mkDerivation {
       echo "-L${gccForLibs.lib}/${targetPlatform.config}/lib" >> $out/nix-support/cc-ldflags
     ''
 
+    # TODO We would like to connect this to `useGccForLibs`, but we cannot yet
+    # because `libcxxStdenv` on linux still needs this. Maybe someday we'll
+    # always set `useLLVM` on Darwin, and maybe also break down `useLLVM` into
+    # fine-grained use flags (libgcc vs compiler-rt, ld.lld vs legacy, libc++
+    # vs libstdc++, etc.) since Darwin isn't `useLLVM` on all counts. (See
+    # https://clang.llvm.org/docs/Toolchain.html for all the axes one might
+    # break `useLLVM` into.)
+    + optionalString (isClang && gccForLibs != null && targetPlatform.isLinux && !(stdenv.targetPlatform.useLLVM or false)) ''
+      echo "--gcc-toolchain=${gccForLibs}" >> $out/nix-support/cc-cflags
+    ''
+
     ##
     ## General libc support
     ##