cc-wrapper: only set -march when platform.gcc.arch is specified

We want to make sure this value is explicitly set. Infering it for
every arch leads to annoying failures like:

https://hydra.nixos.org/build/92583832/

Perhaps we can enable it in the future with some smarter handling of
cc-wrapper.sh.
This commit is contained in:
Matthew Bauer 2019-04-26 22:29:52 -04:00
parent d53042e83e
commit 23c520d95e

View File

@ -306,9 +306,9 @@ stdenv.mkDerivation {
# Always add -march based on cpu in triple. Sometimes there is a
# discrepency (x86_64 vs. x86-64), so we provide an "arch" arg in
# that case.
+ optionalString ((targetPlatform ? platform.gcc.arch || targetPlatform.parsed.cpu ? arch) &&
isGccArchSupported targetPlatform.platform.gcc.arch or targetPlatform.parsed.cpu.arch) ''
echo "-march=${targetPlatform.platform.gcc.arch or targetPlatform.parsed.cpu.arch}" >> $out/nix-support/cc-cflags-before
+ optionalString ((targetPlatform ? platform.gcc.arch) &&
isGccArchSupported targetPlatform.platform.gcc.arch) ''
echo "-march=${targetPlatform.platform.gcc.arch}" >> $out/nix-support/cc-cflags-before
''
# -mcpu is not very useful. You should use mtune and march