clang, cc-wrapper: Move --gcc-toolchain logic into CC wrapper

Take 2, after #94582 had to be reverted.

This reverts commit ac03cfa3c5.
This commit is contained in:
John Ericson
2021-01-24 15:49:32 -05:00
parent a7a61998e9
commit 0710308402
11 changed files with 21 additions and 23 deletions
+11
View File
@@ -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
##