Skip to content

haskell.compiler.ghc94: don't roundtrip C compilation via assembly#410085

Merged
sternenseemann merged 1 commit intoNixOS:haskell-updatesfrom
sternenseemann:ghc-9.4-no-asm
May 28, 2025
Merged

haskell.compiler.ghc94: don't roundtrip C compilation via assembly#410085
sternenseemann merged 1 commit intoNixOS:haskell-updatesfrom
sternenseemann:ghc-9.4-no-asm

Conversation

@sternenseemann
Copy link
Member

GHC can be used to compile C sources which causes it to drive the configured C compiler. This is particularly relevant during GHC's own compilation, e.g. when building the rts. GHC takes a peculiar approach, always generating intermediate assembly instead of letting the C compiler emit object files directly. This causes an assembler check in clang >= 18 to fail on rts/StgCRun.c, failing the GHC build on darwin completely.

Later GHC versions don't exhibit this issue since object code is emitted directly since 9.6. The easiest way to resolve the compilation failure seems to backport this change. However, the patch only applies on GHC 9.4 which is done here. The patch may be difficult to backport further, as the changed code was extensively refactored in GHC 9.4.

Reference #367686.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • Nixpkgs 25.11 Release Notes (or backporting 24.11 and 25.05 Nixpkgs Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
  • NixOS 25.11 Release Notes (or backporting 24.11 and 25.05 NixOS Release notes)
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@github-actions github-actions bot added the 6.topic: haskell General-purpose, statically typed, purely functional programming language label May 23, 2025
@nix-owners nix-owners bot requested review from maralorn and wolfgangwalther May 23, 2025 09:01
@github-actions github-actions bot added 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 11.by: package-maintainer This PR was created by a maintainer of all the package it changes. labels May 23, 2025
@nix-owners nix-owners bot requested review from cdepillabout and guibou May 23, 2025 09:06
GHC can be used to compile C sources which causes it to drive the
configured C compiler. This is particularly relevant during GHC's own
compilation, e.g. when building the rts. GHC takes a peculiar approach,
always generating intermediate assembly instead of letting the C
compiler emit object files directly. This causes an assembler check in
clang >= 18 to fail on rts/StgCRun.c, failing the GHC build on darwin
completely.

Later GHC versions don't exhibit this issue since object code is emitted
directly since 9.6. The easiest way to resolve the compilation failure
seems to backport this change. However, the patch only applies on
GHC 9.4 which is done here. The patch may be difficult to backport
further, as the changed code was extensively refactored in GHC 9.4.

Reference NixOS#367686.
@sternenseemann sternenseemann changed the title haskell.compiler.ghc94: don't runtrip C compilation via assembly haskell.compiler.ghc94: don't roundtrip C compilation via assembly May 23, 2025
@sternenseemann sternenseemann changed the base branch from master to haskell-updates May 27, 2025 13:10
@nixpkgs-ci nixpkgs-ci bot closed this May 27, 2025
@nixpkgs-ci nixpkgs-ci bot reopened this May 27, 2025
sternenseemann added a commit to sternenseemann/nixpkgs that referenced this pull request May 27, 2025
We can/should use 9.0.2 to bootstrap some GHC versions, having the
bindist makes things easier in some cases.

- To bootstrap GHC 9.4 using 9.2 is not possible and 8.10.7 doesn't
  always work. Since source built 9.0.2 is broken on darwin at the
  moment, the bindist helps. Reference NixOS#367686, NixOS#410085.
- To bootstrap GHC 9.2 without GHC 8.10. Reference NixOS#346214.
@sternenseemann sternenseemann merged commit 16dca70 into NixOS:haskell-updates May 28, 2025
34 of 35 checks passed
@sternenseemann sternenseemann deleted the ghc-9.4-no-asm branch May 28, 2025 11:35
@nixpkgs-ci
Copy link
Contributor

nixpkgs-ci bot commented May 28, 2025

Successfully created backport PR for release-25.05:

@github-actions github-actions bot added the 8.has: port to stable This PR already has a backport to the stable release. label May 28, 2025
sternenseemann added a commit that referenced this pull request May 30, 2025
We can/should use 9.0.2 to bootstrap some GHC versions, having the
bindist makes things easier in some cases.

- To bootstrap GHC 9.4 using 9.2 is not possible and 8.10.7 doesn't
  always work. Since source built 9.0.2 is broken on darwin at the
  moment, the bindist helps. Reference #367686, #410085.
- To bootstrap GHC 9.2 without GHC 8.10. Reference #346214.
wolfgangwalther pushed a commit that referenced this pull request Jun 29, 2025
We can/should use 9.0.2 to bootstrap some GHC versions, having the
bindist makes things easier in some cases.

- To bootstrap GHC 9.4 using 9.2 is not possible and 8.10.7 doesn't
  always work. Since source built 9.0.2 is broken on darwin at the
  moment, the bindist helps. Reference #367686, #410085.
- To bootstrap GHC 9.2 without GHC 8.10. Reference #346214.

(cherry picked from commit bc59fa9)
wolfgangwalther pushed a commit that referenced this pull request Jun 30, 2025
We can/should use 9.0.2 to bootstrap some GHC versions, having the
bindist makes things easier in some cases.

- To bootstrap GHC 9.4 using 9.2 is not possible and 8.10.7 doesn't
  always work. Since source built 9.0.2 is broken on darwin at the
  moment, the bindist helps. Reference #367686, #410085.
- To bootstrap GHC 9.2 without GHC 8.10. Reference #346214.

(cherry picked from commit 221e06a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: haskell General-purpose, statically typed, purely functional programming language 8.has: port to stable This PR already has a backport to the stable release. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 11.by: package-maintainer This PR was created by a maintainer of all the package it changes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant