rustc: fix pkgsLLVM

Fixes `libunwind` from not being included due to improper usage of
`lib.optional` by passing a list instead of a single item. Drops the
hack for `llvmPackages` since just passing it through works now.

Changed files
+2 -54
pkgs
development
compilers
+1 -44
pkgs/development/compilers/rust/1_89.nix
···
llvmShared = llvmSharedFor pkgsHostTarget;
# Expose llvmPackages used for rustc from rustc via passthru for LTO in Firefox
-
llvmPackages =
-
if (stdenv.targetPlatform.useLLVM or false) then
-
callPackage (
-
{
-
pkgs,
-
bootBintoolsNoLibc ? if stdenv.targetPlatform.linker == "lld" then null else pkgs.bintoolsNoLibc,
-
bootBintools ? if stdenv.targetPlatform.linker == "lld" then null else pkgs.bintools,
-
}:
-
let
-
llvmPackages = llvmPackages_20;
-
-
setStdenv =
-
pkg:
-
pkg.override {
-
stdenv = stdenv.override {
-
allowedRequisites = null;
-
cc = pkgsBuildHost.llvmPackages_20.clangUseLLVM;
-
};
-
};
-
in
-
rec {
-
inherit (llvmPackages) bintools;
-
-
libunwind = setStdenv llvmPackages.libunwind;
-
llvm = setStdenv llvmPackages.llvm;
-
-
libcxx = llvmPackages.libcxx.override {
-
stdenv = stdenv.override {
-
allowedRequisites = null;
-
cc = pkgsBuildHost.llvmPackages_20.clangNoLibcxx;
-
hostPlatform = stdenv.hostPlatform // {
-
useLLVM = !stdenv.hostPlatform.isDarwin;
-
};
-
};
-
inherit libunwind;
-
};
-
-
clangUseLLVM = llvmPackages.clangUseLLVM.override { inherit libcxx; };
-
-
stdenv = overrideCC args.stdenv clangUseLLVM;
-
}
-
) { }
-
else
-
llvmPackages_20;
+
llvmPackages = llvmPackages_20;
# Note: the version MUST be the same version that we are building. Upstream
# ensures that each released compiler can compile itself:
+1 -10
pkgs/development/compilers/rust/rustc.nix
···
(stdenv.hostPlatform.isLinux && !withBundledLLVM && !stdenv.targetPlatform.isFreeBSD && useLLVM)
"--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"
++ optional stdenv.hostPlatform.isDarwin "-rpath ${llvmSharedForHost.lib}/lib"
);
···
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 (useLLVM && !withBundledLLVM) llvmPackages.libunwind;
outputs = [
"out"