diff --git a/srcpkgs/ghc/patches/no-atomic-64-on-32bit.patch b/srcpkgs/ghc/patches/no-atomic-64-on-32bit.patch deleted file mode 100644 index 05ca275ea9d..00000000000 --- a/srcpkgs/ghc/patches/no-atomic-64-on-32bit.patch +++ /dev/null @@ -1,58 +0,0 @@ -From 5c5aa87d50dc4ea97e76e13f285a7b5dd71fcd88 Mon Sep 17 00:00:00 2001 -From: Ilias Tsitsimpis -Date: Sun, 1 Mar 2020 16:25:13 +0200 -Subject: [PATCH] Do not define hs_atomic{read,write}64() on non-64bit - -Do not define hs_atomicread64() and hs_atomicwrite64() on machines where -WORD_SIZE_IN_BITS is less than 64, just like we do with the rest of the atomic -functions which work on 64-bit values. - -Without this, compilation fails on MIPSel and PowerPC with the following error: - -/usr/bin/ld: /<>/libraries/ghc-prim/dist-install/build/libHSghc-prim-0.5.3_p.a(atomic.p_o): in function `hs_atomicread64': -atomic.c:(.text.hs_atomicread64+0x8): undefined reference to `__sync_add_and_fetch_8' -/usr/bin/ld: /<>/libraries/ghc-prim/dist-install/build/libHSghc-prim-0.5.3_p.a(atomic.p_o): in function `hs_atomicwrite64': -atomic.c:(.text.hs_atomicwrite64+0x38): undefined reference to `__sync_bool_compare_and_swap_8' - -Fixes #17886. ---- - libraries/ghc-prim/cbits/atomic.c | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/libraries/ghc-prim/cbits/atomic.c b/libraries/ghc-prim/cbits/atomic.c -index ac2e608ec2..01037d70ee 100644 ---- a/libraries/ghc-prim/cbits/atomic.c -+++ b/libraries/ghc-prim/cbits/atomic.c -@@ -361,6 +361,7 @@ hs_atomicread32(StgWord x) - #endif - } - -+#if WORD_SIZE_IN_BITS == 64 - extern StgWord64 hs_atomicread64(StgWord x); - StgWord64 - hs_atomicread64(StgWord x) -@@ -371,6 +372,7 @@ hs_atomicread64(StgWord x) - return __sync_add_and_fetch((StgWord64 *) x, 0); - #endif - } -+#endif - - // AtomicWriteByteArrayOp_Int - // Implies a full memory barrier (see compiler/prelude/primops.txt.pp) -@@ -409,6 +411,7 @@ hs_atomicwrite32(StgWord x, StgWord val) - #endif - } - -+#if WORD_SIZE_IN_BITS == 64 - extern void hs_atomicwrite64(StgWord x, StgWord64 val); - void - hs_atomicwrite64(StgWord x, StgWord64 val) -@@ -420,3 +423,5 @@ hs_atomicwrite64(StgWord x, StgWord64 val) - #endif - } - #endif -+ -+#endif --- -GitLab - diff --git a/srcpkgs/ghc/patches/ppc64-be-elfv2.patch b/srcpkgs/ghc/patches/ppc64-be-elfv2.patch index 275444e828b..df1a0bfe15b 100644 --- a/srcpkgs/ghc/patches/ppc64-be-elfv2.patch +++ b/srcpkgs/ghc/patches/ppc64-be-elfv2.patch @@ -1,36 +1,24 @@ -From fd191973558cf4aeb0d5ca107357defd6f837c38 Mon Sep 17 00:00:00 2001 -From: Daniel Kolesa -Date: Tue, 5 Jan 2021 04:10:25 +0100 +From 587edc0d9786aff3c7a4728ba941f6a993e59bdc Mon Sep 17 00:00:00 2001 +From: q66 +Date: Thu, 28 Apr 2022 00:48:04 +0200 Subject: [PATCH] fix up runtime for ppc64 BE ELFv2 + ensure it's used --- - aclocal.m4 | 2 +- configure | 2 +- libraries/ghci/GHCi/InfoTable.hsc | 36 ++++++++++++------------------- - rts/Adjustor.c | 12 +++++------ + m4/fptools.m4 | 2 +- rts/AdjustorAsm.S | 2 +- rts/StgCRun.c | 4 ++-- rts/StgCRunAsm.S | 2 +- - 7 files changed, 26 insertions(+), 34 deletions(-) + rts/adjustor/NativeIA64.c | 2 +- + rts/adjustor/NativePowerPC.c | 2 +- + 8 files changed, 22 insertions(+), 30 deletions(-) -diff --git a/aclocal.m4 b/aclocal.m4 -index 41cecf0..ba08bd2 100644 ---- a/aclocal.m4 -+++ b/aclocal.m4 -@@ -199,7 +199,7 @@ AC_DEFUN([FPTOOLS_SET_HASKELL_PLATFORM_V - test -z "[$]2" || eval "[$]2=ArchPPC" - ;; - powerpc64) -- test -z "[$]2" || eval "[$]2=\"ArchPPC_64 {ppc_64ABI = ELF_V1}\"" -+ test -z "[$]2" || eval "[$]2=\"ArchPPC_64 {ppc_64ABI = ELF_V2}\"" - ;; - powerpc64le) - test -z "[$]2" || eval "[$]2=\"ArchPPC_64 {ppc_64ABI = ELF_V2}\"" diff --git a/configure b/configure -index 183e661..8aae1bc 100755 +index 8310e6f..eac1124 100755 --- a/configure +++ b/configure -@@ -10296,7 +10296,7 @@ $as_echo "done" >&6; } +@@ -10508,7 +10508,7 @@ printf "%s\n" "no" >&6; } test -z "$2" || eval "$2=ArchPPC" ;; powerpc64) @@ -40,10 +28,10 @@ index 183e661..8aae1bc 100755 powerpc64le) test -z "$2" || eval "$2=\"ArchPPC_64 {ppc_64ABI = ELF_V2}\"" diff --git a/libraries/ghci/GHCi/InfoTable.hsc b/libraries/ghci/GHCi/InfoTable.hsc -index ec3c18a..0359be7 100644 +index ad4eb4d..e4f1c0c 100644 --- a/libraries/ghci/GHCi/InfoTable.hsc +++ b/libraries/ghci/GHCi/InfoTable.hsc -@@ -228,30 +228,22 @@ mkJumpToAddr a = case platform of +@@ -231,30 +231,22 @@ mkJumpToAddr' platform a = case platform of , fromIntegral w64 , fromIntegral (w64 `shiftR` 32) ] ArchPPC64 -> @@ -85,103 +73,96 @@ index ec3c18a..0359be7 100644 + in Right [ 0x3D800000 .|. hi16 w32, + 0x618C0000 .|. lo16 w32, + 0x7D8903A6, 0x4E800420 ] - + ArchPPC64LE -> -- The ABI requires r12 to point to the function's entry point. -diff --git a/rts/Adjustor.c b/rts/Adjustor.c -index d360cfe..ab7ede7 100644 ---- a/rts/Adjustor.c -+++ b/rts/Adjustor.c -@@ -49,7 +49,7 @@ Haskell side. - - #if defined(i386_HOST_ARCH) - extern void adjustorCode(void); --#elif defined(powerpc_HOST_ARCH) || defined(powerpc64_HOST_ARCH) -+#elif defined(powerpc_HOST_ARCH) || (defined(powerpc64_HOST_ARCH) && (_CALL_ELF != 2)) - // from AdjustorAsm.s - // not declared as a function so that AIX-style - // fundescs can never get in the way. -@@ -278,7 +278,7 @@ __asm__("obscure_ccall_ret_code:\n\t" - extern void obscure_ccall_ret_code(void); - #endif - --#if defined(powerpc_HOST_ARCH) || defined(powerpc64_HOST_ARCH) -+#if defined(powerpc_HOST_ARCH) || (defined(powerpc64_HOST_ARCH) && (_CALL_ELF != 2)) - #if !(defined(powerpc_HOST_ARCH) && defined(linux_HOST_OS)) - - /* !!! !!! WARNING: !!! !!! -@@ -318,7 +318,7 @@ typedef struct AdjustorStub { - } AdjustorStub; - #endif - --#if defined(i386_HOST_ARCH) || defined(powerpc_HOST_ARCH) || defined(powerpc64_HOST_ARCH) -+#if defined(i386_HOST_ARCH) || defined(powerpc_HOST_ARCH) || (defined(powerpc64_HOST_ARCH) && (_CALL_ELF != 2)) - static int totalArgumentSize(char *typeString) - { - int sz = 0; -@@ -351,7 +351,7 @@ void* - createAdjustor(int cconv, StgStablePtr hptr, - StgFunPtr wptr, - char *typeString --#if !defined(powerpc_HOST_ARCH) && !defined(powerpc64_HOST_ARCH) && !defined(x86_64_HOST_ARCH) -+#if !defined(powerpc_HOST_ARCH) && (!defined(powerpc64_HOST_ARCH) || (_CALL_ELF == 2)) && !defined(x86_64_HOST_ARCH) - STG_UNUSED - #endif - ) -@@ -1271,7 +1271,7 @@ freeHaskellFunctionPtr(void* ptr) - return; - } - freeStablePtr(((StgStablePtr*)ptr)[1]); --#elif defined(powerpc_HOST_ARCH) || defined(powerpc64_HOST_ARCH) -+#elif defined(powerpc_HOST_ARCH) || (defined(powerpc64_HOST_ARCH) && (_CALL_ELF != 2)) - if ( ((AdjustorStub*)ptr)->code != (StgFunPtr) &adjustorCode ) { - errorBelch("freeHaskellFunctionPtr: not for me, guv! %p\n", ptr); - return; +diff --git a/m4/fptools.m4 b/m4/fptools.m4 +index 8c6c9b7..eb25c37 100644 +--- a/m4/fptools.m4 ++++ b/m4/fptools.m4 +@@ -201,7 +201,7 @@ AC_DEFUN([FPTOOLS_SET_HASKELL_PLATFORM_VARS], + test -z "[$]2" || eval "[$]2=ArchPPC" + ;; + powerpc64) +- test -z "[$]2" || eval "[$]2=\"ArchPPC_64 {ppc_64ABI = ELF_V1}\"" ++ test -z "[$]2" || eval "[$]2=\"ArchPPC_64 {ppc_64ABI = ELF_V2}\"" + ;; + powerpc64le) + test -z "[$]2" || eval "[$]2=\"ArchPPC_64 {ppc_64ABI = ELF_V2}\"" diff --git a/rts/AdjustorAsm.S b/rts/AdjustorAsm.S index 2795b83..63cfe91 100644 --- a/rts/AdjustorAsm.S +++ b/rts/AdjustorAsm.S @@ -2,7 +2,7 @@ - + /* ******************************** PowerPC ******************************** */ - + -#if defined(powerpc_HOST_ARCH) || defined(powerpc64_HOST_ARCH) +#if defined(powerpc_HOST_ARCH) || (defined(powerpc64_HOST_ARCH) && (_CALL_ELF != 2)) #if !(defined(powerpc_HOST_ARCH) && defined(linux_HOST_OS)) /* The following code applies, with some differences, to all powerpc platforms except for powerpc32-linux, diff --git a/rts/StgCRun.c b/rts/StgCRun.c -index 934926e..2ff8662 100644 +index f43227a..927d44a 100644 --- a/rts/StgCRun.c +++ b/rts/StgCRun.c -@@ -726,7 +726,7 @@ StgRunIsImplementedInAssembler(void) +@@ -724,7 +724,7 @@ StgRunIsImplementedInAssembler(void) Everything is in assembler, so we don't have to deal with GCC... -------------------------------------------------------------------------- */ - + -#if defined(powerpc64_HOST_ARCH) +#if defined(powerpc64_HOST_ARCH) && (_CALL_ELF != 2) - - static void GNUC3_ATTRIBUTE(used) - StgRunIsImplementedInAssembler(void) -@@ -851,7 +851,7 @@ StgRunIsImplementedInAssembler(void) - + /* 64-bit PowerPC ELF ABI 1.9 + * + * Stack frame organization (see Figure 3-17, ELF ABI 1.9, p 14) +@@ -792,7 +792,7 @@ StgRunIsImplementedInAssembler(void) + #endif - + -#if defined(powerpc64le_HOST_ARCH) +#if defined(powerpc64le_HOST_ARCH) || (defined(powerpc64_HOST_ARCH) && (_CALL_ELF == 2)) /* ----------------------------------------------------------------------------- PowerPC 64 little endian architecture - + diff --git a/rts/StgCRunAsm.S b/rts/StgCRunAsm.S -index 9274a44..3b4fc33 100644 +index 60f1bf9..c6794d7 100644 --- a/rts/StgCRunAsm.S +++ b/rts/StgCRunAsm.S @@ -5,7 +5,7 @@ * then functions StgRun/StgReturn are implemented in file StgCRun.c */ #if !defined(USE_MINIINTERPRETER) - + -#if defined(powerpc64le_HOST_ARCH) +#if defined(powerpc64le_HOST_ARCH) || (defined(powerpc64_HOST_ARCH) && (_CALL_ELF == 2)) # if defined(linux_HOST_OS) - # define STACK_FRAME_SIZE RESERVED_C_STACK_BYTES+304 - .file "StgCRun.c" + /* 64-bit PowerPC ELF V2 ABI Revision 1.4 + * +diff --git a/rts/adjustor/NativeIA64.c b/rts/adjustor/NativeIA64.c +index 9fd1991..816b3ef 100644 +--- a/rts/adjustor/NativeIA64.c ++++ b/rts/adjustor/NativeIA64.c +@@ -39,7 +39,7 @@ void* + createAdjustor(int cconv, StgStablePtr hptr, + StgFunPtr wptr, + char *typeString +-#if !defined(powerpc_HOST_ARCH) && !defined(powerpc64_HOST_ARCH) && !defined(x86_64_HOST_ARCH) ++#if !defined(powerpc_HOST_ARCH) && (!defined(powerpc64_HOST_ARCH) || (_CALL_ELF == 2)) && !defined(x86_64_HOST_ARCH) + STG_UNUSED + #endif + ) +diff --git a/rts/adjustor/NativePowerPC.c b/rts/adjustor/NativePowerPC.c +index 2e5d605..caef5d3 100644 +--- a/rts/adjustor/NativePowerPC.c ++++ b/rts/adjustor/NativePowerPC.c +@@ -29,7 +29,7 @@ __asm__("obscure_ccall_ret_code:\n\t" + extern void obscure_ccall_ret_code(void); + #endif /* defined(linux_HOST_OS) */ + +-#if defined(powerpc_HOST_ARCH) || defined(powerpc64_HOST_ARCH) ++#if defined(powerpc_HOST_ARCH) || (defined(powerpc64_HOST_ARCH) && (_CALL_ELF != 2)) + #if !(defined(powerpc_HOST_ARCH) && defined(linux_HOST_OS)) + + /* !!! !!! WARNING: !!! !!! +-- +2.35.1 + diff --git a/srcpkgs/ghc/template b/srcpkgs/ghc/template index b8b16f67b43..c4bbb3e4e3b 100644 --- a/srcpkgs/ghc/template +++ b/srcpkgs/ghc/template @@ -1,7 +1,7 @@ # Template file for 'ghc' pkgname=ghc # Keep this synchronized with http://www.stackage.org/lts -version=8.10.7 +version=9.0.2 revision=1 wrksrc="ghc-${version%[!0-9]}" build_style=gnu-configure @@ -14,7 +14,7 @@ maintainer="slotThe " license="BSD-3-Clause" homepage="http://www.haskell.org/ghc/" distfiles="http://www.haskell.org/ghc/dist/${version%[!0-9]}/${pkgname}-${version%[!0-9]}-src.tar.xz" -checksum=e3eef6229ce9908dfe1ea41436befb0455fefb1932559e860ad4c606b0d03c9d +checksum=140e42b96346322d1a39eb17602bcdc76e292028ad4a69286b230bab188a9197 nocross=yes # this is conditionally unset for cross bindist nodebug=yes # work around assembler error "Fatal error: duplicate .debug_line sections" _bindir="/usr/lib/${pkgname}-${version}/bin"