mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-09-22 06:01:26 +02:00
Since ghc depends on it self it becomes non-trivial to libffi with ABI breaking changes. Doing so would require 2 different version of libffi to be available at the same time (old version to make gch runtime work, and new version to rebuild ghc with). We simplify things by simply using the bundled libffi, so system libffi is completely unrelated. The bundled libffi is built shared but is installed under /usr/lib/ghc-* so we set ldpath so abuild can find it and avoid pull in dependency of external libffi. Make sure that we don't use ld.gold, which seems to be buggy. https://gitlab.haskell.org/ghc/ghc/-/issues/17508 Pin llvm12 and ad patches from upstream to make the testsuite pass with llvm12. Skip some tests that are known to fail. Replace the autoconf-ac-prog-c99-fix.patch patch with the corresponding patches from upstream. Drop build options: - INTEGER_LIBRARY=integer-gmp: upstream replaced integer-gmp with a unified ghc-bignum https://gitlab.haskell.org/ghc/ghc/-/merge_requests/2231 - BeConservative, GhcStage3HcOpts, SplitSections: Those seems to have caused test suite to fail. Removing them made test suite pass. Clean up the dev() function to use amove instead of cpio.
144 lines
6.5 KiB
Diff
144 lines
6.5 KiB
Diff
From 5279eac5ce1a82d661dfaa911e892a591c7f95c0 Mon Sep 17 00:00:00 2001
|
|
From: Zubin Duggal <zubin.duggal@gmail.com>
|
|
Date: Thu, 17 Jun 2021 16:25:46 +0530
|
|
Subject: [PATCH 5/9] Set min LLVM version to 9 and make version checking use a
|
|
non-inclusive upper bound.
|
|
|
|
We use a non-inclusive upper bound so that setting the upper bound to 13 for
|
|
example means that all 12.x versions are accepted.
|
|
---
|
|
aclocal.m4 | 2 +-
|
|
compiler/GHC/CmmToLlvm.hs | 6 +++---
|
|
compiler/GHC/CmmToLlvm/Base.hs | 16 +++++++++-------
|
|
compiler/GHC/SysTools/Tasks.hs | 9 +++++----
|
|
configure.ac | 4 ++--
|
|
5 files changed, 20 insertions(+), 17 deletions(-)
|
|
|
|
diff --git a/aclocal.m4 b/aclocal.m4
|
|
index a296dbc243..0219ea3a61 100644
|
|
--- a/aclocal.m4
|
|
+++ b/aclocal.m4
|
|
@@ -2251,7 +2251,7 @@ AC_DEFUN([FIND_LLVM_PROG],[
|
|
[AC_MSG_RESULT(no)
|
|
$1=""
|
|
AC_MSG_NOTICE([We only support llvm $3 to $4 (found $PROG_VERSION).])],
|
|
- [AX_COMPARE_VERSION([$PROG_VERSION], [gt], [$4],
|
|
+ [AX_COMPARE_VERSION([$PROG_VERSION], [ge], [$4],
|
|
[AC_MSG_RESULT(no)
|
|
$1=""
|
|
AC_MSG_NOTICE([We only support llvm $3 to $4 (found $PROG_VERSION).])],
|
|
diff --git a/compiler/GHC/CmmToLlvm.hs b/compiler/GHC/CmmToLlvm.hs
|
|
index 0d2ecb16be..8bc7dc65b4 100644
|
|
--- a/compiler/GHC/CmmToLlvm.hs
|
|
+++ b/compiler/GHC/CmmToLlvm.hs
|
|
@@ -64,8 +64,8 @@ llvmCodeGen dflags h cmm_stream
|
|
let doWarn = wopt Opt_WarnUnsupportedLlvmVersion dflags
|
|
when (not (llvmVersionSupported ver) && doWarn) $ putMsg dflags $
|
|
"You are using an unsupported version of LLVM!" $$
|
|
- "Currently only" <+> text (llvmVersionStr supportedLlvmVersionMin) <+>
|
|
- "to" <+> text (llvmVersionStr supportedLlvmVersionMax) <+> "is supported." <+>
|
|
+ "Currently only" <+> text (llvmVersionStr supportedLlvmVersionLowerBound) <+>
|
|
+ "to" <+> text (llvmVersionStr supportedLlvmVersionUpperBound) <+> "is supported." <+>
|
|
"System LLVM version: " <> text (llvmVersionStr ver) $$
|
|
"We will try though..."
|
|
let isS390X = platformArch (targetPlatform dflags) == ArchS390X
|
|
@@ -78,7 +78,7 @@ llvmCodeGen dflags h cmm_stream
|
|
-- currently don't use the LLVM version to guide code generation
|
|
-- so this is okay.
|
|
let llvm_ver :: LlvmVersion
|
|
- llvm_ver = fromMaybe supportedLlvmVersionMin mb_ver
|
|
+ llvm_ver = fromMaybe supportedLlvmVersionLowerBound mb_ver
|
|
|
|
-- run code generation
|
|
a <- runLlvm dflags llvm_ver bufh $
|
|
diff --git a/compiler/GHC/CmmToLlvm/Base.hs b/compiler/GHC/CmmToLlvm/Base.hs
|
|
index a47bfd3baa..86f9944f59 100644
|
|
--- a/compiler/GHC/CmmToLlvm/Base.hs
|
|
+++ b/compiler/GHC/CmmToLlvm/Base.hs
|
|
@@ -15,7 +15,7 @@ module GHC.CmmToLlvm.Base (
|
|
LiveGlobalRegs,
|
|
LlvmUnresData, LlvmData, UnresLabel, UnresStatic,
|
|
|
|
- LlvmVersion, supportedLlvmVersionMin, supportedLlvmVersionMax,
|
|
+ LlvmVersion, supportedLlvmVersionLowerBound, supportedLlvmVersionUpperBound,
|
|
llvmVersionSupported, parseLlvmVersion,
|
|
llvmVersionStr, llvmVersionList,
|
|
|
|
@@ -265,7 +265,6 @@ llvmPtrBits platform = widthInBits $ typeWidth $ gcWord platform
|
|
-- * Llvm Version
|
|
--
|
|
|
|
--- Newtype to avoid using the Eq instance!
|
|
newtype LlvmVersion = LlvmVersion { llvmVersionNE :: NE.NonEmpty Int }
|
|
deriving (Eq, Ord)
|
|
|
|
@@ -283,14 +282,17 @@ parseLlvmVersion =
|
|
where
|
|
(ver_str, rest) = span isDigit s
|
|
|
|
--- | The LLVM Version that is currently supported.
|
|
-supportedLlvmVersionMin, supportedLlvmVersionMax :: LlvmVersion
|
|
-supportedLlvmVersionMin = LlvmVersion (sUPPORTED_LLVM_VERSION_MIN NE.:| [])
|
|
-supportedLlvmVersionMax = LlvmVersion (sUPPORTED_LLVM_VERSION_MAX NE.:| [])
|
|
+-- | The (inclusive) lower bound on the LLVM Version that is currently supported.
|
|
+supportedLlvmVersionLowerBound :: LlvmVersion
|
|
+supportedLlvmVersionLowerBound = LlvmVersion (sUPPORTED_LLVM_VERSION_MIN NE.:| [])
|
|
+
|
|
+-- | The (not-inclusive) upper bound bound on the LLVM Version that is currently supported.
|
|
+supportedLlvmVersionUpperBound :: LlvmVersion
|
|
+supportedLlvmVersionUpperBound = LlvmVersion (sUPPORTED_LLVM_VERSION_MAX NE.:| [])
|
|
|
|
llvmVersionSupported :: LlvmVersion -> Bool
|
|
llvmVersionSupported v =
|
|
- v > supportedLlvmVersionMin && v <= supportedLlvmVersionMax
|
|
+ v >= supportedLlvmVersionLowerBound && v < supportedLlvmVersionUpperBound
|
|
|
|
llvmVersionStr :: LlvmVersion -> String
|
|
llvmVersionStr = intercalate "." . map show . llvmVersionList
|
|
diff --git a/compiler/GHC/SysTools/Tasks.hs b/compiler/GHC/SysTools/Tasks.hs
|
|
index 1ab3a0a425..4d5158e940 100644
|
|
--- a/compiler/GHC/SysTools/Tasks.hs
|
|
+++ b/compiler/GHC/SysTools/Tasks.hs
|
|
@@ -11,7 +11,7 @@ module GHC.SysTools.Tasks where
|
|
|
|
import GHC.Utils.Exception as Exception
|
|
import GHC.Utils.Error
|
|
-import GHC.CmmToLlvm.Base (LlvmVersion, llvmVersionStr, supportedLlvmVersionMin, supportedLlvmVersionMax, llvmVersionStr, parseLlvmVersion)
|
|
+import GHC.CmmToLlvm.Base (LlvmVersion, llvmVersionStr, supportedLlvmVersionLowerBound, supportedLlvmVersionUpperBound, llvmVersionStr, parseLlvmVersion)
|
|
import GHC.Driver.Types
|
|
import GHC.Driver.Session
|
|
import GHC.Utils.Outputable
|
|
@@ -235,10 +235,11 @@ figureLlvmVersion dflags = traceToolCommand dflags "llc" $ do
|
|
errorMsg dflags $ vcat
|
|
[ text "Warning:", nest 9 $
|
|
text "Couldn't figure out LLVM version!" $$
|
|
- text ("Make sure you have installed LLVM between "
|
|
- ++ llvmVersionStr supportedLlvmVersionMin
|
|
+ text ("Make sure you have installed LLVM between ["
|
|
+ ++ llvmVersionStr supportedLlvmVersionLowerBound
|
|
++ " and "
|
|
- ++ llvmVersionStr supportedLlvmVersionMax) ]
|
|
+ ++ llvmVersionStr supportedLlvmVersionUpperBound
|
|
+ ++ ")") ]
|
|
return Nothing)
|
|
|
|
|
|
diff --git a/configure.ac b/configure.ac
|
|
index cf93f10938..e0423add87 100644
|
|
--- a/configure.ac
|
|
+++ b/configure.ac
|
|
@@ -716,8 +716,8 @@ AC_SUBST(InstallNameToolCmd)
|
|
# tools we are looking for. In the past, GHC supported a number of
|
|
# versions of LLVM simultaneously, but that stopped working around
|
|
# 3.5/3.6 release of LLVM.
|
|
-LlvmMinVersion=10
|
|
-LlvmMaxVersion=12 # inclusive
|
|
+LlvmMinVersion=9 # inclusive
|
|
+LlvmMaxVersion=13 # not inclusive
|
|
AC_SUBST([LlvmMinVersion])
|
|
AC_SUBST([LlvmMaxVersion])
|
|
sUPPORTED_LLVM_VERSION_MIN=$(echo \($LlvmMinVersion\) | sed 's/\./,/')
|
|
--
|
|
2.33.0
|
|
|