treewide: All the linker to be chosen independently

This will begin the process of breaking up the `useLLVM` monolith. That
is good in general, but I hope will be good for NetBSD and Darwin in
particular.

Co-authored-by: sterni <sternenseemann@systemli.org>
This commit is contained in:
John Ericson
2021-05-14 21:29:51 +00:00
co-authored by sterni
parent e3a1c149d2
commit 18c38f8aee
14 changed files with 296 additions and 108 deletions
@@ -137,7 +137,7 @@ let
ninja pkg-config
python2WithPackages perl nodejs
gnutar which
llvmPackages.lldClang.bintools
llvmPackages.bintools
] ++ lib.optionals (chromiumVersionAtLeast "92") [
python3WithPackages
];
@@ -98,16 +98,22 @@ let
# clang LTO on Darwin is broken so the stdenv is not being changed.
# Target the LLVM version that rustc -Vv reports it is built with for LTO.
# rustPackages_1_45 -> LLVM 10, rustPackages -> LLVM 11
llvmPackages = if stdenv.isDarwin
then buildPackages.llvmPackages
else if lib.versionAtLeast rustc.llvm.version "11"
then buildPackages.llvmPackages_11
else buildPackages.llvmPackages_10;
llvmPackages0 =
/**/ if stdenv.isDarwin
then buildPackages.llvmPackages
else if lib.versionAtLeast rustc.llvm.version "11"
then buildPackages.llvmPackages_11
else buildPackages.llvmPackages_10;
# Force the use of lld and other llvm tools for LTO
llvmPackages = llvmPackages0.override {
bootBintoolsNoLibc = null;
bootBintools = null;
};
# When LTO for Darwin is fixed, the following will need updating as lld
# doesn't work on it. For now it is fine since ltoSupport implies no Darwin.
buildStdenv = if ltoSupport
then overrideCC stdenv llvmPackages.lldClang
then overrideCC stdenv llvmPackages.clangUseLLVM
else stdenv;
nss_pkg = if lib.versionOlder ffversion "83" then nss_3_53 else nss;