From f86158cd9a0cf41edb2b99e9615495c7fedff318 Mon Sep 17 00:00:00 2001 From: Sam <30577766+Samasaur1@users.noreply.github.com> Date: Tue, 2 Apr 2024 19:21:49 -0700 Subject: [PATCH] Revert "swift: don't pass -march to swiftc" This reverts commit 8a7841ceef0a7c7794174178de786ae76cc27457. --- pkgs/build-support/cc-wrapper/default.nix | 8 ++------ pkgs/development/compilers/swift/default.nix | 10 +++------- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix index 569f6875e1fb..23b3ce522ae3 100644 --- a/pkgs/build-support/cc-wrapper/default.nix +++ b/pkgs/build-support/cc-wrapper/default.nix @@ -53,10 +53,6 @@ , gccForLibs ? if useCcForLibs then cc else null , fortify-headers ? null , includeFortifyHeaders ? null - -# https://github.com/NixOS/nixpkgs/issues/295322 -# should -march flag be used -, disableMarch ? false }: assert nativeTools -> !propagateDoc && nativePrefix != ""; @@ -633,7 +629,7 @@ stdenv.mkDerivation { # TODO: aarch64-darwin has mcpu incompatible with gcc + optionalString ((targetPlatform ? gcc.arch) && !isClang && !(stdenv.isDarwin && stdenv.isAarch64) && - isGccArchSupported targetPlatform.gcc.arch && !disableMarch) '' + isGccArchSupported targetPlatform.gcc.arch) '' echo "-march=${targetPlatform.gcc.arch}" >> $out/nix-support/cc-cflags-before '' @@ -729,7 +725,7 @@ stdenv.mkDerivation { + optionalString isClang '' # Escape twice: once for this script, once for the one it gets substituted into. export march=${escapeShellArg - (optionalString (targetPlatform ? gcc.arch && !disableMarch) + (optionalString (targetPlatform ? gcc.arch) (escapeShellArg "-march=${targetPlatform.gcc.arch}"))} export defaultTarget=${targetPlatform.config} substituteAll ${./add-clang-cc-cflags-before.sh} $out/nix-support/add-local-cc-cflags-before.sh diff --git a/pkgs/development/compilers/swift/default.nix b/pkgs/development/compilers/swift/default.nix index c111a8d86bfa..2a56a03766b9 100644 --- a/pkgs/development/compilers/swift/default.nix +++ b/pkgs/development/compilers/swift/default.nix @@ -25,13 +25,9 @@ let # # The following selects the correct Clang version, matching the version # used in Swift, and applies the same libc overrides as `apple_sdk.stdenv`. - clang = let - # https://github.com/NixOS/nixpkgs/issues/295322 - clangNoMarch = swiftLlvmPackages.clang.override { disableMarch = true; }; - in - if pkgs.stdenv.isDarwin + clang = if pkgs.stdenv.isDarwin then - clangNoMarch.override rec { + swiftLlvmPackages.clang.override rec { libc = apple_sdk.Libsystem; bintools = pkgs.bintools.override { inherit libc; }; # Ensure that Swift’s internal clang uses the same libc++ and libc++abi as the @@ -41,7 +37,7 @@ let inherit (llvmPackages) libcxx; } else - clangNoMarch; + swiftLlvmPackages.clang; # Overrides that create a useful environment for swift packages, allowing # packaging with `swiftPackages.callPackage`. These are similar to