Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 38 additions & 1 deletion pkgs/development/compilers/ghc/common-make-native-bignum.nix
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,44 @@ stdenv.mkDerivation (
else
./Cabal-3.2-3.4-paths-fix-cycle-aarch64-darwin.patch
)
];
]
# Before GHC 9.6, GHC, when used to compile C sources (i.e. to drive the CC), would first
# invoke the C compiler to generate assembly and later call the assembler on the result of
# that operation. Unfortunately, that is brittle in a lot of cases, e.g. when using mismatched
# CC / assembler (https://gitlab.haskell.org/ghc/ghc/-/merge_requests/12005). This issue
# does not affect us. However, LLVM 18 introduced a check in clang that makes sure no
# non private labels occur between .cfi_startproc and .cfi_endproc which causes the
# assembly that the same version (!) of clang generates from rts/StgCRun.c to be rejected.
# This causes GHC to fail compilation on mach-o platforms ever since we upgraded to
# LLVM 19.
#
# clang compiles the same file without issues whithout the roundtrip via assembly. Thus,
# the solution is to backport those changes from GHC 9.6 that skip the intermediate
# assembly step.
#
# https://gitlab.haskell.org/ghc/ghc/-/issues/25608#note_622589
# https://gitlab.haskell.org/ghc/ghc/-/merge_requests/6877
++ (
if lib.versionAtLeast version "9.4" then
[
# Need to use this patch so the next one applies, passes file location info to the cc phase
(fetchpatch {
name = "ghc-add-location-to-cc-phase.patch";
url = "https://gitlab.haskell.org/ghc/ghc/-/commit/4a7256a75af2fc0318bef771a06949ffb3939d5a.patch";
hash = "sha256-DnTI+i1zMebeWvw75D59vMaEEBb2Nr9HusxTyhmdy2M=";
})
# Makes Cc phase directly generate object files instead of assembly
(fetchpatch {
name = "ghc-cc-directly-emit-object.patch";
url = "https://gitlab.haskell.org/ghc/ghc/-/commit/96811ba491495b601ec7d6a32bef8563b0292109.patch";
hash = "sha256-G8u7/MK/tGOEN8Wxccxj/YIOP7mL2G9Co1WKdHXOo6I=";
})
]
else
[
# TODO(@sternenseemann): backport changes to GHC < 9.4 if possible
]
);

postPatch = "patchShebangs .";

Expand Down