ghc: update to 9.0.2

This commit is contained in:
slotThe 2022-03-18 17:33:46 +01:00 committed by q66
parent b9e6b8a3dd
commit 9836c283a4
3 changed files with 72 additions and 149 deletions

View File

@ -1,58 +0,0 @@
From 5c5aa87d50dc4ea97e76e13f285a7b5dd71fcd88 Mon Sep 17 00:00:00 2001
From: Ilias Tsitsimpis <iliastsi@debian.org>
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: /<<PKGBUILDDIR>>/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: /<<PKGBUILDDIR>>/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

View File

@ -1,36 +1,24 @@
From fd191973558cf4aeb0d5ca107357defd6f837c38 Mon Sep 17 00:00:00 2001
From: Daniel Kolesa <daniel@octaforge.org>
Date: Tue, 5 Jan 2021 04:10:25 +0100
From 587edc0d9786aff3c7a4728ba941f6a993e59bdc Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
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 ->
@ -88,55 +76,19 @@ index ec3c18a..0359be7 100644
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
@ -151,19 +103,19 @@ index 2795b83..63cfe91 100644
/* 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
@ -173,7 +125,7 @@ index 934926e..2ff8662 100644
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 @@
@ -183,5 +135,34 @@ index 9274a44..3b4fc33 100644
-#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

View File

@ -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 <soliditsallgood@mailbox.org>"
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"