-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pkgs/test/stdenv/default.nix: add gcc-stageCompare
This commit adds a derivation `gcc-stageCompare` to `pkgs/test/stdenv/default.nix`. It is important to always build this derivation whenever building `stdenv`! Because we are using a Nix-driven bootstrap instead of gcc's built-in `--enable-bootstrap`, the `gcc` derivation no longer performs the post-self-compilation sanity check. You must build this derivation in order to perform that sanity check. The major benefit of this new approach is that the sanity check (which involves a third compilation of gcc) can be performed *concurrently* with all packages that depend on `stdenv`, rather than serially. Since `stdenv` has very little derivation-level parallelism it cannot take advantage of more than one or perhaps two builders. If you have three or more builders this commit will reduce the time-to-rebuild-stdenv by around 20% (one of three gcc rebuilds is removed from the critical path, and stdenv's build time is dominated by roughly 3*gcc + 1*binutils + 1*bison-test-suite). Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
- Loading branch information
1 parent
96588eb
commit 5f57c2e
Showing
5 changed files
with
39 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
, nukeReferences | ||
, langC | ||
, langCC | ||
, runtimeShell | ||
}: | ||
|
||
let | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# This test *must* be run prior to releasing any build of either stdenv or the | ||
# gcc that it exports! This check should also be part of CI for any PR that | ||
# causes a rebuild of `stdenv.cc`. | ||
# | ||
# When we used gcc's internal bootstrap it did this check as part of (and | ||
# serially with) the gcc derivation. Now that we bootstrap externally this | ||
# check can be done in parallel with any/all of stdenv's referrers. But we | ||
# must remember to do the check. | ||
# | ||
|
||
{ stdenv | ||
, pkgs | ||
, lib | ||
}: | ||
|
||
assert stdenv.cc.isGNU; | ||
with pkgs; | ||
# rebuild gcc using the "final" stdenv | ||
let gcc-stageCompare = (gcc-unwrapped.override { | ||
reproducibleBuild = true; | ||
profiledCompiler = false; | ||
stdenv = overrideCC stdenv (wrapCCWith { | ||
cc = stdenv.cc; | ||
}); | ||
}).overrideAttrs(_: { | ||
NIX_OUTPATH_USED_AS_RANDOM_SEED = stdenv.cc.cc.out; | ||
}); | ||
in (runCommand "gcc-stageCompare" {} '' | ||
diff -sr ${pkgs.gcc-unwrapped.checksum}/checksums ${gcc-stageCompare.checksum}/checksums && touch $out | ||
'').overrideAttrs (a: { | ||
meta = (a.meta or { }) // { platforms = lib.platforms.linux; }; | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters