···604604 # Always add -march based on cpu in triple. Sometimes there is a
605605 # discrepency (x86_64 vs. x86-64), so we provide an "arch" arg in
606606 # that case.
607607+ #
608608+ # For clang, this is handled in add-clang-cc-cflags-before.sh
609609+607610 # TODO: aarch64-darwin has mcpu incompatible with gcc
608608- + optionalString ((targetPlatform ? gcc.arch) && (isClang || !(stdenv.isDarwin && stdenv.isAarch64)) &&
611611+ + optionalString ((targetPlatform ? gcc.arch) && !isClang && !(stdenv.isDarwin && stdenv.isAarch64) &&
609612 isGccArchSupported targetPlatform.gcc.arch) ''
610613 echo "-march=${targetPlatform.gcc.arch}" >> $out/nix-support/cc-cflags-before
611614 ''
···694697 ## Needs to go after ^ because the for loop eats \n and makes this file an invalid script
695698 ##
696699 + optionalString isClang ''
700700+ # Escape twice: once for this script, once for the one it gets substituted into.
701701+ export march=${lib.escapeShellArg
702702+ (lib.optionalString (targetPlatform ? gcc.arch)
703703+ (lib.escapeShellArg "-march=${targetPlatform.gcc.arch}"))}
697704 export defaultTarget=${targetPlatform.config}
698705 substituteAll ${./add-clang-cc-cflags-before.sh} $out/nix-support/add-local-cc-cflags-before.sh
699706 ''