[Git][haskell-team/DHG_packages][experimental] 3 commits: ghc: Enable GHCi on all platforms

Ilias Tsitsimpis (@iliastsi) gitlab at salsa.debian.org
Sat Oct 14 17:12:46 BST 2023



Ilias Tsitsimpis pushed to branch experimental at Debian Haskell Group / DHG_packages


Commits:
8b8d2837 by Ilias Tsitsimpis at 2023-10-14T15:07:08+03:00
ghc: Enable GHCi on all platforms

- - - - -
c8e213e4 by Ilias Tsitsimpis at 2023-10-14T15:19:45+03:00
ghc: Backport patch to use C11 atomics

- - - - -
d1089c06 by Ilias Tsitsimpis at 2023-10-14T16:59:09+03:00
ghc: Test runghc

Add a test about runghc, which is only available if GHC was compiled to
include the interpreter. haskell-devscripts uses runhaskell (runghc), so
it's imperative to verify that it works.

- - - - -


6 changed files:

- p/ghc/debian/changelog
- p/ghc/debian/control
- + p/ghc/debian/patches/hadrian-enable-interpreter
- p/ghc/debian/patches/series
- + p/ghc/debian/patches/use-modern-atomics
- p/ghc/debian/rules


Changes:

=====================================
p/ghc/debian/changelog
=====================================
@@ -1,3 +1,10 @@
+ghc (9.4.7-1~exp4) experimental; urgency=medium
+
+  * hadrian: Enable GHCi on all platforms
+  * Backport patch to use C11 atomics (Closes: #1052144)
+
+ -- Ilias Tsitsimpis <iliastsi at debian.org>  Sat, 14 Oct 2023 15:19:29 +0300
+
 ghc (9.4.7-1~exp3) experimental; urgency=medium
 
   * Do not pass -optc-mxgot on mips64el, it is not needed anymore


=====================================
p/ghc/debian/control
=====================================
@@ -13,7 +13,7 @@ Build-Depends:
   devscripts,
   pkg-config,
   ghc:native (>= 9.0),
-  hadrian:native (>= 9.4.7-2) <!pkg.ghc.nohadrian>,
+  hadrian:native (>= 9.4.7-3) <!pkg.ghc.nohadrian>,
   hadrian:native (<< 9.5) <!pkg.ghc.nohadrian>,
   llvm-15 [armel armhf s390x riscv64],
   libgmp-dev,


=====================================
p/ghc/debian/patches/hadrian-enable-interpreter
=====================================
@@ -0,0 +1,24 @@
+Description: Enable GHCi on all platforms in Debian
+Author: Ilias Tsitsimpis <iliastsi at debian.org>
+Bug: https://gitlab.haskell.org/ghc/ghc/-/issues/24098
+
+Index: b/hadrian/src/Oracles/Setting.hs
+===================================================================
+--- a/hadrian/src/Oracles/Setting.hs
++++ b/hadrian/src/Oracles/Setting.hs
+@@ -287,13 +287,8 @@ hostSupportsRPaths = anyHostOs ["linux",
+ -- | Check whether the target supports GHCi.
+ ghcWithInterpreter :: Action Bool
+ ghcWithInterpreter = do
+-    goodOs <- anyTargetOs [ "mingw32", "cygwin32", "linux", "solaris2"
+-                          , "freebsd", "dragonfly", "netbsd", "openbsd"
+-                          , "darwin", "kfreebsdgnu" ]
+-    goodArch <- anyTargetArch [ "i386", "x86_64", "powerpc"
+-                              , "arm", "aarch64", "s390x"
+-                              , "powerpc64", "powerpc64le" ]
+-    return $ goodOs && goodArch
++    -- Enable GHCi on all platforms for Debian
++    return True
+ 
+ -- | Variants of the ARM architecture.
+ data ArmVersion = ARMv5 | ARMv6 | ARMv7


=====================================
p/ghc/debian/patches/series
=====================================
@@ -19,3 +19,5 @@ hadrian-disable-threaded
 fix-hs_cmpxchg64
 fix-32-bit-unreg
 hadrian-fix-dnosmp
+hadrian-enable-interpreter
+use-modern-atomics


=====================================
p/ghc/debian/patches/use-modern-atomics
=====================================
@@ -0,0 +1,56 @@
+commit f8fa1d08d7cbfef508bab355bda80f495e928f98
+Author: Ben Gamari <bgamari.foss at gmail.com>
+Date:   Mon Apr 17 21:04:47 2023 +0000
+
+    ghc-prim: Use C11 atomics
+    
+    Previously `ghc-prim`'s atomic wrappers used the legacy `__sync_*`
+    family of C builtins. Here we refactor these to rather use the
+    appropriate C11 atomic equivalents, allowing us to be more explicit
+    about the expected ordering semantics.
+
+Index: b/libraries/ghc-prim/cbits/atomic.c
+===================================================================
+--- a/libraries/ghc-prim/cbits/atomic.c
++++ b/libraries/ghc-prim/cbits/atomic.c
+@@ -291,28 +291,36 @@ extern StgWord hs_cmpxchg8(StgWord x, St
+ StgWord
+ hs_cmpxchg8(StgWord x, StgWord old, StgWord new)
+ {
+-  return __sync_val_compare_and_swap((volatile StgWord8 *) x, (StgWord8) old, (StgWord8) new);
++  StgWord8 expected = (StgWord8) old;
++  __atomic_compare_exchange_n((StgWord8 *) x, &expected, (StgWord8) new, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
++  return expected;
+ }
+ 
+ extern StgWord hs_cmpxchg16(StgWord x, StgWord old, StgWord new);
+ StgWord
+ hs_cmpxchg16(StgWord x, StgWord old, StgWord new)
+ {
+-  return __sync_val_compare_and_swap((volatile StgWord16 *) x, (StgWord16) old, (StgWord16) new);
++  StgWord16 expected = (StgWord16) old;
++  __atomic_compare_exchange_n((StgWord16 *) x, &expected, (StgWord16) new, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
++  return expected;
+ }
+ 
+ extern StgWord hs_cmpxchg32(StgWord x, StgWord old, StgWord new);
+ StgWord
+ hs_cmpxchg32(StgWord x, StgWord old, StgWord new)
+ {
+-  return __sync_val_compare_and_swap((volatile StgWord32 *) x, (StgWord32) old, (StgWord32) new);
++  StgWord32 expected = (StgWord32) old;
++  __atomic_compare_exchange_n((StgWord32 *) x, &expected, (StgWord32) new, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
++  return expected;
+ }
+ 
+ extern StgWord64 hs_cmpxchg64(StgWord x, StgWord64 old, StgWord64 new);
+ StgWord64
+ hs_cmpxchg64(StgWord x, StgWord64 old, StgWord64 new)
+ {
+-  return __sync_val_compare_and_swap((volatile StgWord64 *) x, old, new);
++  StgWord64 expected = (StgWord64) old;
++  __atomic_compare_exchange_n((StgWord64 *) x, &expected, (StgWord64) new, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
++  return expected;
+ }
+ 
+ // Atomic exchange operations


=====================================
p/ghc/debian/rules
=====================================
@@ -342,11 +342,16 @@ ifeq (,$(filter nocheck, $(DEB_BUILD_OPTIONS)))
 	_build/stage1/bin/ghc debian/testghc/foo.hs -o debian/testghc/foo -O2
 	[ "$$(debian/testghc/foo)" = "Foo" ]
 	rm debian/testghc/*
+	# Test runghc
+	echo 'main = putStrLn "Foo"' > debian/testghc/foo.hs
+	[ "$$(_build/stage1/bin/runghc debian/testghc/foo.hs)" = "Foo" ]
+	rm debian/testghc/*
+	# Output information about GHC
 	@printf "====BEGIN GHC INFO OUTPUT====\n"
-	@_build/stage1/bin/ghc --info
+	_build/stage1/bin/ghc --info
 	@printf "====END GHC INFO OUTPUT====\n"
 	@printf "====BEGIN GHC-PKG OUTPUT====\n"
-	@_build/stage1/bin/ghc-pkg list
+	_build/stage1/bin/ghc-pkg list
 	@printf "====END GHC-PKG OUTPUT====\n"
 endif
 



View it on GitLab: https://salsa.debian.org/haskell-team/DHG_packages/-/compare/f9e57954d65aeaccf0061be2d4ece02553d05407...d1089c06d33d3c688e6395bdfa6750d47c4d0fda

-- 
View it on GitLab: https://salsa.debian.org/haskell-team/DHG_packages/-/compare/f9e57954d65aeaccf0061be2d4ece02553d05407...d1089c06d33d3c688e6395bdfa6750d47c4d0fda
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-haskell-commits/attachments/20231014/563aee5b/attachment-0001.htm>


More information about the Pkg-haskell-commits mailing list