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.
This commit is contained in:
parent
effe752c61
commit
a730703e6f
@ -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;
|
||||
};
|
||||
|
@ -23,7 +23,7 @@ in
|
||||
binutils-unwrapped = callPackage ../os-specific/darwin/binutils {
|
||||
inherit (darwin) cctools;
|
||||
inherit (pkgs) binutils-unwrapped;
|
||||
inherit (pkgs.llvmPackages_7) llvm;
|
||||
inherit (pkgs.llvmPackages_7) llvm clang-unwrapped;
|
||||
};
|
||||
|
||||
binutils = pkgs.wrapBintoolsWith {
|
||||
|
Loading…
Reference in New Issue
Block a user