haskell.packages.ghc96.tls: fix missing LLVM tools on aarch64

The original change missed that we used to erroneously provide LLVM on
aarch64-linux, but not on aarch64-darwin which was later fixed
in #246045. Since the change was tested on aarch64-linux prior to this,
tls ended up being broken on both aarch64-linux and aarch64-darwin.

This commit resolves the situation by introducing a helper function to
achieve the effect of passing -fllvm while ensuring LLVM is provided.

Resolves #260013.
This commit is contained in:
sternenseemann
2023-10-22 19:18:13 +02:00
parent 4a47fc9395
commit 5ea114083c
2 changed files with 15 additions and 3 deletions
@@ -272,7 +272,5 @@ self: super: {
# the workaround on 9.6 is to revert to the LLVM backend (which is used
# for these sorts of situations even on 9.2 and 9.4).
# https://gitlab.haskell.org/ghc/ghc/-/issues/23746#note_525318
tls = appendConfigureFlags
(lib.optionals pkgs.stdenv.hostPlatform.isAarch64 [ "--ghc-option=-fllvm" ])
super.tls;
tls = if pkgs.stdenv.hostPlatform.isAarch64 then self.forceLlvmCodegenBackend super.tls else super.tls;
}
@@ -625,4 +625,18 @@ in package-set { inherit pkgs lib callPackage; } self // {
else pkg
) { };
/*
Modify given Haskell package to force GHC to employ the LLVM
codegen backend when compiling. Useful when working around bugs
in a native codegen backend GHC defaults to.
Example:
forceLlvmCodegenBackend tls
Type: drv -> drv
*/
forceLlvmCodegenBackend = haskellLib.overrideCabal (drv: {
configureFlags = drv.configureFlags or [ ] ++ [ "--ghc-option=-fllvm" ];
buildTools = drv.buildTools or [ ] ++ [ self.llvmPackages.llvm ];
});
}