rustc: Expose llvmPackages set used to build rustc

Reusing the same llvmPackages version used for building rustc is
required for LTO in Firefox.
This commit is contained in:
Martin Weinelt 2021-11-02 17:34:05 +01:00
parent 3f9b49e0ec
commit c28e3f9d00
No known key found for this signature in database
GPG Key ID: 87C1E9888F856759
3 changed files with 10 additions and 3 deletions

View File

@ -32,6 +32,9 @@ import ./default.nix {
# For use at runtime
llvmShared = llvm_12.override { enableSharedLibraries = true; };
# Expose llvmPackages used for rustc from rustc via passthru for LTO in Firefox
llvmPackagesForBuild = pkgsBuildBuild.llvmPackages_12;
# Note: the version MUST be one version prior to the version we're
# building
bootstrapVersion = "1.54.0";

View File

@ -10,6 +10,7 @@
, llvmSharedForBuild
, llvmSharedForHost
, llvmSharedForTarget
, llvmPackagesForBuild # Exposed through rustc for LTO in Firefox
}:
{ stdenv, lib
, buildPackages
@ -85,7 +86,7 @@
version = rustcVersion;
sha256 = rustcSha256;
inherit enableRustcDev;
inherit llvmShared llvmSharedForBuild llvmSharedForHost llvmSharedForTarget;
inherit llvmShared llvmSharedForBuild llvmSharedForHost llvmSharedForTarget llvmPackagesForBuild;
patches = rustcPatches;

View File

@ -1,5 +1,5 @@
{ lib, stdenv, removeReferencesTo, pkgsBuildBuild, pkgsBuildHost, pkgsBuildTarget
, llvmShared, llvmSharedForBuild, llvmSharedForHost, llvmSharedForTarget
, llvmShared, llvmSharedForBuild, llvmSharedForHost, llvmSharedForTarget, llvmPackagesForBuild
, fetchurl, file, python3
, darwin, cmake, rust, rustPlatform
, pkg-config, openssl
@ -174,7 +174,10 @@ in stdenv.mkDerivation rec {
requiredSystemFeatures = [ "big-parallel" ];
passthru.llvm = llvmShared;
passthru = {
llvm = llvmShared;
llvmPackages = llvmPackagesForBuild;
};
meta = with lib; {
homepage = "https://www.rust-lang.org/";