···432432 # Always add -march based on cpu in triple. Sometimes there is a
433433 # discrepency (x86_64 vs. x86-64), so we provide an "arch" arg in
434434 # that case.
435435- + optionalString ((targetPlatform ? gcc.arch) &&
435435+ # TODO: aarch64-darwin has mcpu incompatible with gcc
436436+ + optionalString ((targetPlatform ? gcc.arch) && (isClang || !(stdenv.isDarwin && stdenv.isAarch64)) &&
436437 isGccArchSupported targetPlatform.gcc.arch) ''
437438 echo "-march=${targetPlatform.gcc.arch}" >> $out/nix-support/cc-cflags-before
438439 ''
439440440441 # -mcpu is not very useful. You should use mtune and march
441442 # instead. It’s provided here for backwards compatibility.
442442- + optionalString (targetPlatform ? gcc.cpu) ''
443443+ # TODO: aarch64-darwin has mcpu incompatible with gcc
444444+ + optionalString ((targetPlatform ? gcc.cpu) && (isClang || !(stdenv.isDarwin && stdenv.isAarch64))) ''
443445 echo "-mcpu=${targetPlatform.gcc.cpu}" >> $out/nix-support/cc-cflags-before
444446 ''
445447