forked from mirrors/nixpkgs
Merge pull request #112928 from baloo/baloo/gcc/reproducible
stdenv: provide a deterministically built gcc
This commit is contained in:
commit
48c952c039
|
@ -4,6 +4,7 @@
|
|||
, langObjC ? stdenv.targetPlatform.isDarwin
|
||||
, langObjCpp ? stdenv.targetPlatform.isDarwin
|
||||
, langGo ? false
|
||||
, reproducibleBuild ? true
|
||||
, profiledCompiler ? false
|
||||
, langJit ? false
|
||||
, staticCompiler ? false
|
||||
|
@ -48,6 +49,10 @@ assert langAda -> gnatboot != null;
|
|||
# threadsCross is just for MinGW
|
||||
assert threadsCross != null -> stdenv.targetPlatform.isWindows;
|
||||
|
||||
# profiledCompiler builds inject non-determinism in one of the compilation stages.
|
||||
# If turned on, we can't provide reproducible builds anymore
|
||||
assert reproducibleBuild -> profiledCompiler == false;
|
||||
|
||||
with lib;
|
||||
with builtins;
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
, langObjCpp ? stdenv.targetPlatform.isDarwin
|
||||
, langJava ? false
|
||||
, langGo ? false
|
||||
, reproducibleBuild ? true
|
||||
, profiledCompiler ? false
|
||||
, langJit ? false
|
||||
, staticCompiler ? false
|
||||
|
@ -58,6 +59,10 @@ assert langGo -> langCC;
|
|||
# threadsCross is just for MinGW
|
||||
assert threadsCross != null -> stdenv.targetPlatform.isWindows;
|
||||
|
||||
# profiledCompiler builds inject non-determinism in one of the compilation stages.
|
||||
# If turned on, we can't provide reproducible builds anymore
|
||||
assert reproducibleBuild -> profiledCompiler == false;
|
||||
|
||||
with lib;
|
||||
with builtins;
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
, langObjCpp ? stdenv.targetPlatform.isDarwin
|
||||
, langJava ? false
|
||||
, langGo ? false
|
||||
, reproducibleBuild ? true
|
||||
, profiledCompiler ? false
|
||||
, langJit ? false
|
||||
, staticCompiler ? false
|
||||
|
@ -58,6 +59,10 @@ assert langGo -> langCC;
|
|||
# threadsCross is just for MinGW
|
||||
assert threadsCross != null -> stdenv.targetPlatform.isWindows;
|
||||
|
||||
# profiledCompiler builds inject non-determinism in one of the compilation stages.
|
||||
# If turned on, we can't provide reproducible builds anymore
|
||||
assert reproducibleBuild -> profiledCompiler == false;
|
||||
|
||||
with lib;
|
||||
with builtins;
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
, langObjCpp ? stdenv.targetPlatform.isDarwin
|
||||
, langJava ? false
|
||||
, langGo ? false
|
||||
, reproducibleBuild ? true
|
||||
, profiledCompiler ? false
|
||||
, langJit ? false
|
||||
, staticCompiler ? false
|
||||
|
@ -61,6 +62,10 @@ assert langAda -> gnatboot != null;
|
|||
# threadsCross is just for MinGW
|
||||
assert threadsCross != null -> stdenv.targetPlatform.isWindows;
|
||||
|
||||
# profiledCompiler builds inject non-determinism in one of the compilation stages.
|
||||
# If turned on, we can't provide reproducible builds anymore
|
||||
assert reproducibleBuild -> profiledCompiler == false;
|
||||
|
||||
with lib;
|
||||
with builtins;
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
, langObjC ? stdenv.targetPlatform.isDarwin
|
||||
, langObjCpp ? stdenv.targetPlatform.isDarwin
|
||||
, langGo ? false
|
||||
, reproducibleBuild ? true
|
||||
, profiledCompiler ? false
|
||||
, langJit ? false
|
||||
, staticCompiler ? false
|
||||
|
@ -45,6 +46,10 @@ assert langGo -> langCC;
|
|||
# threadsCross is just for MinGW
|
||||
assert threadsCross != null -> stdenv.targetPlatform.isWindows;
|
||||
|
||||
# profiledCompiler builds inject non-determinism in one of the compilation stages.
|
||||
# If turned on, we can't provide reproducible builds anymore
|
||||
assert reproducibleBuild -> profiledCompiler == false;
|
||||
|
||||
with lib;
|
||||
with builtins;
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
, langObjC ? stdenv.targetPlatform.isDarwin
|
||||
, langObjCpp ? stdenv.targetPlatform.isDarwin
|
||||
, langGo ? false
|
||||
, reproducibleBuild ? true
|
||||
, profiledCompiler ? false
|
||||
, langJit ? false
|
||||
, staticCompiler ? false
|
||||
|
@ -45,6 +46,10 @@ assert langGo -> langCC;
|
|||
# threadsCross is just for MinGW
|
||||
assert threadsCross != null -> stdenv.targetPlatform.isWindows;
|
||||
|
||||
# profiledCompiler builds inject non-determinism in one of the compilation stages.
|
||||
# If turned on, we can't provide reproducible builds anymore
|
||||
assert reproducibleBuild -> profiledCompiler == false;
|
||||
|
||||
with lib;
|
||||
with builtins;
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
, langObjCpp ? stdenv.targetPlatform.isDarwin
|
||||
, langD ? false
|
||||
, langGo ? false
|
||||
, reproducibleBuild ? true
|
||||
, profiledCompiler ? false
|
||||
, langJit ? false
|
||||
, staticCompiler ? false
|
||||
|
@ -54,6 +55,10 @@ assert langAda -> gnatboot != null;
|
|||
# threadsCross is just for MinGW
|
||||
assert threadsCross != null -> stdenv.targetPlatform.isWindows;
|
||||
|
||||
# profiledCompiler builds inject non-determinism in one of the compilation stages.
|
||||
# If turned on, we can't provide reproducible builds anymore
|
||||
assert reproducibleBuild -> profiledCompiler == false;
|
||||
|
||||
with lib;
|
||||
with builtins;
|
||||
|
||||
|
|
|
@ -274,6 +274,10 @@ in
|
|||
isl_0_20 = super.isl_0_20.override { stdenv = self.makeStaticLibraries self.stdenv; };
|
||||
gcc-unwrapped = super.gcc-unwrapped.override {
|
||||
isl = isl_0_20;
|
||||
# Use a deterministically built compiler
|
||||
# see https://github.com/NixOS/nixpkgs/issues/108475 for context
|
||||
reproducibleBuild = true;
|
||||
profiledCompiler = false;
|
||||
};
|
||||
};
|
||||
extraNativeBuildInputs = [ prevStage.patchelf ] ++
|
||||
|
|
|
@ -10280,9 +10280,16 @@ in
|
|||
if stdenv.targetPlatform.isAarch64 then gcc9 else gcc10;
|
||||
gcc-unwrapped = gcc.cc;
|
||||
|
||||
wrapNonDeterministicGcc = stdenv: ccWrapper:
|
||||
if ccWrapper.isGNU then ccWrapper.overrideAttrs(old: {
|
||||
cc = old.cc.override {
|
||||
reproducibleBuild = false;
|
||||
profiledCompiler = with stdenv; (!isDarwin && (isi686 || isx86_64));
|
||||
};
|
||||
}) else ccWrapper;
|
||||
|
||||
gccStdenv = if stdenv.cc.isGNU then stdenv else stdenv.override {
|
||||
allowedRequisites = null;
|
||||
cc = gcc;
|
||||
# Remove libcxx/libcxxabi, and add clang for AS if on darwin (it uses
|
||||
# clang's internal assembler).
|
||||
extraBuildInputs = lib.optional stdenv.hostPlatform.isDarwin clang.cc;
|
||||
|
@ -10295,6 +10302,8 @@ in
|
|||
gcc9Stdenv = overrideCC gccStdenv buildPackages.gcc9;
|
||||
gcc10Stdenv = overrideCC gccStdenv buildPackages.gcc10;
|
||||
|
||||
fastStdenv = overrideCC gccStdenv (wrapNonDeterministicGcc gccStdenv buildPackages.gcc10);
|
||||
|
||||
wrapCCMulti = cc:
|
||||
if stdenv.targetPlatform.system == "x86_64-linux" then let
|
||||
# Binutils with glibc multi
|
||||
|
@ -10359,8 +10368,10 @@ in
|
|||
cc = gccFun {
|
||||
# copy-pasted
|
||||
inherit noSysDirs;
|
||||
# PGO seems to speed up compilation by gcc by ~10%, see #445 discussion
|
||||
profiledCompiler = with stdenv; (!isDarwin && (isi686 || isx86_64));
|
||||
|
||||
reproducibleBuild = true;
|
||||
profiledCompiler = false;
|
||||
|
||||
isl = if !stdenv.isDarwin then isl_0_20 else null;
|
||||
|
||||
# just for stage static
|
||||
|
@ -10378,8 +10389,8 @@ in
|
|||
gcc48 = lowPrio (wrapCC (callPackage ../development/compilers/gcc/4.8 {
|
||||
inherit noSysDirs;
|
||||
|
||||
# PGO seems to speed up compilation by gcc by ~10%, see #445 discussion
|
||||
profiledCompiler = with stdenv; (!isSunOS && !isDarwin && (isi686 || isx86_64));
|
||||
reproducibleBuild = true;
|
||||
profiledCompiler = false;
|
||||
|
||||
libcCross = if stdenv.targetPlatform != stdenv.buildPlatform then libcCross else null;
|
||||
threadsCross = if stdenv.targetPlatform != stdenv.buildPlatform then threadsCross else null;
|
||||
|
@ -10392,8 +10403,8 @@ in
|
|||
gcc49 = lowPrio (wrapCC (callPackage ../development/compilers/gcc/4.9 {
|
||||
inherit noSysDirs;
|
||||
|
||||
# PGO seems to speed up compilation by gcc by ~10%, see #445 discussion
|
||||
profiledCompiler = with stdenv; (!isDarwin && (isi686 || isx86_64));
|
||||
reproducibleBuild = true;
|
||||
profiledCompiler = false;
|
||||
|
||||
libcCross = if stdenv.targetPlatform != stdenv.buildPlatform then libcCross else null;
|
||||
threadsCross = if stdenv.targetPlatform != stdenv.buildPlatform then threadsCross else null;
|
||||
|
@ -10406,8 +10417,8 @@ in
|
|||
gcc6 = lowPrio (wrapCC (callPackage ../development/compilers/gcc/6 {
|
||||
inherit noSysDirs;
|
||||
|
||||
# PGO seems to speed up compilation by gcc by ~10%, see #445 discussion
|
||||
profiledCompiler = with stdenv; (!isDarwin && (isi686 || isx86_64));
|
||||
reproducibleBuild = true;
|
||||
profiledCompiler = false;
|
||||
|
||||
libcCross = if stdenv.targetPlatform != stdenv.buildPlatform then libcCross else null;
|
||||
threadsCross = if stdenv.targetPlatform != stdenv.buildPlatform then threadsCross else null;
|
||||
|
@ -10425,8 +10436,8 @@ in
|
|||
gcc7 = lowPrio (wrapCC (callPackage ../development/compilers/gcc/7 {
|
||||
inherit noSysDirs;
|
||||
|
||||
# PGO seems to speed up compilation by gcc by ~10%, see #445 discussion
|
||||
profiledCompiler = with stdenv; (!isDarwin && (isi686 || isx86_64));
|
||||
reproducibleBuild = true;
|
||||
profiledCompiler = false;
|
||||
|
||||
libcCross = if stdenv.targetPlatform != stdenv.buildPlatform then libcCross else null;
|
||||
threadsCross = if stdenv.targetPlatform != stdenv.buildPlatform then threadsCross else null;
|
||||
|
@ -10440,8 +10451,8 @@ in
|
|||
gcc8 = lowPrio (wrapCC (callPackage ../development/compilers/gcc/8 {
|
||||
inherit noSysDirs;
|
||||
|
||||
# PGO seems to speed up compilation by gcc by ~10%, see #445 discussion
|
||||
profiledCompiler = with stdenv; (!isDarwin && (isi686 || isx86_64));
|
||||
reproducibleBuild = true;
|
||||
profiledCompiler = false;
|
||||
|
||||
libcCross = if stdenv.targetPlatform != stdenv.buildPlatform then libcCross else null;
|
||||
threadsCross = if stdenv.targetPlatform != stdenv.buildPlatform then threadsCross else null;
|
||||
|
@ -10455,8 +10466,8 @@ in
|
|||
gcc9 = lowPrio (wrapCC (callPackage ../development/compilers/gcc/9 {
|
||||
inherit noSysDirs;
|
||||
|
||||
# PGO seems to speed up compilation by gcc by ~10%, see #445 discussion
|
||||
profiledCompiler = with stdenv; (!isDarwin && (isi686 || isx86_64));
|
||||
reproducibleBuild = true;
|
||||
profiledCompiler = false;
|
||||
|
||||
enableLTO = !stdenv.isi686;
|
||||
|
||||
|
@ -10469,8 +10480,8 @@ in
|
|||
gcc10 = lowPrio (wrapCC (callPackage ../development/compilers/gcc/10 {
|
||||
inherit noSysDirs;
|
||||
|
||||
# PGO seems to speed up compilation by gcc by ~10%, see #445 discussion
|
||||
profiledCompiler = with stdenv; (!isDarwin && (isi686 || isx86_64));
|
||||
reproducibleBuild = true;
|
||||
profiledCompiler = false;
|
||||
|
||||
enableLTO = !stdenv.isi686;
|
||||
|
||||
|
|
Loading…
Reference in a new issue