Merge pull request #153790 from sternenseemann/cross-bootstrap-logic

Cross bootstrapping logic fixes benefitting llvmPackages
This commit is contained in:
John Ericson 2022-01-08 12:39:30 -08:00 committed by GitHub
commit baf290023c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 63 additions and 13 deletions

View File

@ -89,7 +89,11 @@ let
# python3 = pkgs.python3; # don't use python-boot # python3 = pkgs.python3; # don't use python-boot
# }); # });
clang = if stdenv.cc.isGNU then tools.libstdcxxClang else tools.libcxxClang; # pick clang appropriate for package set we are targeting
clang =
/**/ if stdenv.targetPlatform.useLLVM or false then tools.clangUseLLVM
else if (pkgs.targetPackages.stdenv or stdenv).cc.isGNU then tools.libstdcxxClang
else tools.libcxxClang;
libstdcxxClang = wrapCCWith rec { libstdcxxClang = wrapCCWith rec {
cc = tools.clang-unwrapped; cc = tools.clang-unwrapped;

View File

@ -104,7 +104,11 @@ let
# python3 = pkgs.python3; # don't use python-boot # python3 = pkgs.python3; # don't use python-boot
# }); # });
clang = if stdenv.cc.isGNU then tools.libstdcxxClang else tools.libcxxClang; # pick clang appropriate for package set we are targeting
clang =
/**/ if stdenv.targetPlatform.useLLVM or false then tools.clangUseLLVM
else if (pkgs.targetPackages.stdenv or stdenv).cc.isGNU then tools.libstdcxxClang
else tools.libcxxClang;
libstdcxxClang = wrapCCWith rec { libstdcxxClang = wrapCCWith rec {
cc = tools.clang-unwrapped; cc = tools.clang-unwrapped;

View File

@ -92,7 +92,11 @@ let
# python3 = pkgs.python3; # don't use python-boot # python3 = pkgs.python3; # don't use python-boot
# }); # });
clang = if stdenv.cc.isGNU then tools.libstdcxxClang else tools.libcxxClang; # pick clang appropriate for package set we are targeting
clang =
/**/ if stdenv.targetPlatform.useLLVM or false then tools.clangUseLLVM
else if (pkgs.targetPackages.stdenv or stdenv).cc.isGNU then tools.libstdcxxClang
else tools.libcxxClang;
libstdcxxClang = wrapCCWith rec { libstdcxxClang = wrapCCWith rec {
cc = tools.clang-unwrapped; cc = tools.clang-unwrapped;

View File

@ -93,7 +93,11 @@ let
# python3 = pkgs.python3; # don't use python-boot # python3 = pkgs.python3; # don't use python-boot
# }); # });
clang = if stdenv.cc.isGNU then tools.libstdcxxClang else tools.libcxxClang; # pick clang appropriate for package set we are targeting
clang =
/**/ if stdenv.targetPlatform.useLLVM or false then tools.clangUseLLVM
else if (pkgs.targetPackages.stdenv or stdenv).cc.isGNU then tools.libstdcxxClang
else tools.libcxxClang;
libstdcxxClang = wrapCCWith rec { libstdcxxClang = wrapCCWith rec {
cc = tools.clang-unwrapped; cc = tools.clang-unwrapped;

View File

@ -65,7 +65,11 @@ let
python3 = pkgs.python3; # don't use python-boot python3 = pkgs.python3; # don't use python-boot
}); });
clang = if stdenv.cc.isGNU then tools.libstdcxxClang else tools.libcxxClang; # pick clang appropriate for package set we are targeting
clang =
/**/ if stdenv.targetPlatform.useLLVM or false then tools.clangUseLLVM
else if (pkgs.targetPackages.stdenv or stdenv).cc.isGNU then tools.libstdcxxClang
else tools.libcxxClang;
libstdcxxClang = wrapCCWith rec { libstdcxxClang = wrapCCWith rec {
cc = tools.clang-unwrapped; cc = tools.clang-unwrapped;

View File

@ -66,7 +66,11 @@ let
python3 = pkgs.python3; # don't use python-boot python3 = pkgs.python3; # don't use python-boot
}); });
clang = if stdenv.cc.isGNU then tools.libstdcxxClang else tools.libcxxClang; # pick clang appropriate for package set we are targeting
clang =
/**/ if stdenv.targetPlatform.useLLVM or false then tools.clangUseLLVM
else if (pkgs.targetPackages.stdenv or stdenv).cc.isGNU then tools.libstdcxxClang
else tools.libcxxClang;
libstdcxxClang = wrapCCWith rec { libstdcxxClang = wrapCCWith rec {
cc = tools.clang-unwrapped; cc = tools.clang-unwrapped;

View File

@ -96,7 +96,11 @@ let
python3 = pkgs.python3; # don't use python-boot python3 = pkgs.python3; # don't use python-boot
}); });
clang = if stdenv.cc.isGNU then tools.libstdcxxClang else tools.libcxxClang; # pick clang appropriate for package set we are targeting
clang =
/**/ if stdenv.targetPlatform.useLLVM or false then tools.clangUseLLVM
else if (pkgs.targetPackages.stdenv or stdenv).cc.isGNU then tools.libstdcxxClang
else tools.libcxxClang;
libstdcxxClang = wrapCCWith rec { libstdcxxClang = wrapCCWith rec {
cc = tools.clang-unwrapped; cc = tools.clang-unwrapped;

View File

@ -97,7 +97,11 @@ let
python3 = pkgs.python3; # don't use python-boot python3 = pkgs.python3; # don't use python-boot
}); });
clang = if stdenv.cc.isGNU then tools.libstdcxxClang else tools.libcxxClang; # pick clang appropriate for package set we are targeting
clang =
/**/ if stdenv.targetPlatform.useLLVM or false then tools.clangUseLLVM
else if (pkgs.targetPackages.stdenv or stdenv).cc.isGNU then tools.libstdcxxClang
else tools.libcxxClang;
libstdcxxClang = wrapCCWith rec { libstdcxxClang = wrapCCWith rec {
cc = tools.clang-unwrapped; cc = tools.clang-unwrapped;

View File

@ -97,7 +97,11 @@ let
python3 = pkgs.python3; # don't use python-boot python3 = pkgs.python3; # don't use python-boot
}); });
clang = if stdenv.cc.isGNU then tools.libstdcxxClang else tools.libcxxClang; # pick clang appropriate for package set we are targeting
clang =
/**/ if stdenv.targetPlatform.useLLVM or false then tools.clangUseLLVM
else if (pkgs.targetPackages.stdenv or stdenv).cc.isGNU then tools.libstdcxxClang
else tools.libcxxClang;
libstdcxxClang = wrapCCWith rec { libstdcxxClang = wrapCCWith rec {
cc = tools.clang-unwrapped; cc = tools.clang-unwrapped;

View File

@ -93,7 +93,11 @@ let
# python3 = pkgs.python3; # don't use python-boot # python3 = pkgs.python3; # don't use python-boot
# }); # });
clang = if stdenv.cc.isGNU then tools.libstdcxxClang else tools.libcxxClang; # pick clang appropriate for package set we are targeting
clang =
/**/ if stdenv.targetPlatform.useLLVM or false then tools.clangUseLLVM
else if (pkgs.targetPackages.stdenv or stdenv).cc.isGNU then tools.libstdcxxClang
else tools.libcxxClang;
libstdcxxClang = wrapCCWith rec { libstdcxxClang = wrapCCWith rec {
cc = tools.clang-unwrapped; cc = tools.clang-unwrapped;

View File

@ -124,7 +124,13 @@ stageFuns: let
if buildPackages.stdenv.hasCC if buildPackages.stdenv.hasCC
then then
if buildPackages.stdenv.cc.isClang or false if buildPackages.stdenv.cc.isClang or false
then buildPackages.clang # buildPackages.clang checks targetPackages.stdenv.cc (i. e. this
# attribute) to get a sense of the its set's default compiler and
# chooses between libc++ and libstdc++ based on that. If we hit this
# code here, we'll cause an infinite recursion. Since a set with
# clang as its default compiler always means libc++, we can infer this
# decision statically.
then buildPackages.llvmPackages.libcxxClang
else buildPackages.gcc else buildPackages.gcc
else else
# This will blow up if anything uses it, but that's OK. The `if # This will blow up if anything uses it, but that's OK. The `if

View File

@ -70,7 +70,7 @@ in lib.init bootStages ++ [
# when there is a C compiler and everything should be fine. # when there is a C compiler and everything should be fine.
then throw "no C compiler provided for this platform" then throw "no C compiler provided for this platform"
else if crossSystem.isDarwin else if crossSystem.isDarwin
then buildPackages.llvmPackages.clang then buildPackages.llvmPackages.libcxxClang
else if crossSystem.useLLVM or false else if crossSystem.useLLVM or false
then buildPackages.llvmPackages.clangUseLLVM then buildPackages.llvmPackages.clangUseLLVM
else buildPackages.gcc; else buildPackages.gcc;

View File

@ -13268,7 +13268,11 @@ with pkgs;
# Others should instead delegate to the next stage's choice with # Others should instead delegate to the next stage's choice with
# `targetPackages.stdenv.cc.bintools`. This one is different just to # `targetPackages.stdenv.cc.bintools`. This one is different just to
# provide the default choice, avoiding infinite recursion. # provide the default choice, avoiding infinite recursion.
bintools ? if stdenv.targetPlatform.isDarwin then darwin.binutils else binutils # See the bintools attribute for the logic and reasoning. We need to provide
# a default here, since eval will hit this function when bootstrapping
# stdenv where the bintools attribute doesn't exist, but will never actually
# be evaluated -- callPackage ends up being too eager.
bintools ? pkgs.bintools
, libc ? bintools.libc , libc ? bintools.libc
, # libc++ from the default LLVM version is bound at the top level, but we , # libc++ from the default LLVM version is bound at the top level, but we
# want the C++ library to be explicitly chosen by the caller, and null by # want the C++ library to be explicitly chosen by the caller, and null by