mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-09-23 13:48:21 +03:00
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
|
, langObjC ? stdenv.targetPlatform.isDarwin
|
||||||
, langObjCpp ? stdenv.targetPlatform.isDarwin
|
, langObjCpp ? stdenv.targetPlatform.isDarwin
|
||||||
, langGo ? false
|
, langGo ? false
|
||||||
|
, reproducibleBuild ? true
|
||||||
, profiledCompiler ? false
|
, profiledCompiler ? false
|
||||||
, langJit ? false
|
, langJit ? false
|
||||||
, staticCompiler ? false
|
, staticCompiler ? false
|
||||||
@ -48,6 +49,10 @@ assert langAda -> gnatboot != null;
|
|||||||
# threadsCross is just for MinGW
|
# threadsCross is just for MinGW
|
||||||
assert threadsCross != null -> stdenv.targetPlatform.isWindows;
|
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 lib;
|
||||||
with builtins;
|
with builtins;
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
, langObjCpp ? stdenv.targetPlatform.isDarwin
|
, langObjCpp ? stdenv.targetPlatform.isDarwin
|
||||||
, langJava ? false
|
, langJava ? false
|
||||||
, langGo ? false
|
, langGo ? false
|
||||||
|
, reproducibleBuild ? true
|
||||||
, profiledCompiler ? false
|
, profiledCompiler ? false
|
||||||
, langJit ? false
|
, langJit ? false
|
||||||
, staticCompiler ? false
|
, staticCompiler ? false
|
||||||
@ -58,6 +59,10 @@ assert langGo -> langCC;
|
|||||||
# threadsCross is just for MinGW
|
# threadsCross is just for MinGW
|
||||||
assert threadsCross != null -> stdenv.targetPlatform.isWindows;
|
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 lib;
|
||||||
with builtins;
|
with builtins;
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
, langObjCpp ? stdenv.targetPlatform.isDarwin
|
, langObjCpp ? stdenv.targetPlatform.isDarwin
|
||||||
, langJava ? false
|
, langJava ? false
|
||||||
, langGo ? false
|
, langGo ? false
|
||||||
|
, reproducibleBuild ? true
|
||||||
, profiledCompiler ? false
|
, profiledCompiler ? false
|
||||||
, langJit ? false
|
, langJit ? false
|
||||||
, staticCompiler ? false
|
, staticCompiler ? false
|
||||||
@ -58,6 +59,10 @@ assert langGo -> langCC;
|
|||||||
# threadsCross is just for MinGW
|
# threadsCross is just for MinGW
|
||||||
assert threadsCross != null -> stdenv.targetPlatform.isWindows;
|
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 lib;
|
||||||
with builtins;
|
with builtins;
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
, langObjCpp ? stdenv.targetPlatform.isDarwin
|
, langObjCpp ? stdenv.targetPlatform.isDarwin
|
||||||
, langJava ? false
|
, langJava ? false
|
||||||
, langGo ? false
|
, langGo ? false
|
||||||
|
, reproducibleBuild ? true
|
||||||
, profiledCompiler ? false
|
, profiledCompiler ? false
|
||||||
, langJit ? false
|
, langJit ? false
|
||||||
, staticCompiler ? false
|
, staticCompiler ? false
|
||||||
@ -61,6 +62,10 @@ assert langAda -> gnatboot != null;
|
|||||||
# threadsCross is just for MinGW
|
# threadsCross is just for MinGW
|
||||||
assert threadsCross != null -> stdenv.targetPlatform.isWindows;
|
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 lib;
|
||||||
with builtins;
|
with builtins;
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
, langObjC ? stdenv.targetPlatform.isDarwin
|
, langObjC ? stdenv.targetPlatform.isDarwin
|
||||||
, langObjCpp ? stdenv.targetPlatform.isDarwin
|
, langObjCpp ? stdenv.targetPlatform.isDarwin
|
||||||
, langGo ? false
|
, langGo ? false
|
||||||
|
, reproducibleBuild ? true
|
||||||
, profiledCompiler ? false
|
, profiledCompiler ? false
|
||||||
, langJit ? false
|
, langJit ? false
|
||||||
, staticCompiler ? false
|
, staticCompiler ? false
|
||||||
@ -45,6 +46,10 @@ assert langGo -> langCC;
|
|||||||
# threadsCross is just for MinGW
|
# threadsCross is just for MinGW
|
||||||
assert threadsCross != null -> stdenv.targetPlatform.isWindows;
|
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 lib;
|
||||||
with builtins;
|
with builtins;
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
, langObjC ? stdenv.targetPlatform.isDarwin
|
, langObjC ? stdenv.targetPlatform.isDarwin
|
||||||
, langObjCpp ? stdenv.targetPlatform.isDarwin
|
, langObjCpp ? stdenv.targetPlatform.isDarwin
|
||||||
, langGo ? false
|
, langGo ? false
|
||||||
|
, reproducibleBuild ? true
|
||||||
, profiledCompiler ? false
|
, profiledCompiler ? false
|
||||||
, langJit ? false
|
, langJit ? false
|
||||||
, staticCompiler ? false
|
, staticCompiler ? false
|
||||||
@ -45,6 +46,10 @@ assert langGo -> langCC;
|
|||||||
# threadsCross is just for MinGW
|
# threadsCross is just for MinGW
|
||||||
assert threadsCross != null -> stdenv.targetPlatform.isWindows;
|
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 lib;
|
||||||
with builtins;
|
with builtins;
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
, langObjCpp ? stdenv.targetPlatform.isDarwin
|
, langObjCpp ? stdenv.targetPlatform.isDarwin
|
||||||
, langD ? false
|
, langD ? false
|
||||||
, langGo ? false
|
, langGo ? false
|
||||||
|
, reproducibleBuild ? true
|
||||||
, profiledCompiler ? false
|
, profiledCompiler ? false
|
||||||
, langJit ? false
|
, langJit ? false
|
||||||
, staticCompiler ? false
|
, staticCompiler ? false
|
||||||
@ -54,6 +55,10 @@ assert langAda -> gnatboot != null;
|
|||||||
# threadsCross is just for MinGW
|
# threadsCross is just for MinGW
|
||||||
assert threadsCross != null -> stdenv.targetPlatform.isWindows;
|
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 lib;
|
||||||
with builtins;
|
with builtins;
|
||||||
|
|
||||||
|
@ -274,6 +274,10 @@ in
|
|||||||
isl_0_20 = super.isl_0_20.override { stdenv = self.makeStaticLibraries self.stdenv; };
|
isl_0_20 = super.isl_0_20.override { stdenv = self.makeStaticLibraries self.stdenv; };
|
||||||
gcc-unwrapped = super.gcc-unwrapped.override {
|
gcc-unwrapped = super.gcc-unwrapped.override {
|
||||||
isl = isl_0_20;
|
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 ] ++
|
extraNativeBuildInputs = [ prevStage.patchelf ] ++
|
||||||
|
@ -10280,9 +10280,16 @@ in
|
|||||||
if stdenv.targetPlatform.isAarch64 then gcc9 else gcc10;
|
if stdenv.targetPlatform.isAarch64 then gcc9 else gcc10;
|
||||||
gcc-unwrapped = gcc.cc;
|
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 {
|
gccStdenv = if stdenv.cc.isGNU then stdenv else stdenv.override {
|
||||||
allowedRequisites = null;
|
allowedRequisites = null;
|
||||||
cc = gcc;
|
|
||||||
# Remove libcxx/libcxxabi, and add clang for AS if on darwin (it uses
|
# Remove libcxx/libcxxabi, and add clang for AS if on darwin (it uses
|
||||||
# clang's internal assembler).
|
# clang's internal assembler).
|
||||||
extraBuildInputs = lib.optional stdenv.hostPlatform.isDarwin clang.cc;
|
extraBuildInputs = lib.optional stdenv.hostPlatform.isDarwin clang.cc;
|
||||||
@ -10295,6 +10302,8 @@ in
|
|||||||
gcc9Stdenv = overrideCC gccStdenv buildPackages.gcc9;
|
gcc9Stdenv = overrideCC gccStdenv buildPackages.gcc9;
|
||||||
gcc10Stdenv = overrideCC gccStdenv buildPackages.gcc10;
|
gcc10Stdenv = overrideCC gccStdenv buildPackages.gcc10;
|
||||||
|
|
||||||
|
fastStdenv = overrideCC gccStdenv (wrapNonDeterministicGcc gccStdenv buildPackages.gcc10);
|
||||||
|
|
||||||
wrapCCMulti = cc:
|
wrapCCMulti = cc:
|
||||||
if stdenv.targetPlatform.system == "x86_64-linux" then let
|
if stdenv.targetPlatform.system == "x86_64-linux" then let
|
||||||
# Binutils with glibc multi
|
# Binutils with glibc multi
|
||||||
@ -10359,8 +10368,10 @@ in
|
|||||||
cc = gccFun {
|
cc = gccFun {
|
||||||
# copy-pasted
|
# copy-pasted
|
||||||
inherit noSysDirs;
|
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;
|
isl = if !stdenv.isDarwin then isl_0_20 else null;
|
||||||
|
|
||||||
# just for stage static
|
# just for stage static
|
||||||
@ -10378,8 +10389,8 @@ in
|
|||||||
gcc48 = lowPrio (wrapCC (callPackage ../development/compilers/gcc/4.8 {
|
gcc48 = lowPrio (wrapCC (callPackage ../development/compilers/gcc/4.8 {
|
||||||
inherit noSysDirs;
|
inherit noSysDirs;
|
||||||
|
|
||||||
# PGO seems to speed up compilation by gcc by ~10%, see #445 discussion
|
reproducibleBuild = true;
|
||||||
profiledCompiler = with stdenv; (!isSunOS && !isDarwin && (isi686 || isx86_64));
|
profiledCompiler = false;
|
||||||
|
|
||||||
libcCross = if stdenv.targetPlatform != stdenv.buildPlatform then libcCross else null;
|
libcCross = if stdenv.targetPlatform != stdenv.buildPlatform then libcCross else null;
|
||||||
threadsCross = if stdenv.targetPlatform != stdenv.buildPlatform then threadsCross 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 {
|
gcc49 = lowPrio (wrapCC (callPackage ../development/compilers/gcc/4.9 {
|
||||||
inherit noSysDirs;
|
inherit noSysDirs;
|
||||||
|
|
||||||
# PGO seems to speed up compilation by gcc by ~10%, see #445 discussion
|
reproducibleBuild = true;
|
||||||
profiledCompiler = with stdenv; (!isDarwin && (isi686 || isx86_64));
|
profiledCompiler = false;
|
||||||
|
|
||||||
libcCross = if stdenv.targetPlatform != stdenv.buildPlatform then libcCross else null;
|
libcCross = if stdenv.targetPlatform != stdenv.buildPlatform then libcCross else null;
|
||||||
threadsCross = if stdenv.targetPlatform != stdenv.buildPlatform then threadsCross 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 {
|
gcc6 = lowPrio (wrapCC (callPackage ../development/compilers/gcc/6 {
|
||||||
inherit noSysDirs;
|
inherit noSysDirs;
|
||||||
|
|
||||||
# PGO seems to speed up compilation by gcc by ~10%, see #445 discussion
|
reproducibleBuild = true;
|
||||||
profiledCompiler = with stdenv; (!isDarwin && (isi686 || isx86_64));
|
profiledCompiler = false;
|
||||||
|
|
||||||
libcCross = if stdenv.targetPlatform != stdenv.buildPlatform then libcCross else null;
|
libcCross = if stdenv.targetPlatform != stdenv.buildPlatform then libcCross else null;
|
||||||
threadsCross = if stdenv.targetPlatform != stdenv.buildPlatform then threadsCross 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 {
|
gcc7 = lowPrio (wrapCC (callPackage ../development/compilers/gcc/7 {
|
||||||
inherit noSysDirs;
|
inherit noSysDirs;
|
||||||
|
|
||||||
# PGO seems to speed up compilation by gcc by ~10%, see #445 discussion
|
reproducibleBuild = true;
|
||||||
profiledCompiler = with stdenv; (!isDarwin && (isi686 || isx86_64));
|
profiledCompiler = false;
|
||||||
|
|
||||||
libcCross = if stdenv.targetPlatform != stdenv.buildPlatform then libcCross else null;
|
libcCross = if stdenv.targetPlatform != stdenv.buildPlatform then libcCross else null;
|
||||||
threadsCross = if stdenv.targetPlatform != stdenv.buildPlatform then threadsCross 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 {
|
gcc8 = lowPrio (wrapCC (callPackage ../development/compilers/gcc/8 {
|
||||||
inherit noSysDirs;
|
inherit noSysDirs;
|
||||||
|
|
||||||
# PGO seems to speed up compilation by gcc by ~10%, see #445 discussion
|
reproducibleBuild = true;
|
||||||
profiledCompiler = with stdenv; (!isDarwin && (isi686 || isx86_64));
|
profiledCompiler = false;
|
||||||
|
|
||||||
libcCross = if stdenv.targetPlatform != stdenv.buildPlatform then libcCross else null;
|
libcCross = if stdenv.targetPlatform != stdenv.buildPlatform then libcCross else null;
|
||||||
threadsCross = if stdenv.targetPlatform != stdenv.buildPlatform then threadsCross 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 {
|
gcc9 = lowPrio (wrapCC (callPackage ../development/compilers/gcc/9 {
|
||||||
inherit noSysDirs;
|
inherit noSysDirs;
|
||||||
|
|
||||||
# PGO seems to speed up compilation by gcc by ~10%, see #445 discussion
|
reproducibleBuild = true;
|
||||||
profiledCompiler = with stdenv; (!isDarwin && (isi686 || isx86_64));
|
profiledCompiler = false;
|
||||||
|
|
||||||
enableLTO = !stdenv.isi686;
|
enableLTO = !stdenv.isi686;
|
||||||
|
|
||||||
@ -10469,8 +10480,8 @@ in
|
|||||||
gcc10 = lowPrio (wrapCC (callPackage ../development/compilers/gcc/10 {
|
gcc10 = lowPrio (wrapCC (callPackage ../development/compilers/gcc/10 {
|
||||||
inherit noSysDirs;
|
inherit noSysDirs;
|
||||||
|
|
||||||
# PGO seems to speed up compilation by gcc by ~10%, see #445 discussion
|
reproducibleBuild = true;
|
||||||
profiledCompiler = with stdenv; (!isDarwin && (isi686 || isx86_64));
|
profiledCompiler = false;
|
||||||
|
|
||||||
enableLTO = !stdenv.isi686;
|
enableLTO = !stdenv.isi686;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user