diff --git a/lib/systems/default.nix b/lib/systems/default.nix index ec0106a13dacf..b68fcc6eb303f 100644 --- a/lib/systems/default.nix +++ b/lib/systems/default.nix @@ -66,7 +66,11 @@ let # `parsed` is inferred from args, both because there are two options with one # clearly preferred, and to prevent cycles. A simpler fixed point where the RHS # always just used `final.*` would fail on both counts. - elaborate = systemOrArgs: let + elaborate = systemOrArgs: + assert lib.assertMsg (!(lib.oldestSupportedReleaseIsAtLeast 2511 && systemOrArgs ? useLLVM)) "The useLLVM attribute has been deprecated in favor of the toolchain attributes."; + assert lib.assertMsg (!(lib.oldestSupportedReleaseIsAtLeast 2511 && systemOrArgs ? useArocc)) "The useArocc attribute has been deprecated in favor of the toolchain attributes."; + assert lib.assertMsg (!(lib.oldestSupportedReleaseIsAtLeast 2511 && systemOrArgs ? useZig)) "The useZig attribute has been deprecated in favor of the toolchain attributes."; + let allArgs = systemToAttrs systemOrArgs; # Those two will always be derived from "config", if given, so they should NOT @@ -92,6 +96,21 @@ let isCompatible = _: throw "2022-05-23: isCompatible has been removed in favor of canExecute, refer to the 22.11 changelog for details"; # Derived meta-data useLLVM = final.isFreeBSD || final.isOpenBSD; + useArocc = false; + useZig = false; + + cc = if final.useLLVM || final.isDarwin then "clang" + else if final.useArocc then "arocc" + else if final.useZig then "zig" + else "gcc"; + + bintools = if final.useLLVM || final.useArocc || final.useZig || final.isDarwin then + "llvm" + else "gnu"; + + cxxlib = + /**/ if final.useLLVM || final.useArocc || final.useZig || final.isDarwin then "libcxx" + else "libstdcxx"; libc = /**/ if final.isDarwin then "libSystem" @@ -112,6 +131,16 @@ let else if final.isNone then "newlib" # TODO(@Ericson2314) think more about other operating systems else "native/impure"; + + unwinderlib = + /**/ if final.useLLVM || final.useArocc || final.useZig then "libunwind" + else if final.isDarwin then "libunwind-system" + else "libgcc_s"; + + rtlib = + /**/ if final.useLLVM || final.useArocc || final.useZig || final.isDarwin then "compiler-rt" + else "libgcc"; + # Choose what linker we wish to use by default. Someday we might also # choose the C compiler, runtime library, C++ standard library, etc. in # this way, nice and orthogonally, and deprecate `useLLVM`. But due to @@ -119,8 +148,8 @@ let # independently, so we are just doing `linker` and keeping `useLLVM` for # now. linker = - /**/ if final.useLLVM or false then "lld" - else if final.isDarwin then "cctools" + /**/ if final.useLLVM then "lld" + else if final.isDarwin then "cctools" # "bfd" and "gold" both come from GNU binutils. The existence of Gold # is why we use the more obscure "bfd" and not "binutils" for this # choice. diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix index 8558a9f3d8d26..c6e562c995c27 100644 --- a/pkgs/build-support/cc-wrapper/default.nix +++ b/pkgs/build-support/cc-wrapper/default.nix @@ -120,8 +120,8 @@ let useGccForLibs = useCcForLibs && libcxx == null + && targetPlatform.rtlib == "libgcc" && !targetPlatform.isDarwin - && !(targetPlatform.useLLVM or false) && !(targetPlatform.useAndroidPrebuilt or false) && !(targetPlatform.isiOS or false) && gccForLibs != null; @@ -514,7 +514,7 @@ stdenvNoCC.mkDerivation { + optionalString (isClang && targetPlatform.isLinux && !(targetPlatform.useAndroidPrebuilt or false) - && !(targetPlatform.useLLVM or false) + && targetPlatform.rtlib == "libgcc" && gccForLibs != null) ('' echo "--gcc-toolchain=${gccForLibs}" >> $out/nix-support/cc-cflags diff --git a/pkgs/by-name/al/alsa-lib/package.nix b/pkgs/by-name/al/alsa-lib/package.nix index f21d216a63bb1..ee6dea039f7cf 100644 --- a/pkgs/by-name/al/alsa-lib/package.nix +++ b/pkgs/by-name/al/alsa-lib/package.nix @@ -25,7 +25,7 @@ stdenv.mkDerivation (finalAttrs: { # order to support apps with 32bit sound running on x86_64 architecture. ./alsa-plugin-conf-multilib.patch ] - ++ lib.optional (stdenv.hostPlatform.useLLVM or false) + ++ lib.optional (stdenv.hostPlatform.linker == "lld") # Fixes version script under LLVM, should be fixed in the next update. # Check if "pkgsLLVM.alsa-lib" builds on next version bump and remove this # if it succeeds. diff --git a/pkgs/by-name/cl/cling/package.nix b/pkgs/by-name/cl/cling/package.nix index 63b4a681745c0..08d63e284e7ee 100644 --- a/pkgs/by-name/cl/cling/package.nix +++ b/pkgs/by-name/cl/cling/package.nix @@ -27,7 +27,7 @@ # Build with libc++ (LLVM) rather than stdlibc++ (GCC). # This is experimental and not all features work. - useLLVMLibcxx ? clangStdenv.hostPlatform.isDarwin, + useLLVMLibcxx ? clangStdenv.hostPlatform.cxxlib == "libcxx", }: let diff --git a/pkgs/by-name/cy/cyrus_sasl/package.nix b/pkgs/by-name/cy/cyrus_sasl/package.nix index 68d019ca2619b..78dfa391744ac 100644 --- a/pkgs/by-name/cy/cyrus_sasl/package.nix +++ b/pkgs/by-name/cy/cyrus_sasl/package.nix @@ -74,7 +74,7 @@ stdenv.mkDerivation rec { "--enable-shared" ] ++ lib.optional enableLdap "--with-ldap=${openldap.dev}" - ++ lib.optionals (stdenv.targetPlatform.useLLVM or false) [ + ++ lib.optionals (stdenv.hostPlatform.cc == "clang" && !stdenv.hostPlatform.isDarwin) [ "--disable-sample" "CFLAGS=-DTIME_WITH_SYS_TIME" ]; diff --git a/pkgs/by-name/el/elfutils/package.nix b/pkgs/by-name/el/elfutils/package.nix index f07ab5b6aebcb..14ba9418d7fc4 100644 --- a/pkgs/by-name/el/elfutils/package.nix +++ b/pkgs/by-name/el/elfutils/package.nix @@ -63,7 +63,7 @@ stdenv.mkDerivation rec { ++ lib.optionals stdenv.hostPlatform.isMusl [ ./musl-error_h.patch ] # Prevent headers and binaries from colliding which results in an error. # https://sourceware.org/pipermail/elfutils-devel/2024q3/007281.html - ++ lib.optional (stdenv.targetPlatform.useLLVM or false) ./cxx-header-collision.patch; + ++ lib.optional (stdenv.hostPlatform.cxxlib == "libcxx") ./cxx-header-collision.patch; postPatch = '' @@ -94,7 +94,7 @@ stdenv.mkDerivation rec { bzip2 ] ++ lib.optional enableDebuginfod pkg-config - ++ lib.optional (stdenv.targetPlatform.useLLVM or false) autoreconfHook; + ++ lib.optional (stdenv.hostPlatform.cxxlib == "libcxx") autoreconfHook; buildInputs = [ zlib @@ -128,7 +128,7 @@ stdenv.mkDerivation rec { # Versioned symbols are nice to have, but we can do without. (lib.enableFeature (!stdenv.hostPlatform.isMicroBlaze) "symbol-versioning") ] - ++ lib.optional (stdenv.targetPlatform.useLLVM or false) "--disable-demangler" + ++ lib.optional (stdenv.hostPlatform.unwinderlib == "libunwind") "--disable-demangler" ++ lib.optionals stdenv.cc.isClang [ "CFLAGS=-Wno-unused-private-field" "CXXFLAGS=-Wno-unused-private-field" diff --git a/pkgs/by-name/ke/kexec-tools/package.nix b/pkgs/by-name/ke/kexec-tools/package.nix index 5eef5475390ed..5ecd41e9851ca 100644 --- a/pkgs/by-name/ke/kexec-tools/package.nix +++ b/pkgs/by-name/ke/kexec-tools/package.nix @@ -19,13 +19,17 @@ stdenv.mkDerivation rec { sha256 = "sha256-Z7GsUDqt5FpU2wvHkiiogwo11dT4PO6TLP8+eoGkqew="; }; - patches = [ - # Use ELFv2 ABI on ppc64be - (fetchpatch { - url = "https://raw.githubusercontent.com/void-linux/void-packages/6c1192cbf166698932030c2e3de71db1885a572d/srcpkgs/kexec-tools/patches/ppc64-elfv2.patch"; - sha256 = "19wzfwb0azm932v0vhywv4221818qmlmvdfwpvvpfyw4hjsc2s1l"; - }) - ] ++ lib.optional (stdenv.hostPlatform.useLLVM or false) ./fix-purgatory-llvm-libunwind.patch; + patches = + [ + # Use ELFv2 ABI on ppc64be + (fetchpatch { + url = "https://raw.githubusercontent.com/void-linux/void-packages/6c1192cbf166698932030c2e3de71db1885a572d/srcpkgs/kexec-tools/patches/ppc64-elfv2.patch"; + sha256 = "19wzfwb0azm932v0vhywv4221818qmlmvdfwpvvpfyw4hjsc2s1l"; + }) + ] + ++ lib.optional ( + stdenv.hostPlatform.unwinderlib == "libunwind" + ) ./fix-purgatory-llvm-libunwind.patch; hardeningDisable = [ "format" diff --git a/pkgs/by-name/li/libseccomp/package.nix b/pkgs/by-name/li/libseccomp/package.nix index 9ff313c84a65e..43075e5a39b4f 100644 --- a/pkgs/by-name/li/libseccomp/package.nix +++ b/pkgs/by-name/li/libseccomp/package.nix @@ -37,7 +37,7 @@ stdenv.mkDerivation rec { util-linuxMinimal which ]; - doCheck = !(stdenv.targetPlatform.useLLVM or false); + doCheck = stdenv.hostPlatform.cc != "clang"; # Hack to ensure that patchelf --shrink-rpath get rids of a $TMPDIR reference. preFixup = "rm -rfv src"; diff --git a/pkgs/by-name/so/sourceHighlight/package.nix b/pkgs/by-name/so/sourceHighlight/package.nix index 16eaa9e42e6ab..a1b87fd220dc5 100644 --- a/pkgs/by-name/so/sourceHighlight/package.nix +++ b/pkgs/by-name/so/sourceHighlight/package.nix @@ -62,7 +62,7 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ updateAutotoolsGnuConfigScriptsHook ]; buildInputs = [ boost ] - ++ lib.optional (stdenv.targetPlatform.useLLVM or false) ( + ++ lib.optional (stdenv.hostPlatform.rtlib == "compiler-rt" && !stdenv.hostPlatform.isDarwin) ( llvmPackages.compiler-rt.override { doFakeLibgcc = true; } @@ -92,7 +92,7 @@ stdenv.mkDerivation rec { maintainers = with maintainers; [ SuperSandro2000 ]; }; } -// lib.optionalAttrs (stdenv.targetPlatform.useLLVM or false) { +// lib.optionalAttrs (stdenv.hostPlatform.rtlib == "libunwind" && !stdenv.hostPlatform.isDarwin) { # Force linking to "libgcc" so tests pass NIX_CFLAGS_COMPILE = "-lgcc"; } diff --git a/pkgs/development/compilers/llvm/common/clang/default.nix b/pkgs/development/compilers/llvm/common/clang/default.nix index 7afa284c25a2d..053bd6f28aa37 100644 --- a/pkgs/development/compilers/llvm/common/clang/default.nix +++ b/pkgs/development/compilers/llvm/common/clang/default.nix @@ -198,7 +198,7 @@ let ninjaFlags = [ "docs-clang-man" ]; })) // (lib.optionalAttrs (lib.versionAtLeast release_version "15") { - env = lib.optionalAttrs (stdenv.buildPlatform != stdenv.hostPlatform && !stdenv.hostPlatform.useLLVM) { + env = lib.optionalAttrs (stdenv.buildPlatform != stdenv.hostPlatform && stdenv.hostPlatform.cc != "clang" && !stdenv.hostPlatform.isDarwin) { # The following warning is triggered with (at least) gcc >= # 12, but appears to occur only for cross compiles. NIX_CFLAGS_COMPILE = "-Wno-maybe-uninitialized"; diff --git a/pkgs/development/compilers/llvm/common/compiler-rt/default.nix b/pkgs/development/compilers/llvm/common/compiler-rt/default.nix index f72af0f085567..ddd689e5ab217 100644 --- a/pkgs/development/compilers/llvm/common/compiler-rt/default.nix +++ b/pkgs/development/compilers/llvm/common/compiler-rt/default.nix @@ -33,7 +33,6 @@ let - useLLVM = stdenv.hostPlatform.useLLVM or false; bareMetal = stdenv.hostPlatform.parsed.kernel.name == "none"; haveLibc = stdenv.cc.libc != null; # TODO: Make this account for GCC having libstdcxx, which will help @@ -92,22 +91,22 @@ stdenv.mkDerivation { "-DCMAKE_ASM_COMPILER_TARGET=${stdenv.hostPlatform.config}" ] ++ lib.optionals (haveLibc && stdenv.hostPlatform.libc == "glibc") [ "-DSANITIZER_COMMON_CFLAGS=-I${libxcrypt}/include" - ] ++ lib.optionals (useLLVM && haveLibc && stdenv.cc.libcxx == libcxx) [ + ] ++ lib.optionals (stdenv.hostPlatform.cxxlib == "libcxx" && haveLibc && stdenv.cc.libcxx == libcxx && !stdenv.hostPlatform.isDarwin) [ "-DSANITIZER_CXX_ABI=libcxxabi" "-DSANITIZER_CXX_ABI_LIBNAME=libcxxabi" "-DCOMPILER_RT_USE_BUILTINS_LIBRARY=ON" ] ++ lib.optionals ((!haveLibc || bareMetal || isMusl || isAarch64) && (lib.versions.major release_version == "13")) [ "-DCOMPILER_RT_BUILD_LIBFUZZER=OFF" - ] ++ lib.optionals (useLLVM && haveLibc) [ + ] ++ lib.optionals (stdenv.hostPlatform.rtlib == "compiler-rt" && haveLibc && !stdenv.hostPlatform.isDarwin) [ "-DCOMPILER_RT_BUILD_SANITIZERS=ON" ] ++ lib.optionals (noSanitizers) [ "-DCOMPILER_RT_BUILD_SANITIZERS=OFF" - ] ++ lib.optionals ((useLLVM && !haveLibcxx) || !haveLibc || bareMetal || isMusl || isDarwinStatic) [ + ] ++ lib.optionals ((stdenv.hostPlatform.rtlib == "compiler-rt" && !haveLibcxx) || !haveLibc || bareMetal || isMusl || isDarwinStatic) [ "-DCOMPILER_RT_BUILD_XRAY=OFF" "-DCOMPILER_RT_BUILD_LIBFUZZER=OFF" "-DCOMPILER_RT_BUILD_MEMPROF=OFF" "-DCOMPILER_RT_BUILD_ORC=OFF" # may be possible to build with musl if necessary - ] ++ lib.optionals (useLLVM && haveLibc) [ + ] ++ lib.optionals (stdenv.hostPlatform.rtlib == "compiler-rt" && haveLibc && !stdenv.hostPlatform.isDarwin) [ "-DCOMPILER_RT_BUILD_PROFILE=ON" ] ++ lib.optionals (!haveLibc || bareMetal) [ "-DCOMPILER_RT_BUILD_PROFILE=OFF" @@ -119,7 +118,7 @@ stdenv.mkDerivation { "-DCMAKE_SIZEOF_VOID_P=${toString (stdenv.hostPlatform.parsed.cpu.bits / 8)}" ] ++ lib.optionals (!haveLibc) [ "-DCMAKE_C_FLAGS=-nodefaultlibs" - ] ++ lib.optionals (useLLVM) [ + ] ++ lib.optionals (stdenv.hostPlatform.rtlib == "compiler-rt" && !stdenv.hostPlatform.isDarwin) [ "-DCOMPILER_RT_BUILD_BUILTINS=ON" #https://stackoverflow.com/questions/53633705/cmake-the-c-compiler-is-not-able-to-compile-a-simple-test-program "-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY" @@ -191,7 +190,7 @@ stdenv.mkDerivation { # Hack around weird upsream RPATH bug postInstall = lib.optionalString (stdenv.hostPlatform.isDarwin) '' ln -s "$out/lib"/*/* "$out/lib" - '' + lib.optionalString (useLLVM && stdenv.hostPlatform.isLinux) '' + '' + lib.optionalString (stdenv.hostPlatform.rtlib == "compiler-rt" && stdenv.hostPlatform.isLinux) '' ln -s $out/lib/*/clang_rt.crtbegin-*.o $out/lib/crtbegin.o ln -s $out/lib/*/clang_rt.crtend-*.o $out/lib/crtend.o # Note the history of crt{begin,end}S in previous versions of llvm in nixpkg: diff --git a/pkgs/development/compilers/llvm/common/default.nix b/pkgs/development/compilers/llvm/common/default.nix index 27e7e05e4d1c5..86332ff1e41a5 100644 --- a/pkgs/development/compilers/llvm/common/default.nix +++ b/pkgs/development/compilers/llvm/common/default.nix @@ -629,7 +629,7 @@ let clang = if stdenv.targetPlatform.libc == null then tools.clangNoLibc - else if stdenv.targetPlatform.useLLVM or false then + else if stdenv.targetPlatform.cc == "clang" && stdenv.targetPlatform.cxxlib == "libcxx" && stdenv.targetPlatform.bintools == "llvm" && stdenv.targetPlatform.rtlib == "compiler-rt" && !stdenv.targetPlatform.isDarwin then tools.clangUseLLVM else if (pkgs.targetPackages.stdenv or args.stdenv).cc.isGNU then tools.libstdcxxClang @@ -781,7 +781,7 @@ let echo "--unwindlib=libunwind" >> $out/nix-support/cc-cflags echo "-L${targetLlvmLibraries.libunwind}/lib" >> $out/nix-support/cc-ldflags '' - + lib.optionalString (!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false) '' + + lib.optionalString (!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.unwinderlib == "libunwind") '' echo "-lunwind" >> $out/nix-support/cc-ldflags '' + lib.optionalString stdenv.targetPlatform.isWasm '' @@ -803,7 +803,7 @@ let ++ lib.optional ( !stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD - && stdenv.targetPlatform.useLLVM or false + && stdenv.targetPlatform.unwinderlib == "libunwind" ) "-lunwind" ++ lib.optional stdenv.targetPlatform.isWasm "-fno-exceptions"; nixSupport.cc-ldflags = lib.optionals ( @@ -836,7 +836,7 @@ let echo "--unwindlib=libunwind" >> $out/nix-support/cc-cflags echo "-L${targetLlvmLibraries.libunwind}/lib" >> $out/nix-support/cc-ldflags '' - + lib.optionalString (!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false) '' + + lib.optionalString (!stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isDarwin && stdenv.targetPlatform.unwinderlib == "libunwind") '' echo "-lunwind" >> $out/nix-support/cc-ldflags '' + lib.optionalString stdenv.targetPlatform.isWasm '' @@ -858,7 +858,8 @@ let ++ lib.optional ( !stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD - && stdenv.targetPlatform.useLLVM or false + && !stdenv.targetPlatform.isDarwin + && stdenv.targetPlatform.unwinderlib == "libunwind" ) "-lunwind" ++ lib.optional stdenv.targetPlatform.isWasm "-fno-exceptions"; nixSupport.cc-ldflags = lib.optionals ( @@ -1084,7 +1085,7 @@ let # Darwin needs to use a bootstrap stdenv to avoid an infinite recursion when cross-compiling. if args.stdenv.hostPlatform.isDarwin then overrideCC darwin.bootstrapStdenv buildLlvmTools.clangWithLibcAndBasicRtAndLibcxx - else if args.stdenv.hostPlatform.useLLVM or false then + else if args.stdenv.hostPlatform.rtlib == "compiler-rt" && args.stdenv.hostPlatform.cxxlib == "libcxx" then overrideCC args.stdenv buildLlvmTools.clangWithLibcAndBasicRtAndLibcxx else args.stdenv; @@ -1093,7 +1094,7 @@ let patches = compiler-rtPatches; inherit stdenv; } - // lib.optionalAttrs (stdenv.hostPlatform.useLLVM or false) { + // lib.optionalAttrs (stdenv.hostPlatform.rtlib == "compiler-rt") { libxcrypt = (libxcrypt.override { inherit stdenv; }).overrideAttrs (old: { configureFlags = old.configureFlags ++ [ "--disable-symvers" ]; }); @@ -1102,7 +1103,7 @@ let compiler-rt-no-libc = callPackage ./compiler-rt { patches = compiler-rtPatches; - doFakeLibgcc = stdenv.hostPlatform.useLLVM or false; + doFakeLibgcc = stdenv.hostPlatform.rtlib == "compiler-rt" && !stdenv.hostPlatform.isDarwin; stdenv = # Darwin needs to use a bootstrap stdenv to avoid an infinite recursion when cross-compiling. if stdenv.hostPlatform.isDarwin then diff --git a/pkgs/development/compilers/llvm/common/libcxx/default.nix b/pkgs/development/compilers/llvm/common/libcxx/default.nix index c4ada0bf669be..64c471d37b14f 100644 --- a/pkgs/development/compilers/llvm/common/libcxx/default.nix +++ b/pkgs/development/compilers/llvm/common/libcxx/default.nix @@ -30,9 +30,6 @@ let cxxabiName = "lib${if cxxabi == null then "cxxabi" else cxxabi.libName}"; runtimes = [ "libcxx" ] ++ lib.optional (cxxabi == null) "libcxxabi"; - # Note: useLLVM is likely false for Darwin but true under pkgsLLVM - useLLVM = stdenv.hostPlatform.useLLVM or false; - src' = if monorepoSrc != null then runCommand "${pname}-src-${version}" { inherit (monorepoSrc) passthru; } ('' mkdir -p "$out/llvm" @@ -54,7 +51,7 @@ let cxxabiCMakeFlags = lib.optionals (lib.versionAtLeast release_version "18") [ "-DLIBCXXABI_USE_LLVM_UNWINDER=OFF" - ] ++ lib.optionals (useLLVM && !stdenv.hostPlatform.isWasm) (if lib.versionAtLeast release_version "18" then [ + ] ++ lib.optionals (stdenv.hostPlatform.unwinderlib == "libunwind" && !stdenv.hostPlatform.isWasm && !stdenv.hostPlatform.isDarwin) (if lib.versionAtLeast release_version "18" then [ "-DLIBCXXABI_ADDITIONAL_LIBRARIES=unwind" "-DLIBCXXABI_USE_COMPILER_RT=ON" ] else [ @@ -80,15 +77,15 @@ let "-DLIBCXX_CXX_ABI_INCLUDE_PATHS=${lib.getDev cxxabi}/include" ] ++ lib.optionals (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) [ "-DLIBCXX_HAS_MUSL_LIBC=1" - ] ++ lib.optionals (lib.versionAtLeast release_version "18" && !useLLVM && stdenv.hostPlatform.libc == "glibc" && !stdenv.hostPlatform.isStatic) [ + ] ++ lib.optionals (lib.versionAtLeast release_version "18" && stdenv.hostPlatform.unwinderlib == "libgcc_s" && stdenv.hostPlatform.libc == "glibc" && !stdenv.hostPlatform.isStatic && !stdenv.hostPlatform.isDarwin) [ "-DLIBCXX_ADDITIONAL_LIBRARIES=gcc_s" ] ++ lib.optionals (lib.versionAtLeast release_version "18" && stdenv.hostPlatform.isFreeBSD) [ # Name and documentation claim this is for libc++abi, but its man effect is adding `-lunwind` # to the libc++.so linker script. We want FreeBSD's so-called libgcc instead of libunwind. "-DLIBCXXABI_USE_LLVM_UNWINDER=OFF" - ] ++ lib.optionals useLLVM [ + ] ++ lib.optionals (stdenv.hostPlatform.rtlib == "compiler-rt" && !stdenv.hostPlatform.isDarwin) [ "-DLIBCXX_USE_COMPILER_RT=ON" - ] ++ lib.optionals (useLLVM && !stdenv.hostPlatform.isFreeBSD && lib.versionAtLeast release_version "16") [ + ] ++ lib.optionals (stdenv.hostPlatform.rtlib == "compiler-rt" && !stdenv.hostPlatform.isFreeBSD && !stdenv.hostPlatform.isDarwin && lib.versionAtLeast release_version "16") [ "-DLIBCXX_ADDITIONAL_LIBRARIES=unwind" ] ++ lib.optionals stdenv.hostPlatform.isWasm [ "-DLIBCXX_ENABLE_THREADS=OFF" @@ -135,7 +132,7 @@ stdenv.mkDerivation (rec { ++ lib.optional (cxxabi != null) lndir; buildInputs = [ cxxabi ] - ++ lib.optionals (useLLVM && !stdenv.hostPlatform.isWasm && !stdenv.hostPlatform.isFreeBSD) [ libunwind ]; + ++ lib.optionals (stdenv.hostPlatform.unwinderlib == "libunwind" && !stdenv.hostPlatform.isWasm && !stdenv.hostPlatform.isFreeBSD && !stdenv.hostPlatform.isDarwin) [ libunwind ]; # libc++.so is a linker script which expands to multiple libraries, # libc++.so.1 and libc++abi.so or the external cxxabi. ld-wrapper doesn't diff --git a/pkgs/development/compilers/rust/1_83.nix b/pkgs/development/compilers/rust/1_83.nix index 8232079a2adcd..9d9f55fcd5309 100644 --- a/pkgs/development/compilers/rust/1_83.nix +++ b/pkgs/development/compilers/rust/1_83.nix @@ -36,13 +36,27 @@ let { enableSharedLibraries = true; } - // lib.optionalAttrs (stdenv.targetPlatform.useLLVM or false) { - # Force LLVM to compile using clang + LLVM libs when targeting pkgsLLVM - stdenv = pkgSet.stdenv.override { - allowedRequisites = null; - cc = pkgSet.pkgsBuildHost.llvmPackages_19.clangUseLLVM; - }; - } + // + lib.optionalAttrs + ( + stdenv.targetPlatform.cc == "clang" + && stdenv.targetPlatform.cxxlib == "libcxx" + && stdenv.targetPlatform.rtlib == "compiler-rt" + && stdenv.targetPlatform.unwinderlib == "libunwind" + && !( + stdenv.buildPlatform.cc == "clang" + && stdenv.buildPlatform.cxxlib == "libcxx" + && stdenv.buildPlatform.rtlib == "compiler-rt" + && stdenv.buildPlatform.unwinderlib == "libunwind" + ) + ) + { + # Force LLVM to compile using clang + LLVM libs when targeting pkgsLLVM + stdenv = pkgSet.stdenv.override { + allowedRequisites = null; + cc = pkgSet.pkgsBuildHost.llvmPackages_19.clangUseLLVM; + }; + } ); in import ./default.nix @@ -59,7 +73,20 @@ import ./default.nix # Expose llvmPackages used for rustc from rustc via passthru for LTO in Firefox llvmPackages = - if (stdenv.targetPlatform.useLLVM or false) then + if + ( + stdenv.targetPlatform.cc == "clang" + && stdenv.targetPlatform.cxxlib == "libcxx" + && stdenv.targetPlatform.rtlib == "compiler-rt" + && stdenv.targetPlatform.unwinderlib == "libunwind" + && !( + stdenv.buildPlatform.cc == "clang" + && stdenv.buildPlatform.cxxlib == "libcxx" + && stdenv.buildPlatform.rtlib == "compiler-rt" + && stdenv.buildPlatform.unwinderlib == "libunwind" + ) + ) + then callPackage ( { pkgs, @@ -89,6 +116,7 @@ import ./default.nix allowedRequisites = null; cc = pkgsBuildHost.llvmPackages_19.clangNoLibcxx; hostPlatform = stdenv.hostPlatform // { + # TODO: replace once "useLLVM" is fully dropped useLLVM = !stdenv.hostPlatform.isDarwin; }; }; diff --git a/pkgs/development/compilers/rust/rustc.nix b/pkgs/development/compilers/rust/rustc.nix index af287fcc9079d..589b23e6a8aa6 100644 --- a/pkgs/development/compilers/rust/rustc.nix +++ b/pkgs/development/compilers/rust/rustc.nix @@ -52,7 +52,6 @@ let concatStringsSep ; inherit (darwin.apple_sdk.frameworks) Security; - useLLVM = stdenv.targetPlatform.useLLVM or false; in stdenv.mkDerivation (finalAttrs: { pname = "${targetPackages.stdenv.cc.targetPrefix}rustc"; @@ -97,11 +96,19 @@ stdenv.mkDerivation (finalAttrs: { # This doesn't apply to cross-building for FreeBSD because the host # uses libstdc++, but the target (used for building std) uses libc++ optional ( - stdenv.hostPlatform.isLinux && !withBundledLLVM && !stdenv.targetPlatform.isFreeBSD && !useLLVM + stdenv.targetPlatform.isLinux + && !withBundledLLVM + && !stdenv.targetPlatform.isFreeBSD + && stdenv.targetPlatform.cxxlib == "libstdcxx" ) "--push-state --as-needed -lstdc++ --pop-state" ++ optional - (stdenv.hostPlatform.isLinux && !withBundledLLVM && !stdenv.targetPlatform.isFreeBSD && useLLVM) + ( + stdenv.targetPlatform.isLinux + && !withBundledLLVM + && !stdenv.targetPlatform.isFreeBSD + && stdenv.targetPlatform.cxxlib == "libcxx" + ) "--push-state --as-needed -L${llvmPackages.libcxx}/lib -lc++ -lc++abi -lLLVM-${lib.versions.major llvmPackages.llvm.version} --pop-state" ++ optional (stdenv.hostPlatform.isDarwin && !withBundledLLVM) "-lc++ -lc++abi" ++ optional stdenv.hostPlatform.isFreeBSD "-rpath ${llvmPackages.libunwind}/lib" @@ -207,7 +214,7 @@ stdenv.mkDerivation (finalAttrs: { # doesn't work) to build a linker. "--disable-llvm-bitcode-linker" ] - ++ optionals (stdenv.targetPlatform.isLinux && !(stdenv.targetPlatform.useLLVM or false)) [ + ++ optionals (stdenv.targetPlatform.isLinux) [ "--enable-profiler" # build libprofiler_builtins ] ++ optionals stdenv.buildPlatform.isMusl [ @@ -226,11 +233,18 @@ stdenv.mkDerivation (finalAttrs: { # https://github.com/rust-lang/rust/issues/92173 "--set rust.jemalloc" ] - ++ optionals (useLLVM && !stdenv.targetPlatform.isFreeBSD) [ - # https://github.com/NixOS/nixpkgs/issues/311930 - "--llvm-libunwind=${if withBundledLLVM then "in-tree" else "system"}" - "--enable-use-libcxx" - ]; + ++ + optionals + ( + stdenv.targetPlatform.unwinderlib == "libunwind" + && !stdenv.targetPlatform.isFreeBSD + && !stdenv.targetPlatform.isDarwin + ) + [ + # https://github.com/NixOS/nixpkgs/issues/311930 + "--llvm-libunwind=${if withBundledLLVM then "in-tree" else "system"}" + "--enable-use-libcxx" + ]; # if we already have a rust compiler for build just compile the target std # library and reuse compiler @@ -353,15 +367,23 @@ stdenv.mkDerivation (finalAttrs: { zlib ] ++ optional (!withBundledLLVM) llvmShared.lib - ++ optional (useLLVM && !withBundledLLVM && !stdenv.targetPlatform.isFreeBSD) [ - llvmPackages.libunwind - # Hack which is used upstream https://github.com/gentoo/gentoo/blob/master/dev-lang/rust/rust-1.78.0.ebuild#L284 - (runCommandLocal "libunwind-libgcc" { } '' - mkdir -p $out/lib - ln -s ${llvmPackages.libunwind}/lib/libunwind.so $out/lib/libgcc_s.so - ln -s ${llvmPackages.libunwind}/lib/libunwind.so $out/lib/libgcc_s.so.1 - '') - ]; + ++ + optional + ( + stdenv.targetPlatform.unwinderlib == "libunwind" + && !withBundledLLVM + && !stdenv.targetPlatform.isFreeBSD + && !stdenv.targetPlatform.isDarwin + ) + [ + llvmPackages.libunwind + # Hack which is used upstream https://github.com/gentoo/gentoo/blob/master/dev-lang/rust/rust-1.78.0.ebuild#L284 + (runCommandLocal "libunwind-libgcc" { } '' + mkdir -p $out/lib + ln -s ${llvmPackages.libunwind}/lib/libunwind.so $out/lib/libgcc_s.so + ln -s ${llvmPackages.libunwind}/lib/libunwind.so $out/lib/libgcc_s.so.1 + '') + ]; outputs = [ "out" diff --git a/pkgs/development/libraries/kerberos/krb5.nix b/pkgs/development/libraries/kerberos/krb5.nix index 7a4df60f0ae5b..ca6421345e0fe 100644 --- a/pkgs/development/libraries/kerberos/krb5.nix +++ b/pkgs/development/libraries/kerberos/krb5.nix @@ -86,11 +86,7 @@ stdenv.mkDerivation rec { buildInputs = [ openssl ] - ++ lib.optionals ( - stdenv.hostPlatform.isLinux - && stdenv.hostPlatform.libc != "bionic" - && !(stdenv.hostPlatform.useLLVM or false) - ) [ keyutils ] + ++ lib.optionals (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.libc != "bionic") [ keyutils ] ++ lib.optionals withLdap [ openldap ] ++ lib.optionals withLibedit [ libedit ] ++ lib.optionals withVerto [ libverto ]; diff --git a/pkgs/development/libraries/libunwind/default.nix b/pkgs/development/libraries/libunwind/default.nix index f0f7de192f448..687297a1121bc 100644 --- a/pkgs/development/libraries/libunwind/default.nix +++ b/pkgs/development/libraries/libunwind/default.nix @@ -20,7 +20,7 @@ stdenv.mkDerivation (finalAttrs: { hash = "sha256-rCFBHs6rCSnp5FEwbUR5veNNTqSQpFblAv8ebSPX0qE="; }; - patches = lib.optional (stdenv.targetPlatform.useLLVM or false) (fetchpatch { + patches = lib.optional (stdenv.cc.isClang && !stdenv.hostPlatform.isDarwin) (fetchpatch { url = "https://github.com/libunwind/libunwind/pull/770/commits/a69d0f14c9e6c46e82ba6e02fcdedb2eb63b7f7f.patch"; hash = "sha256-9oBZimCXonNN++jJs3emp9w+q1aj3eNzvSKPgh92itA="; }); diff --git a/pkgs/development/libraries/libva/default.nix b/pkgs/development/libraries/libva/default.nix index 9fd523a70610c..667c03e8a5aed 100644 --- a/pkgs/development/libraries/libva/default.nix +++ b/pkgs/development/libraries/libva/default.nix @@ -69,7 +69,7 @@ stdenv.mkDerivation (finalAttrs: { { NIX_LDFLAGS = "--undefined-version"; } - // lib.optionalAttrs (stdenv.targetPlatform.useLLVM or false) { + // lib.optionalAttrs (stdenv.cc.isClang && !stdenv.hostPlatform.isDarwin) { NIX_CFLAGS_COMPILE = "-DHAVE_SECURE_GETENV"; }; diff --git a/pkgs/development/libraries/openssl/default.nix b/pkgs/development/libraries/openssl/default.nix index f0cf68f8b6aa6..f6022fb2258a4 100644 --- a/pkgs/development/libraries/openssl/default.nix +++ b/pkgs/development/libraries/openssl/default.nix @@ -98,7 +98,8 @@ let ++ lib.optional static "etc"; setOutputFlags = false; separateDebugInfo = - !stdenv.hostPlatform.isDarwin && !(stdenv.hostPlatform.useLLVM or false) && stdenv.cc.isGNU; + # Using "cc.isClang" causes infinite recursion. + !stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.cc != "clang" && stdenv.cc.isGNU; nativeBuildInputs = lib.optional (!stdenv.hostPlatform.isWindows) makeBinaryWrapper diff --git a/pkgs/development/libraries/quictls/default.nix b/pkgs/development/libraries/quictls/default.nix index 63ddc6313d6a7..55044aabc1b01 100644 --- a/pkgs/development/libraries/quictls/default.nix +++ b/pkgs/development/libraries/quictls/default.nix @@ -64,7 +64,7 @@ stdenv.mkDerivation rec { separateDebugInfo = !stdenv.hostPlatform.isDarwin && - !(stdenv.hostPlatform.useLLVM or false) && + !stdenv.cc.isClang && stdenv.cc.isGNU; # TODO(@Ericson2314): Improve with mass rebuild diff --git a/pkgs/development/libraries/silgraphite/graphite2.nix b/pkgs/development/libraries/silgraphite/graphite2.nix index 7289820b60df1..54a6d00b6e900 100644 --- a/pkgs/development/libraries/silgraphite/graphite2.nix +++ b/pkgs/development/libraries/silgraphite/graphite2.nix @@ -32,7 +32,7 @@ stdenv.mkDerivation (finalAttrs: { ]; buildInputs = [ freetype ] - ++ lib.optional (stdenv.targetPlatform.useLLVM or false) ( + ++ lib.optional (stdenv.hostPlatform.rtlib == "compiler-rt" && !stdenv.hostPlatform.isDarwin) ( llvmPackages.compiler-rt.override { doFakeLibgcc = true; } diff --git a/pkgs/development/python-modules/jedi/default.nix b/pkgs/development/python-modules/jedi/default.nix index 8e31fe41c7805..49792d7577426 100644 --- a/pkgs/development/python-modules/jedi/default.nix +++ b/pkgs/development/python-modules/jedi/default.nix @@ -49,7 +49,11 @@ buildPythonPackage rec { # sensitive to platform, causes false negatives on darwin "test_import" ] - ++ lib.optionals (stdenv.targetPlatform.useLLVM or false) [ + ++ lib.optionals (stdenv.hostPlatform.isAarch64 && pythonOlder "3.9") [ + # AssertionError: assert 'foo' in ['setup'] + "test_init_extension_module" + ] + ++ lib.optionals (stdenv.cc.isClang && !stdenv.hostPlatform.isDarwin) [ # InvalidPythonEnvironment: The python binary is potentially unsafe. "test_create_environment_executable" # AssertionError: assert ['', '.1000000000000001'] == ['', '.1'] diff --git a/pkgs/development/python-modules/mako/default.nix b/pkgs/development/python-modules/mako/default.nix index 0735cf8f2c9e7..d8eea81246b9b 100644 --- a/pkgs/development/python-modules/mako/default.nix +++ b/pkgs/development/python-modules/mako/default.nix @@ -61,7 +61,7 @@ buildPythonPackage rec { "test_bytestring_passthru" ] # https://github.com/sqlalchemy/mako/issues/408 - ++ lib.optional (stdenv.targetPlatform.useLLVM or false) "test_future_import"; + ++ lib.optional (stdenv.cc.isClang && !stdenv.hostPlatform.isDarwin) "test_future_import"; meta = with lib; { description = "Super-fast templating language"; diff --git a/pkgs/os-specific/linux/systemd/default.nix b/pkgs/os-specific/linux/systemd/default.nix index 59ecbb865ef9b..2fad6b0fae9da 100644 --- a/pkgs/os-specific/linux/systemd/default.nix +++ b/pkgs/os-specific/linux/systemd/default.nix @@ -411,7 +411,7 @@ stdenv.mkDerivation (finalAttrs: { ++ lib.optionals withPasswordQuality [ libpwquality ] ++ lib.optionals withQrencode [ qrencode ] ++ lib.optionals withLibarchive [ libarchive ] - ++ lib.optional (withBootloader && stdenv.targetPlatform.useLLVM or false) ( + ++ lib.optional (withBootloader && stdenv.targetPlatform.rtlib == "compiler-rt") ( llvmPackages.compiler-rt.override { doFakeLibgcc = true; } diff --git a/pkgs/os-specific/windows/default.nix b/pkgs/os-specific/windows/default.nix index 59806318a23ec..42ab0c9d75c8f 100644 --- a/pkgs/os-specific/windows/default.nix +++ b/pkgs/os-specific/windows/default.nix @@ -26,7 +26,7 @@ lib.makeScope newScope ( # FIXME untested with llvmPackages_16 was using llvmPackages_8 crossThreadsStdenv = overrideCC stdenvNoLibc ( - if stdenv.hostPlatform.useLLVM or false then + if stdenv.cc.isClang then buildPackages.llvmPackages.clangNoLibcxx else buildPackages.gccWithoutTargetLibc.override (old: { diff --git a/pkgs/servers/x11/xorg/overrides.nix b/pkgs/servers/x11/xorg/overrides.nix index 05ad31a0c1c66..dfe91a4313a4f 100644 --- a/pkgs/servers/x11/xorg/overrides.nix +++ b/pkgs/servers/x11/xorg/overrides.nix @@ -159,7 +159,7 @@ self: super: ]; configureFlags = attrs.configureFlags or [] ++ malloc0ReturnsNullCrossFlag - ++ lib.optional (stdenv.targetPlatform.useLLVM or false) "ac_cv_path_RAWCPP=cpp"; + ++ lib.optional (stdenv.cc.isClang && !stdenv.hostPlatform.isDarwin) "ac_cv_path_RAWCPP=cpp"; depsBuildBuild = [ buildPackages.stdenv.cc ] ++ lib.optionals stdenv.hostPlatform.isStatic [ @@ -269,7 +269,7 @@ self: super: ''; configureFlags = attrs.configureFlags or [] ++ malloc0ReturnsNullCrossFlag - ++ lib.optional (stdenv.targetPlatform.useLLVM or false) "ac_cv_path_RAWCPP=cpp"; + ++ lib.optional (stdenv.cc.isClang && !stdenv.hostPlatform.isDarwin) "ac_cv_path_RAWCPP=cpp"; propagatedBuildInputs = attrs.propagatedBuildInputs or [] ++ [ xorg.libSM ]; depsBuildBuild = [ buildPackages.stdenv.cc ]; CPP = if stdenv.hostPlatform.isDarwin then "clang -E -" else "${stdenv.cc.targetPrefix}cc -E -"; diff --git a/pkgs/stdenv/cross/default.nix b/pkgs/stdenv/cross/default.nix index 69ea14be5c83d..7fdfcdfcedb35 100644 --- a/pkgs/stdenv/cross/default.nix +++ b/pkgs/stdenv/cross/default.nix @@ -118,14 +118,16 @@ lib.init bootStages throw "no C compiler provided for this platform" else if crossSystem.isDarwin then buildPackages.llvmPackages.libcxxClang - else if crossSystem.useLLVM or false then + else if crossSystem.cc == "clang" then buildPackages.llvmPackages.clang - else if crossSystem.useZig or false then + else if crossSystem.cc == "zig" then buildPackages.zig.cc - else if crossSystem.useArocc or false then + else if crossSystem.cc == "arocc" then buildPackages.arocc + else if crossSystem.cc == "gcc" then + buildPackages.gcc else - buildPackages.gcc; + throw "no C compiler provided for this platform"; }; in diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index a21f709c36bfa..817713189dd63 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -61,7 +61,7 @@ with pkgs; # thing to to create an earlier thing (leading to infinite recursion) and # we also would still respect the stage arguments choices for these # things. - (if stdenvNoCC.hostPlatform.isDarwin || stdenvNoCC.hostPlatform.useLLVM or false + (if stdenvNoCC.hostPlatform.cc == "clang" then overrideCC stdenvNoCC buildPackages.llvmPackages.clangNoCompilerRt else gccCrossLibcStdenv) else mkStdenvNoLibs stdenv; @@ -69,7 +69,7 @@ with pkgs; stdenvNoLibc = if stdenvNoCC.hostPlatform != stdenvNoCC.buildPlatform then - (if stdenvNoCC.hostPlatform.isDarwin || stdenvNoCC.hostPlatform.useLLVM or false + (if stdenvNoCC.hostPlatform.cc == "clang" then overrideCC stdenvNoCC buildPackages.llvmPackages.clangNoLibc else gccCrossLibcStdenv) else mkStdenvNoLibs stdenv; @@ -5951,7 +5951,7 @@ with pkgs; # temporarily disabled due to breakage; # see https://github.com/NixOS/nixpkgs/pull/243249 && !stdenv.targetPlatform.isWindows - && !(stdenv.targetPlatform.useLLVM or false) + && !(stdenv.targetPlatform.cc == "clang" && stdenv.targetPlatform.cxxlib == "libcxx") ; }; bintools = binutilsNoLibc; @@ -7711,11 +7711,13 @@ with pkgs; # In other words, try to only use this in wrappers, and only use those # wrappers from the next stage. bintools-unwrapped = let - inherit (stdenv.targetPlatform) linker; - in if linker == "lld" then llvmPackages.bintools-unwrapped - else if linker == "cctools" then darwin.binutils-unwrapped - else if linker == "bfd" then binutils-unwrapped - else if linker == "gold" then binutils-unwrapped.override { enableGoldDefault = true; } + # We should remove the linker inherit and solely go off of bintools in the future. + # The linker should be specified inside package build systems (cmake, meson, etc). + inherit (stdenv.targetPlatform) linker bintools; + in if linker == "lld" || (bintools == "llvm" && linker != "cctools") then llvmPackages.bintools-unwrapped + else if linker == "cctools" then darwin.binutils-unwrapped + else if linker == "bfd" || bintools == "gnu" then binutils-unwrapped + else if linker == "gold" then binutils-unwrapped.override { enableGoldDefault = true; } else null; bintoolsNoLibc = wrapBintoolsWith { bintools = bintools-unwrapped; @@ -9028,7 +9030,13 @@ with pkgs; else libcCrossChooser stdenv.targetPlatform.libc; threadsCross = - lib.optionalAttrs (stdenv.targetPlatform.isMinGW && !(stdenv.targetPlatform.useLLVM or false)) { + lib.optionalAttrs ( + stdenv.targetPlatform.isMinGW + && !(stdenv.targetPlatform.cc == "clang" + && stdenv.targetPlatform.cxxlib == "libcxx" + && stdenv.targetPlatform.rtlib == "compiler-rt" + && stdenv.targetPlatform.unwinderlib == "libunwind") + ) { # other possible values: win32 or posix model = "mcf"; # For win32 or posix set this to null @@ -9494,7 +9502,7 @@ with pkgs; libcomps = callPackage ../tools/package-management/libcomps { python = python3; }; libcxxrt = callPackage ../development/libraries/libcxxrt { - stdenv = if stdenv.hostPlatform.useLLVM or false + stdenv = if stdenv.hostPlatform.cxxlib == "libcxx" && !stdenv.hostPlatform.isDarwin then overrideCC stdenv buildPackages.llvmPackages.tools.clangNoLibcxx else stdenv; }; @@ -11989,7 +11997,7 @@ with pkgs; busybox = callPackage ../os-specific/linux/busybox { # Fixes libunwind from being dynamically linked to a static binary. - stdenv = if (stdenv.targetPlatform.useLLVM or false) then + stdenv = if stdenv.cc.isClang && stdenv.hostPlatform.unwinderlib == "libunwind" then overrideCC stdenv buildPackages.llvmPackages.clangNoLibcxx else stdenv; }; diff --git a/pkgs/top-level/stage.nix b/pkgs/top-level/stage.nix index 64bc2308f6da7..c8829b6de945b 100644 --- a/pkgs/top-level/stage.nix +++ b/pkgs/top-level/stage.nix @@ -122,6 +122,9 @@ let inherit (self.pkgsBuildHost.xorg) lndir; }; + cleanToolchain = platform: builtins.removeAttrs platform + [ "toolchain" "cc" "bintools" "linker" "libc" "cxxlib" "unwinderlib" "rtlib" ]; + stdenvBootstappingAndPlatforms = self: super: let withFallback = thisPkgs: (if adjacentPackages == null then self else thisPkgs) @@ -205,7 +208,7 @@ let # Bootstrap a cross stdenv using the LLVM toolchain. # This is currently not possible when compiling natively, # so we don't need to check hostPlatform != buildPlatform. - crossSystem = stdenv.hostPlatform // { + crossSystem = (cleanToolchain stdenv.hostPlatform) // { useLLVM = true; linker = "lld"; }; @@ -233,8 +236,9 @@ let # Bootstrap a cross stdenv using the Aro C compiler. # This is currently not possible when compiling natively, # so we don't need to check hostPlatform != buildPlatform. - crossSystem = stdenv.hostPlatform // { - useArocc = true; + crossSystem = (cleanToolchain stdenv.hostPlatform) // { + toolchain = "llvm"; + cc = "arocc"; linker = "lld"; }; }; @@ -248,8 +252,9 @@ let # Bootstrap a cross stdenv using the Zig toolchain. # This is currently not possible when compiling natively, # so we don't need to check hostPlatform != buildPlatform. - crossSystem = stdenv.hostPlatform // { - useZig = true; + crossSystem = (cleanToolchain stdenv.hostPlatform) // { + toolchain = "llvm"; + cc = "zig"; linker = "lld"; }; };