diff options
author | Ivan Babrou <github@ivan.computer> | 2021-03-16 21:27:34 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-17 00:27:34 -0400 |
commit | a730703e6f48d0d3189dc21115d7f8b9495489e5 (patch) | |
tree | 12465dca6dfbf026816e1fef2b3508aa1b519e74 /pkgs/os-specific/darwin/binutils | |
parent | effe752c6113a70b487248c56861d90e8b14ac15 (diff) |
darwin.binutils: use clang for as on aarch64-darwin (#115167)
Without this change `as` on `aarch64-darwin` is defunct: ``` $ /nix/store/g11xba8ch20zndaf32hfnap46z47b5k3-cctools-port-949.0.1/bin/as -v /nix/store/g11xba8ch20zndaf32hfnap46z47b5k3-cctools-port-949.0.1/bin/as: assembler (/nix/store/g11xba8ch20zndaf32hfnap46z47b5k3-cctools-port-949.0.1/libexec/as/arm64/as or /nix/store/g11xba8ch20zndaf32hfnap46z47b5k3-cctools-port-949.0.1/libexec/as/arm64/as) for architecture arm64 not installed Installed assemblers are: /nix/store/g11xba8ch20zndaf32hfnap46z47b5k3-cctools-port-949.0.1/libexec/as/ppc64/as for architecture ppc64 /nix/store/g11xba8ch20zndaf32hfnap46z47b5k3-cctools-port-949.0.1/libexec/as/x86_64/as for architecture x86_64 /nix/store/g11xba8ch20zndaf32hfnap46z47b5k3-cctools-port-949.0.1/libexec/as/ppc/as for architecture ppc /nix/store/g11xba8ch20zndaf32hfnap46z47b5k3-cctools-port-949.0.1/libexec/as/i386/as for architecture i386 /nix/store/g11xba8ch20zndaf32hfnap46z47b5k3-cctools-port-949.0.1/libexec/as/arm/as for architecture arm ``` Apple defaults to Clang in all cases from what I see, but nixpkgs prefers `cctools`: #51881.
Diffstat (limited to 'pkgs/os-specific/darwin/binutils')
-rw-r--r-- | pkgs/os-specific/darwin/binutils/default.nix | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/pkgs/os-specific/darwin/binutils/default.nix b/pkgs/os-specific/darwin/binutils/default.nix index e9aa706da2d35..29ae1871ddb14 100644 --- a/pkgs/os-specific/darwin/binutils/default.nix +++ b/pkgs/os-specific/darwin/binutils/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, binutils-unwrapped, cctools, llvm }: +{ lib, stdenv, makeWrapper, binutils-unwrapped, cctools, llvm, clang-unwrapped }: # Make sure both underlying packages claim to have prepended their binaries # with the same targetPrefix. @@ -49,8 +49,19 @@ stdenv.mkDerivation { ln -sv "$path" "$dest_path" done done + '' + # On aarch64-darwin we must use clang, because "as" from cctools just doesn't + # handle the arch. Proxying calls to clang produces quite a bit of warnings, + # and using clang directly here is a better option than relying on cctools. + # On x86_64-darwin the Clang version is too old to support this mode. + + lib.optionalString stdenv.isAarch64 '' + rm $out/bin/as + makeWrapper "${clang-unwrapped}/bin/clang" "$out/bin/as" \ + --add-flags "-x assembler -integrated-as -c" ''; + nativeBuildInputs = lib.optionals stdenv.isAarch64 [ makeWrapper ]; + passthru = { inherit targetPrefix; }; |