Skip to content

Commit

Permalink
Merge pull request #182666 from trofi/fix-non-cross-cross
Browse files Browse the repository at this point in the history
gcc: always enable inhibit_libc=true for --without-headers builds
  • Loading branch information
trofi authored Jul 24, 2022
2 parents 4a6e124 + ea8e124 commit 9e11882
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 10 deletions.
2 changes: 1 addition & 1 deletion pkgs/development/compilers/gcc/10/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ stdenv.mkDerivation ({

preConfigure = import ../common/pre-configure.nix {
inherit lib;
inherit version targetPlatform hostPlatform gnatboot langAda langGo langJit;
inherit version targetPlatform hostPlatform gnatboot langAda langGo langJit crossStageStatic;
};

dontDisableStatic = true;
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/gcc/11/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ stdenv.mkDerivation ({

preConfigure = import ../common/pre-configure.nix {
inherit lib;
inherit version targetPlatform hostPlatform gnatboot langAda langGo langJit;
inherit version targetPlatform hostPlatform gnatboot langAda langGo langJit crossStageStatic;
};

dontDisableStatic = true;
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/gcc/12/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ stdenv.mkDerivation ({

preConfigure = import ../common/pre-configure.nix {
inherit lib;
inherit version targetPlatform hostPlatform gnatboot langAda langGo langJit;
inherit version targetPlatform hostPlatform gnatboot langAda langGo langJit crossStageStatic;
};

dontDisableStatic = true;
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/gcc/4.8/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ stdenv.mkDerivation ({

preConfigure = import ../common/pre-configure.nix {
inherit lib;
inherit version targetPlatform hostPlatform langJava langGo;
inherit version targetPlatform hostPlatform langJava langGo crossStageStatic;
};

dontDisableStatic = true;
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/gcc/4.9/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ stdenv.mkDerivation ({

preConfigure = import ../common/pre-configure.nix {
inherit lib;
inherit version targetPlatform hostPlatform langJava langGo;
inherit version targetPlatform hostPlatform langJava langGo crossStageStatic;
};

dontDisableStatic = true;
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/gcc/6/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ stdenv.mkDerivation ({

preConfigure = import ../common/pre-configure.nix {
inherit lib;
inherit version targetPlatform hostPlatform gnatboot langJava langAda langGo;
inherit version targetPlatform hostPlatform gnatboot langJava langAda langGo crossStageStatic;
};

dontDisableStatic = true;
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/gcc/7/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ stdenv.mkDerivation ({

preConfigure = import ../common/pre-configure.nix {
inherit lib;
inherit version targetPlatform hostPlatform langGo;
inherit version targetPlatform hostPlatform langGo crossStageStatic;
};

dontDisableStatic = true;
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/gcc/8/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ stdenv.mkDerivation ({

preConfigure = import ../common/pre-configure.nix {
inherit lib;
inherit version targetPlatform hostPlatform langGo;
inherit version targetPlatform hostPlatform langGo crossStageStatic;
};

dontDisableStatic = true;
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/gcc/9/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ stdenv.mkDerivation ({

preConfigure = import ../common/pre-configure.nix {
inherit lib;
inherit version targetPlatform hostPlatform gnatboot langAda langGo langJit;
inherit version targetPlatform hostPlatform gnatboot langAda langGo langJit crossStageStatic;
};

dontDisableStatic = true;
Expand Down
13 changes: 12 additions & 1 deletion pkgs/development/compilers/gcc/common/pre-configure.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
, langAda ? false
, langJava ? false
, langJit ? false
, langGo }:
, langGo
, crossStageStatic
}:

assert langJava -> lib.versionOlder version "7";
assert langAda -> gnatboot != null; let
Expand Down Expand Up @@ -67,3 +69,12 @@ in lib.optionalString (hostPlatform.isSunOS && hostPlatform.is64bit) ''
+ lib.optionalString (targetPlatform.config == hostPlatform.config && targetPlatform != hostPlatform) ''
substituteInPlace configure --replace is_cross_compiler=no is_cross_compiler=yes
''

# Normally (for host != target case) --without-headers automatically
# enables 'inhibit_libc=true' in gcc's gcc/configure.ac. But case of
# gcc->clang "cross"-compilation manages to evade it: there
# hostPlatform != targetPlatform, hostPlatform.config == targetPlatform.config.
# We explicitly inhibit libc headers use in this case as well.
+ lib.optionalString (targetPlatform != hostPlatform && crossStageStatic) ''
export inhibit_libc=true
''

0 comments on commit 9e11882

Please sign in to comment.