diff options
author | Randy Eckenrode <randy@largeandhighquality.com> | 2024-06-27 10:12:19 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-27 10:12:19 -0400 |
commit | 442c0e86836a1c087782798b9a27548d42507fdf (patch) | |
tree | 460e74edda8126ea7d2154ecf2fed4de8e1cf6a5 /pkgs/top-level | |
parent | 677389dc9fc13a55896a987847f6b63abc9b7315 (diff) | |
parent | c6e9b98725abff0f5f9b72f6363d98298aba0c88 (diff) |
Merge pull request #322388 from reckenrode/binutils-darwin-fix
Diffstat (limited to 'pkgs/top-level')
-rw-r--r-- | pkgs/top-level/all-packages.nix | 2 | ||||
-rw-r--r-- | pkgs/top-level/darwin-packages.nix | 36 |
2 files changed, 25 insertions, 13 deletions
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 337584705119d..6909d3288fd9f 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1363,7 +1363,7 @@ with pkgs; fixDarwinDylibNames = makeSetupHook { name = "fix-darwin-dylib-names-hook"; - substitutions = { inherit (binutils) targetPrefix; }; + substitutions = { inherit (darwin.binutils) targetPrefix; }; meta.platforms = lib.platforms.darwin; } ../build-support/setup-hooks/fix-darwin-dylib-names.sh; diff --git a/pkgs/top-level/darwin-packages.nix b/pkgs/top-level/darwin-packages.nix index cca74e047dbdd..69d22c8b9625e 100644 --- a/pkgs/top-level/darwin-packages.nix +++ b/pkgs/top-level/darwin-packages.nix @@ -83,8 +83,8 @@ impure-cmds // appleSourcePackages // chooseLibs // { }; binutils-unwrapped = callPackage ../os-specific/darwin/binutils { - inherit (pkgs) binutils-unwrapped; - inherit (pkgs.llvmPackages) llvm clang-unwrapped; + inherit (self) cctools; + inherit (pkgs.llvmPackages) clang-unwrapped llvm llvm-manpages; }; binutils = pkgs.wrapBintoolsWith { @@ -95,17 +95,29 @@ impure-cmds // appleSourcePackages // chooseLibs // { bintools = self.binutils-unwrapped; }; - binutilsDualAs-unwrapped = callPackage ../os-specific/darwin/binutils { - inherit (pkgs) binutils-unwrapped; - inherit (pkgs.llvmPackages) llvm clang-unwrapped; - dualAs = true; + # x86-64 Darwin gnat-bootstrap emits assembly + # with MOVQ as the mnemonic for quadword interunit moves + # such as `movq %rbp, %xmm0`. + # The clang integrated assembler recognises this as valid, + # but unfortunately the cctools.gas GNU assembler does not; + # it instead uses MOVD as the mnemonic. + # The assembly that a GCC build emits is determined at build time + # and cannot be changed afterwards. + # + # To build GNAT on x86-64 Darwin, therefore, + # we need both the clang _and_ the cctools.gas assemblers to be available: + # the former to build at least the stage1 compiler, + # and the latter at least to be detectable + # as the target for the final compiler. + binutilsDualAs-unwrapped = pkgs.buildEnv { + name = "${lib.getName self.binutils-unwrapped}-dualas-${lib.getVersion self.binutils-unwrapped}"; + paths = [ + self.binutils-unwrapped + (lib.getOutput "gas" self.cctools) + ]; }; - binutilsDualAs = pkgs.wrapBintoolsWith { - libc = - if stdenv.targetPlatform != stdenv.hostPlatform - then pkgs.libcCross - else pkgs.stdenv.cc.libc; + binutilsDualAs = self.binutils.override { bintools = self.binutilsDualAs-unwrapped; }; @@ -114,7 +126,7 @@ impure-cmds // appleSourcePackages // chooseLibs // { bintools = self.binutils-unwrapped; }; - cctools = self.cctools-llvm; + cctools = self.cctools-port; cctools-apple = callPackage ../os-specific/darwin/cctools/apple.nix { stdenv = if stdenv.isDarwin then stdenv else pkgs.libcxxStdenv; |