diff --git a/35a897782b6b0a252da7fdcf4921198ad4e1d96c.patch b/PprC-Add-support-for-adjacent-floats.patch similarity index 100% rename from 35a897782b6b0a252da7fdcf4921198ad4e1d96c.patch rename to PprC-Add-support-for-adjacent-floats.patch diff --git a/add_-latomic_to_ghc-prim.patch b/add_-latomic_to_ghc-prim.patch new file mode 100644 index 0000000..71e4ddb --- /dev/null +++ b/add_-latomic_to_ghc-prim.patch @@ -0,0 +1,54 @@ +commit ce3897ffd6e7c8b8f36b8e920168bac8c7f836ae +Author: Ilias Tsitsimpis +Date: Tue Sep 18 17:45:17 2018 +0200 + + Fix check whether GCC supports __atomic_ builtins + + Summary: + C11 atomics are never used because: + + * The program used for checking whether GCC supports + __atomic_ builtins fails with the following error: + + ``` + error: size mismatch in argument 2 of `__atomic_load` + int test(int *x) { int y; __atomic_load(&x, &y, __ATOMIC_SEQ_CST); return x; } + ``` + + * There is a typo when checking if CONF_GCC_SUPPORTS__ATOMICS equals YES, + resulting in PRIM_CFLAGS and PRIM_EXTRA_LIBRARIES never being set. + + Reviewers: bgamari + + Reviewed By: bgamari + + Subscribers: rwbarton, erikd, carter + + Differential Revision: https://phabricator.haskell.org/D5154 + +Index: b/libraries/ghc-prim/aclocal.m4 +=================================================================== +--- a/libraries/ghc-prim/aclocal.m4 ++++ b/libraries/ghc-prim/aclocal.m4 +@@ -5,7 +5,7 @@ AC_DEFUN([FP_GCC_SUPPORTS__ATOMICS], + [ + AC_REQUIRE([AC_PROG_CC]) + AC_MSG_CHECKING([whether GCC supports __atomic_ builtins]) +- echo 'int test(int *x) { int y; __atomic_load(&x, &y, __ATOMIC_SEQ_CST); return x; }' > conftest.c ++ echo 'int test(int *x) { int y; __atomic_load(x, &y, __ATOMIC_SEQ_CST); return y; }' > conftest.c + if $CC -c conftest.c > /dev/null 2>&1; then + CONF_GCC_SUPPORTS__ATOMICS=YES + AC_MSG_RESULT([yes]) +Index: b/libraries/ghc-prim/configure.ac +=================================================================== +--- a/libraries/ghc-prim/configure.ac ++++ b/libraries/ghc-prim/configure.ac +@@ -8,7 +8,7 @@ dnl unregisterised, Sparc, and PPC ba + FP_GCC_SUPPORTS__ATOMICS + AC_DEFINE([HAVE_C11_ATOMICS], [$CONF_GCC_SUPPORTS__ATOMICS], [Does GCC support __atomic primitives?]) + +-if test "x$CONF_GCC_SUPPORTS__ATOMICS" = YES ++if test "$CONF_GCC_SUPPORTS__ATOMICS" = "YES" + then PRIM_CFLAGS=-DHAVE_C11_ATOMICS + PRIM_EXTRA_LIBRARIES=atomic + fi diff --git a/e175aaf6918bb2b497b83618dc4c270a0d231a1c.patch b/e175aaf6918bb2b497b83618dc4c270a0d231a1c.patch new file mode 100644 index 0000000..8824289 --- /dev/null +++ b/e175aaf6918bb2b497b83618dc4c270a0d231a1c.patch @@ -0,0 +1,63 @@ +From: Sergei Trofimovich +Date: Wed, 18 Jul 2018 22:36:58 +0000 (+0100) +Subject: fix osReserveHeapMemory block alignment +X-Git-Url: https://git.haskell.org/ghc.git/commitdiff_plain/e175aaf6918bb2b497b83618dc4c270a0d231a1c + +fix osReserveHeapMemory block alignment + +Before the change osReserveHeapMemory() attempted +to allocate chunks of memory via osTryReserveHeapMemory() +not multiple of MBLOCK_SIZE in the following fallback code: + +``` + if (at == NULL) { + *len -= *len / 8; +``` + +and caused assertion failure: + +``` +$ make fulltest TEST=T11607 WAY=threaded1 +T11607: internal error: ASSERTION FAILED: file rts/posix/OSMem.c, line 457 + (GHC version 8.7.20180716 for riscv64_unknown_linux) + +``` + +The change applies alignment mask before each MBLOCK allocation attempt +and fixes WAY=threaded1 test failures on qemu-riscv64. + +Signed-off-by: Sergei Trofimovich + +Test Plan: run 'make fulltest WAY=threaded1' + +Reviewers: simonmar, bgamari, erikd + +Reviewed By: simonmar + +Subscribers: rwbarton, thomie, carter + +Differential Revision: https://phabricator.haskell.org/D4982 +--- + +Index: b/rts/posix/OSMem.c +=================================================================== +--- a/rts/posix/OSMem.c ++++ b/rts/posix/OSMem.c +@@ -476,6 +476,8 @@ osTryReserveHeapMemory (W_ len, void *hi + 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 */ +@@ -552,6 +554,8 @@ void *osReserveHeapMemory(void *startAdd + + 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"); diff --git a/ghc.spec b/ghc.spec index 07942ff..a2808bd 100644 --- a/ghc.spec +++ b/ghc.spec @@ -69,12 +69,14 @@ Patch11: https://github.com/haskell/process/commit/3e0812fe9d3f4712638a1c4c49bf2 # arm Patch12: ghc-armv7-VFPv3D16--NEON.patch -# for s390x +# for unregisterized (s390x) # https://ghc.haskell.org/trac/ghc/ticket/15689 Patch15: ghc-warnings.mk-CC-Wall.patch # https://gitlab.haskell.org/ghc/ghc/issues/15853 # https://phabricator.haskell.org/D5306 (in 8.8) -Patch17: https://gitlab.haskell.org/ghc/ghc/commit/35a897782b6b0a252da7fdcf4921198ad4e1d96c.patch +# https://gitlab.haskell.org/ghc/ghc/commit/35a897782b6b0a252da7fdcf4921198ad4e1d96c.patch +# https://salsa.debian.org/haskell-team/DHG_packages/blob/master/p/ghc/debian/patches/PprC-Add-support-for-adjacent-floats +Patch17: PprC-Add-support-for-adjacent-floats.patch # bigendian (s390x and ppc64) # fix haddock-library @@ -88,6 +90,10 @@ Patch18: https://gitlab.haskell.org/ghc/ghc/uploads/5deb133cf910e9e0ca9ad9fe53f7 Patch24: buildpath-abi-stability.patch Patch26: no-missing-haddock-file-warning.patch Patch28: x32-use-native-x86_64-insn.patch +# https://salsa.debian.org/haskell-team/DHG_packages/blob/master/p/ghc/debian/patches/add_-latomic_to_ghc-prim +Patch30: add_-latomic_to_ghc-prim.patch +# https://salsa.debian.org/haskell-team/DHG_packages/blob/master/p/ghc/debian/patches/e175aaf6918bb2b497b83618dc4c270a0d231a1c.patch +Patch32: https://salsa.debian.org/haskell-team/DHG_packages/raw/master/p/ghc/debian/patches/e175aaf6918bb2b497b83618dc4c270a0d231a1c.patch # fedora ghc has been bootstrapped on # %%{ix86} x86_64 ppc ppc64 armv7hl s390 s390x ppc64le aarch64 @@ -328,9 +334,12 @@ cd libraries/process %patch18 -p1 -b .orig %endif +# debian %patch24 -p1 -b .orig %patch26 -p1 -b .orig %patch28 -p1 -b .orig +%patch30 -p1 -b .orig +%patch32 -p1 -b .orig %global gen_contents_index gen_contents_index.orig %if %{with haddock}