diff options
author | Gleb Popov <arrowd@FreeBSD.org> | 2019-01-06 12:18:06 +0000 |
---|---|---|
committer | Gleb Popov <arrowd@FreeBSD.org> | 2019-01-06 12:18:06 +0000 |
commit | e2c3fdc1fdeca1ffbdfef680e3e712ddc2e7e06f (patch) | |
tree | ec6e8ffeefbf83bfc231412c2c7a6b883ecd5bd8 /lang/ghc | |
parent | e8d137116e2942f75f1fed8f603384210db17ec0 (diff) | |
download | ports-e2c3fdc1fdeca1ffbdfef680e3e712ddc2e7e06f.tar.gz ports-e2c3fdc1fdeca1ffbdfef680e3e712ddc2e7e06f.zip |
lang/ghc: Update to 8.6.3 and bump PORTREVISION's of all Haskell ports.
As usual, it is recommended to rebuild or reinstall all the
dependent ports and the lang/ghc port itself in one of the following
ways:
# portmaster -w -r ghc
or
# portupgrade -fr lang/ghc
In case of pkg(8), it is probably safer to remove all the GHC-dependent
packages along with GHC and reinstall everything from scratch. For
example:
# pkg query "%ro" ghc > ghc-pkgs.txt
# pkg delete -y lang/ghc
# pkg install -y `cat ghc-pkgs.txt`
During update some hs-* ports got two PORTREVISION bumps in a row. Other ports
got a PORTVERSION update together with one PORTREVISION bump. This is caused
by bulk-bumping PORTREVISION of all hs-* ports. There are a lot of them updated,
so figuring out which ones require a bump and which are not is too tedious.
Approved by: tcberner (mentor)
Differential Revision: https://reviews.freebsd.org/D18707
Notes
Notes:
svn path=/head/; revision=489474
Diffstat (limited to 'lang/ghc')
-rw-r--r-- | lang/ghc/Makefile | 6 | ||||
-rw-r--r-- | lang/ghc/bsd.cabal.options.mk | 2 | ||||
-rw-r--r-- | lang/ghc/bsd.hackage.mk | 6 | ||||
-rw-r--r-- | lang/ghc/distinfo | 6 | ||||
-rw-r--r-- | lang/ghc/files/extra-patch-aclocal.m4 | 40 | ||||
-rw-r--r-- | lang/ghc/files/patch-configure | 22 | ||||
-rw-r--r-- | lang/ghc/files/patch-fix-build-on-arm | 231 | ||||
-rw-r--r-- | lang/ghc/files/patch-ghc.mk | 11 | ||||
-rw-r--r-- | lang/ghc/files/patch-llvm-targets | 12 | ||||
-rw-r--r-- | lang/ghc/files/patch-rts_posix_OSMem.c | 250 |
10 files changed, 19 insertions, 567 deletions
diff --git a/lang/ghc/Makefile b/lang/ghc/Makefile index 0c6d28d39da0..96a9a825c4a4 100644 --- a/lang/ghc/Makefile +++ b/lang/ghc/Makefile @@ -18,11 +18,11 @@ COMMENT= Compiler for the functional language Haskell LICENSE= BSD3CLAUSE LICENSE_FILE= ${WRKSRC}/LICENSE -GHC_VERSION= 8.4.4 +GHC_VERSION= 8.6.3 HSCOLOUR_VERSION= 1.24.4 -LLVM_VERSION= 50 +LLVM_VERSION= 60 -CONFLICTS_INSTALL= ghc-7.4.* ghc-7.6.* ghc-7.8.* ghc-7.10.* ghc-8.0.* ghc-8.4.3 +CONFLICTS_INSTALL= ghc-7.4.* ghc-7.6.* ghc-7.8.* ghc-7.10.* ghc-8.0.* ghc-8.4.* ghc-8.6.2 .include "${.CURDIR}/../../lang/ghc/bsd.ghc.mk" diff --git a/lang/ghc/bsd.cabal.options.mk b/lang/ghc/bsd.cabal.options.mk index 9935dc931a02..5f49889c6623 100644 --- a/lang/ghc/bsd.cabal.options.mk +++ b/lang/ghc/bsd.cabal.options.mk @@ -18,7 +18,7 @@ GHC_CMD?= ${LOCALBASE}/bin/ghc HADDOCK_CMD?= ${LOCALBASE}/bin/haddock HSCOLOUR_CMD?= ${LOCALBASE}/bin/HsColour -GHC_VERSION?= 8.4.4 +GHC_VERSION?= 8.6.3 HSCOLOUR_VERSION= 1.24.4 diff --git a/lang/ghc/bsd.hackage.mk b/lang/ghc/bsd.hackage.mk index 53471a89622a..1a0166f3093c 100644 --- a/lang/ghc/bsd.hackage.mk +++ b/lang/ghc/bsd.hackage.mk @@ -95,6 +95,7 @@ basement_port?= devel/hs-basement basic-prelude_port?= devel/hs-basic-prelude bencode_port?= textproc/hs-bencode bifunctors_port?= devel/hs-bifunctors +bitarray_port?= devel/hs-bitarray bits-atomic_port?= devel/hs-bits-atomic blaze-builder_port?= devel/hs-blaze-builder blaze-builder-enumerator_port?= devel/hs-blaze-builder-enumerator @@ -158,6 +159,7 @@ cpphs_port?= devel/hs-cpphs cprng-aes_port?= security/hs-cprng-aes cpu_port?= sysutils/hs-cpu criterion_port?= benchmarks/hs-criterion +criterion-measurement_port?= benchmarks/hs-criterion-measurement Crypto_port?= security/hs-Crypto crypto-api_port?= security/hs-crypto-api crypto-cipher-types_port?= security/hs-crypto-cipher-types @@ -198,6 +200,7 @@ datetime_port?= devel/hs-datetime DAV_port?= www/hs-DAV # executable dbus_port?= devel/hs-dbus deepseq-generics_port?= devel/hs-deepseq-generics +dense-linear-algebra_port?= math/hs-dense-linear-algebra dia-base_port?= graphics/hs-dia-base dia-functions_port?= graphics/hs-dia-functions Diff_port?= textproc/hs-Diff @@ -311,6 +314,7 @@ hslogger_port?= devel/hs-hslogger hslua_port?= devel/hs-hslua hslua-module-text_port?= devel/hs-hslua-module-text HsOpenSSL_port?= security/hs-HsOpenSSL +HsYAML_port?= textproc/hs-HsYAML hspec_port?= devel/hs-hspec # executable hspec-core_port?= devel/hs-hspec-core hspec-discover_port?= devel/hs-hspec-discover # executable @@ -355,6 +359,7 @@ lhs2tex_port?= textproc/hs-lhs2tex libmpd_port?= audio/hs-libmpd libxml_port?= textproc/hs-libxml libxml-sax_port?= textproc/hs-libxml-sax # lib_depends +libyaml_port?= textproc/hs-libyaml lifted-async_port?= devel/hs-lifted-async lifted-base_port?= devel/hs-lifted-base List_port?= devel/hs-List @@ -548,6 +553,7 @@ typed-process_port?= devel/hs-typed-process unamb_port?= devel/hs-unamb unexceptionalio_port?= devel/hs-unexceptionalio unicode-show_port?= devel/hs-unicode-show +unicode-transforms_port?= textproc/hs-unicode-transforms uniplate_port?= devel/hs-uniplate unix-compat_port?= devel/hs-unix-compat unix-time_port?= devel/hs-unix-time diff --git a/lang/ghc/distinfo b/lang/ghc/distinfo index 4ee3ee5c367f..c3a9a30b28a0 100644 --- a/lang/ghc/distinfo +++ b/lang/ghc/distinfo @@ -1,6 +1,6 @@ -TIMESTAMP = 1541010522 -SHA256 (ghc-8.4.4-src.tar.xz) = 11117735a58e507c481c09f3f39ae5a314e9fbf49fc3109528f99ea7959004b2 -SIZE (ghc-8.4.4-src.tar.xz) = 11319500 +TIMESTAMP = 1541010523 +SHA256 (ghc-8.6.3-src.tar.xz) = 9f9e37b7971935d88ba80426c36af14b1e0b3ec1d9c860f44a4391771bc07f23 +SIZE (ghc-8.6.3-src.tar.xz) = 19138116 SHA256 (ghc-8.4.3-boot-amd64-freebsd.tar.xz) = 0e0324a539d471a813ed4d18c537fb19be22a4e250bd5434a3a911b9d5343724 SIZE (ghc-8.4.3-boot-amd64-freebsd.tar.xz) = 67718400 SHA256 (ghc-8.4.3-boot-i386-freebsd.tar.xz) = 65fcd48b1c0166e028b3f6d50ad295525e6b84490da82663ec66165e57e87972 diff --git a/lang/ghc/files/extra-patch-aclocal.m4 b/lang/ghc/files/extra-patch-aclocal.m4 index 8adc3e28b4e3..5e674d2f9556 100644 --- a/lang/ghc/files/extra-patch-aclocal.m4 +++ b/lang/ghc/files/extra-patch-aclocal.m4 @@ -1,46 +1,8 @@ --- aclocal.m4.orig 2018-03-25 21:22:32 UTC +++ aclocal.m4 -@@ -648,6 +648,14 @@ AC_DEFUN([FPTOOLS_SET_C_LD_FLAGS], - $3="$$3 -D_HPUX_SOURCE" - $5="$$5 -D_HPUX_SOURCE" - ;; -+ arm*freebsd*) -+ # On arm/freebsd, tell gcc to generate Arm -+ # instructions (ie not Thumb) and to link using the gold linker. -+ # Forcing LD to be ld.gold is done in FIND_LD m4 macro. -+ $2="$$2 -marm" -+ $3="$$3 -Wl,-z,noexecstack" -+ $4="$$4 -z noexecstack" -+ ;; - arm*linux*) - # On arm/linux and arm/android, tell gcc to generate Arm - # instructions (ie not Thumb). -@@ -656,6 +664,11 @@ AC_DEFUN([FPTOOLS_SET_C_LD_FLAGS], - $4="$$4 -z noexecstack" - ;; - -+ aarch64*freebsd*) -+ $3="$$3 -Wl,-z,noexecstack" -+ $4="$$4 -z noexecstack" -+ ;; -+ - aarch64*linux*) - $3="$$3 -Wl,-z,noexecstack" - $4="$$4 -z noexecstack" -@@ -1917,6 +1930,10 @@ case "$1" in - # converts the canonicalized target into someting llvm can understand - AC_DEFUN([GHC_LLVM_TARGET], [ - case "$2-$3" in -+ *-freebsd*-gnueabihf) -+ llvm_target_vendor="unknown" -+ llvm_target_os="freebsd-gnueabihf" -+ ;; - hardfloat-*eabi) - llvm_target_vendor="unknown" - llvm_target_os="$3""hf" @@ -2361,13 +2378,6 @@ AC_DEFUN([FIND_LD],[ [enable_ld_override=yes]) - + find_ld() { - # Make sure the user didn't specify LD manually. - if test "z$LD" != "z"; then diff --git a/lang/ghc/files/patch-configure b/lang/ghc/files/patch-configure deleted file mode 100644 index a3ff7aea111a..000000000000 --- a/lang/ghc/files/patch-configure +++ /dev/null @@ -1,22 +0,0 @@ ---- configure.orig 2018-03-06 20:04:54 UTC -+++ configure -@@ -9108,6 +9108,19 @@ $as_echo_n "checking Setting up CFLAGS, LDFLAGS, IGNOR - IGNORE_LINKER_LD_FLAGS="$IGNORE_LINKER_LD_FLAGS -z noexecstack" - ;; - -+ arm*freebsd*) -+ # On arm/freebsd, tell gcc to generate Arm -+ # instructions (ie not Thumb). -+ CFLAGS="$CFLAGS -marm" -+ LDFLAGS="$LDFLAGS -Wl,-z,noexecstack" -+ IGNORE_LINKER_LD_FLAGS="$IGNORE_LINKER_LD_FLAGS -z noexecstack" -+ ;; -+ -+ aarch64*freebsd*) -+ LDFLAGS="$LDFLAGS -Wl,-z,noexecstack" -+ IGNORE_LINKER_LD_FLAGS="$IGNORE_LINKER_LD_FLAGS -z noexecstack" -+ ;; -+ - powerpc-ibm-aix*) - # We need `-D_THREAD_SAFE` to unlock the thread-local `errno`. - CFLAGS="$CFLAGS -D_THREAD_SAFE" diff --git a/lang/ghc/files/patch-fix-build-on-arm b/lang/ghc/files/patch-fix-build-on-arm deleted file mode 100644 index 824d6bae07b5..000000000000 --- a/lang/ghc/files/patch-fix-build-on-arm +++ /dev/null @@ -1,231 +0,0 @@ -From d8495549ba9d194815c2d0eaee6797fc7c00756a Mon Sep 17 00:00:00 2001 -From: Kavon Farvardin <kavon@farvard.in> -Date: Sun, 28 Oct 2018 12:11:49 -0400 -Subject: [PATCH] Fix for T14251 on ARM - -We now calculate the SSE register padding needed to fix the calling -convention in LLVM in a robust way: grouping them by whether -registers in that class overlap (with the same class overlapping -itself). - -My prior patch assumed that no matter the platform, physical -register Fx aliases with Dx, etc, for our calling convention. - -This is unfortunately not the case for any platform except x86-64. - -Test Plan: -Only know how to test on x86-64, but it should be tested on ARM with: - -`make test WAYS=llvm && make test WAYS=optllvm` - -Reviewers: bgamari, angerman - -Reviewed By: bgamari - -Subscribers: rwbarton, carter - -GHC Trac Issues: #15780, #14251, #15747 - -Differential Revision: https://phabricator.haskell.org/D5254 ---- - compiler/llvmGen/LlvmCodeGen/Base.hs | 123 ++++++++++++++++++++++---------- - compiler/llvmGen/LlvmCodeGen/CodeGen.hs | 6 +- - 2 files changed, 90 insertions(+), 39 deletions(-) - -diff --git a/compiler/llvmGen/LlvmCodeGen/Base.hs b/compiler/llvmGen/LlvmCodeGen/Base.hs -index ec91bac..0a40b73 100644 ---- compiler/llvmGen/LlvmCodeGen/Base.hs -+++ compiler/llvmGen/LlvmCodeGen/Base.hs -@@ -26,7 +26,7 @@ module LlvmCodeGen.Base ( - - cmmToLlvmType, widthToLlvmFloat, widthToLlvmInt, llvmFunTy, - llvmFunSig, llvmFunArgs, llvmStdFunAttrs, llvmFunAlign, llvmInfAlign, -- llvmPtrBits, tysToParams, llvmFunSection, padLiveArgs, isSSE, -+ llvmPtrBits, tysToParams, llvmFunSection, padLiveArgs, isFPR, - - strCLabel_llvm, strDisplayName_llvm, strProcedureName_llvm, - getGlobalPtr, generateExternDecls, -@@ -47,6 +47,7 @@ import CodeGen.Platform ( activeStgRegs ) - import DynFlags - import FastString - import Cmm hiding ( succ ) -+import CmmUtils ( regsOverlap ) - import Outputable as Outp - import Platform - import UniqFM -@@ -58,8 +59,7 @@ import ErrUtils - import qualified Stream - - import Control.Monad (ap) --import Data.List (sort) --import Data.Maybe (mapMaybe) -+import Data.List (sort, groupBy, head) - - -- ---------------------------------------------------------------------------- - -- * Some Data Types -@@ -152,36 +152,91 @@ llvmFunArgs dflags live = - map (lmGlobalRegArg dflags) (filter isPassed allRegs) - where platform = targetPlatform dflags - allRegs = activeStgRegs platform -- paddedLive = map (\(_,r) -> r) $ padLiveArgs live -+ paddedLive = map (\(_,r) -> r) $ padLiveArgs dflags live - isLive r = r `elem` alwaysLive || r `elem` paddedLive -- isPassed r = not (isSSE r) || isLive r -- -- --isSSE :: GlobalReg -> Bool --isSSE (FloatReg _) = True --isSSE (DoubleReg _) = True --isSSE (XmmReg _) = True --isSSE (YmmReg _) = True --isSSE (ZmmReg _) = True --isSSE _ = False -- --sseRegNum :: GlobalReg -> Maybe Int --sseRegNum (FloatReg i) = Just i --sseRegNum (DoubleReg i) = Just i --sseRegNum (XmmReg i) = Just i --sseRegNum (YmmReg i) = Just i --sseRegNum (ZmmReg i) = Just i --sseRegNum _ = Nothing -- ---- the bool indicates whether the global reg was added as padding. ---- the returned list is not sorted in any particular order, ---- but does indicate the set of live registers needed, with SSE padding. --padLiveArgs :: LiveGlobalRegs -> [(Bool, GlobalReg)] --padLiveArgs live = allRegs -+ isPassed r = not (isFPR r) || isLive r -+ -+ -+isFPR :: GlobalReg -> Bool -+isFPR (FloatReg _) = True -+isFPR (DoubleReg _) = True -+isFPR (XmmReg _) = True -+isFPR (YmmReg _) = True -+isFPR (ZmmReg _) = True -+isFPR _ = False -+ -+sameFPRClass :: GlobalReg -> GlobalReg -> Bool -+sameFPRClass (FloatReg _) (FloatReg _) = True -+sameFPRClass (DoubleReg _) (DoubleReg _) = True -+sameFPRClass (XmmReg _) (XmmReg _) = True -+sameFPRClass (YmmReg _) (YmmReg _) = True -+sameFPRClass (ZmmReg _) (ZmmReg _) = True -+sameFPRClass _ _ = False -+ -+normalizeFPRNum :: GlobalReg -> GlobalReg -+normalizeFPRNum (FloatReg _) = FloatReg 1 -+normalizeFPRNum (DoubleReg _) = DoubleReg 1 -+normalizeFPRNum (XmmReg _) = XmmReg 1 -+normalizeFPRNum (YmmReg _) = YmmReg 1 -+normalizeFPRNum (ZmmReg _) = ZmmReg 1 -+normalizeFPRNum _ = error "normalizeFPRNum expected only FPR regs" -+ -+getFPRCtor :: GlobalReg -> Int -> GlobalReg -+getFPRCtor (FloatReg _) = FloatReg -+getFPRCtor (DoubleReg _) = DoubleReg -+getFPRCtor (XmmReg _) = XmmReg -+getFPRCtor (YmmReg _) = YmmReg -+getFPRCtor (ZmmReg _) = ZmmReg -+getFPRCtor _ = error "getFPRCtor expected only FPR regs" -+ -+fprRegNum :: GlobalReg -> Int -+fprRegNum (FloatReg i) = i -+fprRegNum (DoubleReg i) = i -+fprRegNum (XmmReg i) = i -+fprRegNum (YmmReg i) = i -+fprRegNum (ZmmReg i) = i -+fprRegNum _ = error "fprRegNum expected only FPR regs" -+ -+-- | Input: dynflags, and the list of live registers -+-- -+-- Output: An augmented list of live registers, where padding was -+-- added to the list of registers to ensure the calling convention is -+-- correctly used by LLVM. -+-- -+-- Each global reg in the returned list is tagged with a bool, which -+-- indicates whether the global reg was added as padding, or was an original -+-- live register. -+-- -+-- That is, True => padding, False => a real, live global register. -+-- -+-- Also, the returned list is not sorted in any particular order. -+-- -+padLiveArgs :: DynFlags -> LiveGlobalRegs -> [(Bool, GlobalReg)] -+padLiveArgs dflags live = -+ if platformUnregisterised plat -+ then taggedLive -- not using GHC's register convention for platform. -+ else padding ++ taggedLive -+ where -+ taggedLive = map (\x -> (False, x)) live -+ plat = targetPlatform dflags -+ -+ fprLive = filter isFPR live -+ padding = concatMap calcPad $ groupBy sharesClass fprLive -+ -+ sharesClass :: GlobalReg -> GlobalReg -> Bool -+ sharesClass a b = sameFPRClass a b || overlappingClass -+ where -+ overlappingClass = regsOverlap dflags (norm a) (norm b) -+ norm = CmmGlobal . normalizeFPRNum -+ -+ calcPad :: [GlobalReg] -> [(Bool, GlobalReg)] -+ calcPad rs = getFPRPadding (getFPRCtor $ head rs) rs -+ -+getFPRPadding :: (Int -> GlobalReg) -> LiveGlobalRegs -> [(Bool, GlobalReg)] -+getFPRPadding paddingCtor live = padding - where -- sseRegNums = sort $ mapMaybe sseRegNum live -- (_, padding) = foldl assignSlots (1, []) $ sseRegNums -- allRegs = padding ++ map (\r -> (False, r)) live -+ fprRegNums = sort $ map fprRegNum live -+ (_, padding) = foldl assignSlots (1, []) $ fprRegNums - - assignSlots (i, acc) regNum - | i == regNum = -- don't need padding here -@@ -195,11 +250,7 @@ padLiveArgs live = allRegs - - genPad start n = - take n $ flip map (iterate (+1) start) (\i -> -- (True, FloatReg i)) -- -- NOTE: Picking float should be fine for the following reasons: -- -- (1) Float aliases with all the other SSE register types on -- -- the given platform. -- -- (2) The argument is not live anyways. -+ (True, paddingCtor i)) - - - -- | Llvm standard fun attributes -diff --git a/compiler/llvmGen/LlvmCodeGen/CodeGen.hs b/compiler/llvmGen/LlvmCodeGen/CodeGen.hs -index 1873400..21abc65 100644 ---- compiler/llvmGen/LlvmCodeGen/CodeGen.hs -+++ compiler/llvmGen/LlvmCodeGen/CodeGen.hs -@@ -1814,14 +1814,14 @@ funPrologue live cmmBlocks = do - -- STG Liveness optimisation done here. - funEpilogue :: LiveGlobalRegs -> LlvmM ([LlvmVar], LlvmStatements) - funEpilogue live = do -+ dflags <- getDynFlags - - -- the bool indicates whether the register is padding. - let alwaysNeeded = map (\r -> (False, r)) alwaysLive -- livePadded = alwaysNeeded ++ padLiveArgs live -+ livePadded = alwaysNeeded ++ padLiveArgs dflags live - - -- Set to value or "undef" depending on whether the register is - -- actually live -- dflags <- getDynFlags - let loadExpr r = do - (v, _, s) <- getCmmRegVal (CmmGlobal r) - return (Just $ v, s) -@@ -1833,7 +1833,7 @@ funEpilogue live = do - loads <- flip mapM allRegs $ \r -> case () of - _ | (False, r) `elem` livePadded - -> loadExpr r -- if r is not padding, load it -- | not (isSSE r) || (True, r) `elem` livePadded -+ | not (isFPR r) || (True, r) `elem` livePadded - -> loadUndef r - | otherwise -> return (Nothing, nilOL) - --- -1.9.1 - diff --git a/lang/ghc/files/patch-ghc.mk b/lang/ghc/files/patch-ghc.mk index 8ab4d6e13130..25e8affef3f9 100644 --- a/lang/ghc/files/patch-ghc.mk +++ b/lang/ghc/files/patch-ghc.mk @@ -1,4 +1,4 @@ ---- ghc.mk.orig 2017-01-03 15:59:18 UTC +--- ghc.mk.orig 2018-09-16 20:53:54 UTC +++ ghc.mk @@ -96,6 +96,7 @@ endif # Catch make if it runs away into an infinite loop @@ -8,14 +8,13 @@ else $(error Make has restarted itself $(MAKE_RESTARTS) times; is there a makefile bug? See http://ghc.haskell.org/trac/ghc/wiki/Building/Troubleshooting#Makehasrestarteditself3timesisthereamakefilebug for details) endif -@@ -459,10 +460,7 @@ PACKAGES_STAGE1 += ghc-boot-th - PACKAGES_STAGE1 += ghc-boot - PACKAGES_STAGE1 += template-haskell +@@ -461,9 +462,7 @@ PACKAGES_STAGE1 += template-haskell PACKAGES_STAGE1 += ghc-compact -- + PACKAGES_STAGE1 += ghc-heap + -ifeq "$(HADDOCK_DOCS)" "YES" PACKAGES_STAGE1 += xhtml -endif - + ifeq "$(WITH_TERMINFO)" "YES" PACKAGES_STAGE1 += terminfo diff --git a/lang/ghc/files/patch-llvm-targets b/lang/ghc/files/patch-llvm-targets deleted file mode 100644 index c66e44cda054..000000000000 --- a/lang/ghc/files/patch-llvm-targets +++ /dev/null @@ -1,12 +0,0 @@ ---- llvm-targets.orig 2018-03-17 14:04:41 UTC -+++ llvm-targets -@@ -20,4 +20,9 @@ - ,("aarch64-apple-ios", ("e-m:o-i64:64-i128:128-n32:64-S128", "generic", "+neon")) - ,("i386-apple-ios", ("e-m:o-p:32:32-f64:32:64-f80:128-n8:16:32-S128", "yonah", "")) - ,("x86_64-apple-ios", ("e-m:o-i64:64-f80:128-n8:16:32:64-S128", "core2", "")) -+,("armv6-unknown-freebsd-gnueabihf", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "arm1176jzf-s", "+strict-align")) -+,("armv7-unknown-freebsd-gnueabihf", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "generic", "+strict-align")) -+,("aarch64-unknown-freebsd", ("e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128", "generic", "+neon")) -+,("amd64-portbld-freebsd", ("e-m:e-i64:64-f80:128-n8:16:32:64-S128", "x86-64", "")) -+,("i386-portbld-freebsd", ("e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128", "i486", "")) - ] diff --git a/lang/ghc/files/patch-rts_posix_OSMem.c b/lang/ghc/files/patch-rts_posix_OSMem.c deleted file mode 100644 index dce26edcfced..000000000000 --- a/lang/ghc/files/patch-rts_posix_OSMem.c +++ /dev/null @@ -1,250 +0,0 @@ ---- rts/posix/OSMem.c.orig 2017-11-28 16:39:14 UTC -+++ rts/posix/OSMem.c -@@ -36,6 +36,10 @@ - #if defined(HAVE_NUMAIF_H) - #include <numaif.h> - #endif -+#if defined(HAVE_SYS_RESOURCE_H) && defined(HAVE_SYS_TIME_H) -+#include <sys/time.h> -+#include <sys/resource.h> -+#endif - - #include <errno.h> - -@@ -45,6 +49,29 @@ - #include <sys/sysctl.h> - #endif - -+#ifndef MAP_FAILED -+# define MAP_FAILED ((void *)-1) -+#endif -+ -+#if defined(hpux_HOST_OS) -+# ifndef MAP_ANON -+# define MAP_ANON MAP_ANONYMOUS -+# endif -+#endif -+ -+#ifndef darwin_HOST_OS -+# undef RESERVE_FLAGS -+# if defined(MAP_GUARD) -+# define RESERVE_FLAGS MAP_GUARD /* FreeBSD */ -+# elif defined(MAP_NORESERVE) -+# define RESERVE_FLAGS MAP_NORESERVE | MAP_ANON | MAP_PRIVATE; -+# else -+# if defined(USE_LARGE_ADDRESS_SPACE) -+# error USE_LARGE_ADDRESS_SPACE needs MAP_NORESERVE or MAP_GUARD -+# endif -+# endif -+#endif -+ - static void *next_request = 0; - - void osMemInit(void) -@@ -98,8 +125,10 @@ - The naming is chosen from the Win32 API (VirtualAlloc) which does the - same thing and has done so forever, while support for this in Unix systems - has only been added recently and is hidden in the posix portability mess. -- It is confusing because to get the reserve behavior we need MAP_NORESERVE -- (which tells the kernel not to allocate backing space), but heh... -+ The Linux manpage suggests that mmap must be passed MAP_NORESERVE in order -+ to get reservation-only behavior. It is confusing because to get the reserve -+ behavior we need MAP_NORESERVE (which tells the kernel not to allocate backing -+ space), but heh... - */ - enum - { -@@ -108,6 +137,44 @@ - MEM_RESERVE_AND_COMMIT = MEM_RESERVE | MEM_COMMIT - }; - -+#if defined(linux_HOST_OS) -+static void * -+linux_retry_mmap(int operation, W_ size, void *ret, void *addr, int prot, int flags) -+{ -+ if (addr != 0 && (operation & MEM_RESERVE)) { -+ // Try again with no hint address. -+ // It's not clear that this can ever actually help, -+ // but since our alternative is to abort, we may as well try. -+ ret = mmap(0, size, prot, flags, -1, 0); -+ } -+ if (ret == MAP_FAILED && errno == EPERM) { -+ // Linux is not willing to give us any mapping, -+ // so treat this as an out-of-memory condition -+ // (really out of virtual address space). -+ errno = ENOMEM; -+ } -+ return ret; -+} -+#endif /* defined(linux_HOST_OS) */ -+ -+static void -+post_mmap_madvise(int operation, W_ size, void *ret) -+{ -+#if defined(MADV_WILLNEED) -+ if (operation & MEM_COMMIT) { -+ madvise(ret, size, MADV_WILLNEED); -+# if defined(MADV_DODUMP) -+ madvise(ret, size, MADV_DODUMP); -+# endif -+ } else { -+ madvise(ret, size, MADV_DONTNEED); -+# if defined(MADV_DONTDUMP) -+ madvise(ret, size, MADV_DONTDUMP); -+# endif -+ } -+#endif -+} -+ - /* Returns NULL on failure; errno set */ - static void * - my_mmap (void *addr, W_ size, int operation) -@@ -149,69 +216,44 @@ - VM_PROT_READ|VM_PROT_WRITE); - } - --#else -+#else /* defined(darwin_HOST_OS) */ - - int prot, flags; -- if (operation & MEM_COMMIT) -+ if (operation & MEM_COMMIT) { - prot = PROT_READ | PROT_WRITE; -- else -+ } else { - prot = PROT_NONE; -- if (operation == MEM_RESERVE) --# if defined(MAP_NORESERVE) -- flags = MAP_NORESERVE; -+ } -+ -+ if (operation == MEM_RESERVE) { -+# if defined(RESERVE_FLAGS) -+ flags = RESERVE_FLAGS; - # else --# if defined(USE_LARGE_ADDRESS_SPACE) --# error USE_LARGE_ADDRESS_SPACE needs MAP_NORESERVE --# endif - errorBelch("my_mmap(,,MEM_RESERVE) not supported on this platform"); - # endif -- else if (operation == MEM_COMMIT) -- flags = MAP_FIXED; -- else -- flags = 0; -+ } else if (operation == MEM_COMMIT) { -+ flags = MAP_FIXED | MAP_ANON | MAP_PRIVATE; -+ } else { -+ flags = MAP_ANON | MAP_PRIVATE; -+ } - --#if defined(hpux_HOST_OS) -- ret = mmap(addr, size, prot, flags | MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); --#elif defined(linux_HOST_OS) -- ret = mmap(addr, size, prot, flags | MAP_ANON | MAP_PRIVATE, -1, 0); -- if (ret == (void *)-1 && errno == EPERM) { -+ ret = mmap(addr, size, prot, flags, -1, 0); -+# if defined(linux_HOST_OS) -+ if (ret == MAP_FAILED && errno == EPERM) { - // Linux may return EPERM if it tried to give us - // a chunk of address space below mmap_min_addr, - // See Trac #7500. -- if (addr != 0 && (operation & MEM_RESERVE)) { -- // Try again with no hint address. -- // It's not clear that this can ever actually help, -- // but since our alternative is to abort, we may as well try. -- ret = mmap(0, size, prot, flags | MAP_ANON | MAP_PRIVATE, -1, 0); -- } -- if (ret == (void *)-1 && errno == EPERM) { -- // Linux is not willing to give us any mapping, -- // so treat this as an out-of-memory condition -- // (really out of virtual address space). -- errno = ENOMEM; -- } -+ ret = linux_retry_mmap(operation, size, ret, addr, prot, flags); - } -- -- if (operation & MEM_COMMIT) { -- madvise(ret, size, MADV_WILLNEED); --#if defined(MADV_DODUMP) -- madvise(ret, size, MADV_DODUMP); --#endif -- } else { -- madvise(ret, size, MADV_DONTNEED); --#if defined(MADV_DONTDUMP) -- madvise(ret, size, MADV_DONTDUMP); --#endif -- } -- --#else -- ret = mmap(addr, size, prot, flags | MAP_ANON | MAP_PRIVATE, -1, 0); --#endif --#endif -- -- if (ret == (void *)-1) { -+# endif -+ if (ret == MAP_FAILED) { - return NULL; - } -+#endif /* defined(darwin_HOST_OS) */ -+ -+ // Map in committed pages rather than take a fault for each chunk. -+ // Also arrange to include them in core-dump files. -+ post_mmap_madvise(operation, size, ret); - - return ret; - } -@@ -435,6 +477,8 @@ - void *base, *top; - void *start, *end; - -+ ASSERT((len & ~MBLOCK_MASK) == len); -+ - /* We try to allocate len + MBLOCK_SIZE, - because we need memory which is MBLOCK_SIZE aligned, - and then we discard what we don't need */ -@@ -500,8 +544,19 @@ - (void*)startAddress, (void*)minimumAddress); - } - -+#if defined(HAVE_SYS_RESOURCE_H) && defined(HAVE_SYS_TIME_H) -+ struct rlimit limit; -+ if (!getrlimit(RLIMIT_AS, &limit) -+ && limit.rlim_cur > 0 -+ && *len > limit.rlim_cur) { -+ *len = limit.rlim_cur; -+ } -+#endif -+ - attempt = 0; - while (1) { -+ *len &= ~MBLOCK_MASK; -+ - if (*len < MBLOCK_SIZE) { - // Give up if the system won't even give us 16 blocks worth of heap - barf("osReserveHeapMemory: Failed to allocate heap storage"); -@@ -512,9 +567,14 @@ - if (at == NULL) { - // This means that mmap failed which we take to mean that we asked - // for too much memory. This can happen due to POSIX resource -- // limits. In this case we reduce our allocation request by a factor -- // of two and try again. -- *len /= 2; -+ // limits. In this case we reduce our allocation request by a -+ // fraction of the current size and try again. -+ // -+ // Note that the previously would instead decrease the request size -+ // by a factor of two; however, this meant that significant amounts -+ // of memory will be wasted (e.g. imagine a machine with 512GB of -+ // physical memory but a 511GB ulimit). See #14492. -+ *len -= *len / 8; - } else if ((W_)at >= minimumAddress) { - // Success! We were given a block of memory starting above the 8 GB - // mark, which is what we were looking for. -@@ -536,7 +596,7 @@ - { - void *r = my_mmap(at, size, MEM_COMMIT); - if (r == NULL) { -- barf("Unable to commit %d bytes of memory", size); -+ barf("Unable to commit %" FMT_Word " bytes of memory", size); - } - } |