diff options
author | sternenseemann <sternenseemann@systemli.org> | 2024-04-14 15:51:18 +0200 |
---|---|---|
committer | sternenseemann <sternenseemann@systemli.org> | 2024-04-15 12:49:29 +0200 |
commit | fde3861f2109c4cd80c5fe6ba3aec827762cdb63 (patch) | |
tree | e41b86d1a9997e0ff81f25605a5cc2e66b8fbc3e /pkgs/build-support | |
parent | 20a3a2181494145baed7ad006727f3e15bc12f15 (diff) |
wrapCC: check darwin-ness for -mcpu/-march based on targetPlatform
`stdenv.is*` defaults to `hostPlatform` which is technically incorrect here, since what we are gating concerns the target platform only. This would be a problem in practice if cross compiling from x86_64-darwin to aarch64-darwin whilst using gcc which is probably rare enough.
Diffstat (limited to 'pkgs/build-support')
-rw-r--r-- | pkgs/build-support/cc-wrapper/default.nix | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix index ba2f1c3d516df..fa32108963f31 100644 --- a/pkgs/build-support/cc-wrapper/default.nix +++ b/pkgs/build-support/cc-wrapper/default.nix @@ -623,7 +623,7 @@ stdenv.mkDerivation { # For clang, this is handled in add-clang-cc-cflags-before.sh # TODO: aarch64-darwin has mcpu incompatible with gcc - + optionalString ((targetPlatform ? gcc.arch) && !isClang && !(stdenv.isDarwin && stdenv.isAarch64) && + + optionalString ((targetPlatform ? gcc.arch) && !isClang && !(targetPlatform.isDarwin && targetPlatform.isAarch64) && isGccArchSupported targetPlatform.gcc.arch) '' echo "-march=${targetPlatform.gcc.arch}" >> $out/nix-support/cc-cflags-before '' @@ -632,7 +632,7 @@ stdenv.mkDerivation { # instead of march. On all other platforms you should use mtune # and march instead. # TODO: aarch64-darwin has mcpu incompatible with gcc - + optionalString ((targetPlatform ? gcc.cpu) && (isClang || !(stdenv.isDarwin && stdenv.isAarch64))) '' + + optionalString ((targetPlatform ? gcc.cpu) && (isClang || !(targetPlatform.isDarwin && targetPlatform.isAarch64))) '' echo "-mcpu=${targetPlatform.gcc.cpu}" >> $out/nix-support/cc-cflags-before '' |