Merge #291901: clang: don't set -march for overridden target

...into staging-next

+9 -2
+1 -1
pkgs/build-support/cc-wrapper/add-clang-cc-cflags-before.sh
··· 7 7 done 8 8 9 9 if $needsTarget; then 10 - extraBefore+=(-target @defaultTarget@) 10 + extraBefore+=(-target @defaultTarget@ @march@) 11 11 fi
+8 -1
pkgs/build-support/cc-wrapper/default.nix
··· 604 604 # Always add -march based on cpu in triple. Sometimes there is a 605 605 # discrepency (x86_64 vs. x86-64), so we provide an "arch" arg in 606 606 # that case. 607 + # 608 + # For clang, this is handled in add-clang-cc-cflags-before.sh 609 + 607 610 # TODO: aarch64-darwin has mcpu incompatible with gcc 608 - + optionalString ((targetPlatform ? gcc.arch) && (isClang || !(stdenv.isDarwin && stdenv.isAarch64)) && 611 + + optionalString ((targetPlatform ? gcc.arch) && !isClang && !(stdenv.isDarwin && stdenv.isAarch64) && 609 612 isGccArchSupported targetPlatform.gcc.arch) '' 610 613 echo "-march=${targetPlatform.gcc.arch}" >> $out/nix-support/cc-cflags-before 611 614 '' ··· 694 697 ## Needs to go after ^ because the for loop eats \n and makes this file an invalid script 695 698 ## 696 699 + optionalString isClang '' 700 + # Escape twice: once for this script, once for the one it gets substituted into. 701 + export march=${lib.escapeShellArg 702 + (lib.optionalString (targetPlatform ? gcc.arch) 703 + (lib.escapeShellArg "-march=${targetPlatform.gcc.arch}"))} 697 704 export defaultTarget=${targetPlatform.config} 698 705 substituteAll ${./add-clang-cc-cflags-before.sh} $out/nix-support/add-local-cc-cflags-before.sh 699 706 ''