about summary refs log tree commit diff
path: root/pkgs/development/compilers/gcc
diff options
context:
space:
mode:
authorAdam Joseph <adam@westernsemico.com>2023-07-02 18:44:28 -0700
committerAdam Joseph <adam@westernsemico.com>2023-07-07 03:02:47 -0700
commit926c920c12703883a7e946e9bbebf8d0d00af31a (patch)
tree725619d45129ba0460c3f027bbd25f100bb54f4a /pkgs/development/compilers/gcc
parentebaae879a74f772ecc827d264e37960087a4b182 (diff)
downloadnixlib-926c920c12703883a7e946e9bbebf8d0d00af31a.tar
nixlib-926c920c12703883a7e946e9bbebf8d0d00af31a.tar.gz
nixlib-926c920c12703883a7e946e9bbebf8d0d00af31a.tar.bz2
nixlib-926c920c12703883a7e946e9bbebf8d0d00af31a.tar.lz
nixlib-926c920c12703883a7e946e9bbebf8d0d00af31a.tar.xz
nixlib-926c920c12703883a7e946e9bbebf8d0d00af31a.tar.zst
nixlib-926c920c12703883a7e946e9bbebf8d0d00af31a.zip
gcc: tighten condition for inhibit_libc=true
The situation described in the comment preceding `export
inhibit_libc=true` does not match the conditional which follows it.
Specifically, the comment says that this line is meant for "clang
builds gcc" situations, yet it is enabled even when
`!stdenv.cc.isClang`.

This commit tightens the conditional to make it match the situation
described in the comment.
Diffstat (limited to 'pkgs/development/compilers/gcc')
-rw-r--r--pkgs/development/compilers/gcc/common/pre-configure.nix5
1 files changed, 4 insertions, 1 deletions
diff --git a/pkgs/development/compilers/gcc/common/pre-configure.nix b/pkgs/development/compilers/gcc/common/pre-configure.nix
index e386693b22c7..5a74c5647293 100644
--- a/pkgs/development/compilers/gcc/common/pre-configure.nix
+++ b/pkgs/development/compilers/gcc/common/pre-configure.nix
@@ -108,7 +108,10 @@ in lib.optionalString (hostPlatform.isSunOS && hostPlatform.is64bit) ''
 # 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 && withoutTargetLibc) ''
++ lib.optionalString (targetPlatform != hostPlatform &&
+                      withoutTargetLibc &&
+                      targetPlatform.config == hostPlatform.config &&
+                      (stdenv.cc.isClang || stdenv.targetPlatform.useLLVM)) ''
   export inhibit_libc=true
 ''