-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
haskell.compiler.ghc{948,967,984,9102,9103,9121,9122}: backport patches for LLVM support #440774
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
7d28e61
haskell.compiler.ghc948: drop obsolete `configure` patch
emilazy 6664f31
haskell.compiler.ghc948: use `autoreconfHook`
emilazy 5923f1f
haskell.compiler.ghc948: don’t patch both `aclocal.m4` and `configure`
emilazy b6be8a0
haskell.compiler.ghc{948,967,984,9102,9103,9121,9122}: backport patch…
emilazy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,126 @@ | ||
| { | ||
| lib, | ||
| version, | ||
| fetchpatch, | ||
| }: | ||
|
|
||
| # Backports for LLVM support. | ||
| # | ||
| # These primarily focus on backporting patches that are relevant to | ||
| # supporting newer LLVM versions, rather than aiming to backport every | ||
| # LLVM backend bug fix or improvement from newer GHC releases. | ||
| # | ||
| # Potentially of interest for cross‐compiling GHC 9.4.8 to LoongArch64: | ||
| # | ||
| # * <https://gitlab.haskell.org/ghc/ghc/-/merge_requests/9292> | ||
| # * <https://gitlab.haskell.org/ghc/ghc/-/merge_requests/13620> | ||
|
|
||
| [ ] | ||
|
|
||
| ++ lib.optionals (lib.versionOlder version "9.6") [ | ||
| # <https://gitlab.haskell.org/ghc/ghc/-/merge_requests/9857> | ||
| (fetchpatch { | ||
| name = "ghc-9.4-llvm-support-15.patch"; | ||
| url = "https://gitlab.haskell.org/ghc/ghc/-/commit/0cc16aaf89d7dc3963764b7193ceac73e4e3329b.patch"; | ||
| hash = "sha256-G0gqrj5iPuQ5JuC2+d151yka72XZMbrqMWPZd4EuT04="; | ||
| }) | ||
|
|
||
| # <https://gitlab.haskell.org/ghc/ghc/-/merge_requests/13763> | ||
| ./ghc-9.4-llvm-fix-version-detection.patch | ||
| ] | ||
|
|
||
| ++ lib.optionals (lib.versionOlder version "9.8") [ | ||
| ( | ||
| # The upstream backport of !13763 in 9.6.7 removed an unused import | ||
| # that is required by the next series. | ||
| if lib.versionOlder version "9.6" then null else ./ghc-9.6-llvm-restore-import.patch | ||
| ) | ||
| ] | ||
|
|
||
| ++ lib.optionals (lib.versionOlder version "9.10") [ | ||
| # <https://gitlab.haskell.org/ghc/ghc/-/merge_requests/11124> | ||
| ( | ||
| if lib.versionOlder version "9.8" then | ||
| ./ghc-9.4-llvm-add-metadata-exports.patch | ||
| else | ||
| fetchpatch { | ||
| name = "ghc-9.8-llvm-add-metadata-exports.patch"; | ||
| url = "https://gitlab.haskell.org/ghc/ghc/-/commit/fcfc1777c22ad47613256c3c5e7304cfd29bc761.patch"; | ||
| hash = "sha256-9rpyeH8TUVeKoW4PA6qn7DG2+P9MhBCywmbi1O/NsTQ="; | ||
| } | ||
| ) | ||
| ( | ||
| if lib.versionOlder version "9.8" then | ||
| ./ghc-9.4-llvm-allow-llvmlits-in-metaexprs.patch | ||
| else | ||
| fetchpatch { | ||
| name = "ghc-9.8-llvm-allow-llvmlits-in-metaexprs.patch"; | ||
| url = "https://gitlab.haskell.org/ghc/ghc/-/commit/5880fff6d353a14785c457999fded5a7100c9514.patch"; | ||
| hash = "sha256-NDMGNc0PYpWJUW+nI2YvMsBOWRIfNix4oWHQZAIxrVY="; | ||
| } | ||
| ) | ||
| ( | ||
| # `GHC.Driver.DynFlags` was not split out until 9.8, so this can be | ||
| # omitted with no functional effect on the rest of the series on | ||
| # earlier versions. | ||
| if lib.versionOlder version "9.8" then | ||
| null | ||
| else | ||
| fetchpatch { | ||
| name = "ghc-9.8-move-feature-predicates-to-dynflags.patch"; | ||
| url = "https://gitlab.haskell.org/ghc/ghc/-/commit/86ce92a2f81a04aa980da2891d0e300cb3cb7efd.patch"; | ||
| hash = "sha256-SzJgzq4b5wAMPz+/QSa67iSOxB2enqejvV0lsF0+9L8="; | ||
| } | ||
| ) | ||
| (fetchpatch { | ||
| name = "ghc-9.4-llvm-add-module-flag-metadata-infra.patch"; | ||
| url = "https://gitlab.haskell.org/ghc/ghc/-/commit/a6a3874276ced1b037365c059dcd0a758e813a5b.patch"; | ||
| hash = "sha256-tAYDRNXmpp5cZtyONpO8vlsDmnNEBbh4J3oSCy/uWWc="; | ||
| }) | ||
| ( | ||
| if lib.versionOlder version "9.8" then | ||
| ./ghc-9.4-llvm-fix-stack-alignment.patch | ||
| else | ||
| fetchpatch { | ||
| name = "ghc-9.8-llvm-fix-stack-alignment.patch"; | ||
| url = "https://gitlab.haskell.org/ghc/ghc/-/commit/e9af2cf3f16ab60b5c79ed91df95359b11784df6.patch"; | ||
| hash = "sha256-RmYwFN3c3AgJxF9KXWQLdwOgugzepCW1wcTdJX1h0C4="; | ||
| } | ||
| ) | ||
|
|
||
| # <https://gitlab.haskell.org/ghc/ghc/-/merge_requests/8999> | ||
| ( | ||
| if lib.versionOlder version "9.6" then | ||
| ./ghc-9.4-llvm-use-new-pass-manager.patch | ||
| else if lib.versionOlder version "9.8" then | ||
| ./ghc-9.6-llvm-use-new-pass-manager.patch | ||
| else | ||
| ./ghc-9.8-llvm-use-new-pass-manager.patch | ||
| ) | ||
| ] | ||
|
|
||
| ++ lib.optionals (lib.versionOlder version "9.12") [ | ||
| # <https://gitlab.haskell.org/ghc/ghc/-/merge_requests/12726> | ||
| (fetchpatch { | ||
| name = "ghc-9.4-llvm-support-16-17-18.patch"; | ||
| url = "https://gitlab.haskell.org/ghc/ghc/-/commit/ae170155e82f1e5f78882f7a682d02a8e46a5823.patch"; | ||
| hash = "sha256-U1znWqXZTORmAg480p5TjTL53T2Zn+1+9Fnk2V1Drfs="; | ||
| }) | ||
|
|
||
| # <https://gitlab.haskell.org/ghc/ghc/-/merge_requests/13311> | ||
| (fetchpatch { | ||
| name = "ghc-9.4-llvm-support-19.patch"; | ||
| url = "https://gitlab.haskell.org/ghc/ghc/-/commit/36bbb167f354a2fbc6c4842755f2b1e374e3580e.patch"; | ||
| excludes = [ ".gitlab-ci.yml" ]; | ||
| hash = "sha256-v8T/FtriDPbibcIDZmU2yotBoDVo+wU2+gw+CCdQlm0="; | ||
| }) | ||
| ] | ||
|
|
||
| ++ lib.optionals (lib.versionOlder version "9.14") [ | ||
| # <https://gitlab.haskell.org/ghc/ghc/-/merge_requests/14600> | ||
| (fetchpatch { | ||
| name = "ghc-9.4-llvm-support-20.patch"; | ||
| url = "https://gitlab.haskell.org/ghc/ghc/-/commit/ca03226db2db2696460bfcb8035dd3268d546706.patch"; | ||
| hash = "sha256-7cO049DQtJHUAhwPujoFO+zQtXsMg6VFTHtMDwenrKs="; | ||
| }) | ||
| ] | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
pkgs/development/compilers/ghc/ghc-9.4-llvm-add-metadata-exports.patch
wolfgangwalther marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| From 701154fdbceff2edb121768eb660713a98580af8 Mon Sep 17 00:00:00 2001 | ||
| From: Ben Gamari <ben@smart-cactus.org> | ||
| Date: Tue, 22 Aug 2023 12:23:26 -0400 | ||
| Subject: [PATCH] llvmGen: Add export list to GHC.Llvm.MetaData | ||
|
|
||
| (cherry picked from commit fcfc1777c22ad47613256c3c5e7304cfd29bc761) | ||
| --- | ||
| compiler/GHC/Llvm/MetaData.hs | 8 +++++++- | ||
| 1 file changed, 7 insertions(+), 1 deletion(-) | ||
|
|
||
| diff --git a/compiler/GHC/Llvm/MetaData.hs b/compiler/GHC/Llvm/MetaData.hs | ||
| index f46ae0a101..3526c11bc3 100644 | ||
| --- a/compiler/GHC/Llvm/MetaData.hs | ||
| +++ b/compiler/GHC/Llvm/MetaData.hs | ||
| @@ -1,6 +1,12 @@ | ||
| {-# LANGUAGE GeneralizedNewtypeDeriving #-} | ||
|
|
||
| -module GHC.Llvm.MetaData where | ||
| +module GHC.Llvm.MetaData | ||
| + ( MetaId(..) | ||
| + , ppr | ||
| + , MetaExpr(..) | ||
| + , MetaAnnot(..) | ||
| + , MetaDecl(..) | ||
| + ) where | ||
|
|
||
| import GHC.Prelude | ||
|
|
||
| -- | ||
| 2.50.1 | ||
|
|
40 changes: 40 additions & 0 deletions
40
pkgs/development/compilers/ghc/ghc-9.4-llvm-allow-llvmlits-in-metaexprs.patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| From 51765e343e9829f1d3e95d1d7303fa3594ae91cc Mon Sep 17 00:00:00 2001 | ||
| From: Ben Gamari <ben@smart-cactus.org> | ||
| Date: Tue, 22 Aug 2023 12:24:53 -0400 | ||
| Subject: [PATCH] llvmGen: Allow LlvmLits in MetaExprs | ||
|
|
||
| This omission appears to be an oversight. | ||
|
|
||
| (cherry picked from commit 5880fff6d353a14785c457999fded5a7100c9514) | ||
| --- | ||
| compiler/GHC/Llvm/MetaData.hs | 1 + | ||
| compiler/GHC/Llvm/Ppr.hs | 1 + | ||
| 2 files changed, 2 insertions(+) | ||
|
|
||
| diff --git a/compiler/GHC/Llvm/MetaData.hs b/compiler/GHC/Llvm/MetaData.hs | ||
| index f46ae0a101..121cdd5788 100644 | ||
| --- a/compiler/GHC/Llvm/MetaData.hs | ||
| +++ b/compiler/GHC/Llvm/MetaData.hs | ||
| @@ -68,6 +68,7 @@ instance Outputable MetaId where | ||
|
|
||
| -- | LLVM metadata expressions | ||
| data MetaExpr = MetaStr !LMString | ||
| + | MetaLit !LlvmLit | ||
| | MetaNode !MetaId | ||
| | MetaVar !LlvmVar | ||
| | MetaStruct [MetaExpr] | ||
| diff --git a/compiler/GHC/Llvm/Ppr.hs b/compiler/GHC/Llvm/Ppr.hs | ||
| index f48e7aa034..bc88a13439 100644 | ||
| --- a/compiler/GHC/Llvm/Ppr.hs | ||
| +++ b/compiler/GHC/Llvm/Ppr.hs | ||
| @@ -256,6 +256,7 @@ ppMetaExpr :: LlvmCgConfig -> MetaExpr -> SDoc | ||
| ppMetaExpr opts = \case | ||
| MetaVar (LMLitVar (LMNullLit _)) -> text "null" | ||
| MetaStr s -> char '!' <> doubleQuotes (ftext s) | ||
| + MetaLit l -> ppTypeLit opts l | ||
| MetaNode n -> ppr n | ||
| MetaVar v -> ppVar opts v | ||
| MetaStruct es -> char '!' <> braces (ppCommaJoin (map (ppMetaExpr opts) es)) | ||
| -- | ||
| 2.50.1 | ||
|
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This versionOlder could be floated in the condition above like it used to be?!
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I switched it because this was the only
lib.optionalswith a dual condition – everything else is just a plain “version is older” – and we have some existingif lib.versionOlder … then … else …cases, including another one withnull, so this seemed more consistent. But I’m ambivalent.