[Git][haskell-team/DHG_packages][experimental] ghc: Build with newer hadrian

Ilias Tsitsimpis (@iliastsi) gitlab at salsa.debian.org
Thu Oct 12 19:35:04 BST 2023



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


Commits:
f9e57954 by Ilias Tsitsimpis at 2023-10-12T21:02:49+03:00
ghc: Build with newer hadrian

- - - - -


5 changed files:

- p/ghc/debian/changelog
- p/ghc/debian/control
- + p/ghc/debian/patches/hadrian-fix-dnosmp
- p/ghc/debian/patches/series
- p/ghc/debian/rules


Changes:

=====================================
p/ghc/debian/changelog
=====================================
@@ -1,3 +1,10 @@
+ghc (9.4.7-1~exp3) experimental; urgency=medium
+
+  * Do not pass -optc-mxgot on mips64el, it is not needed anymore
+  * hadrian: Pass -DNOSMP to C compiler when needed
+
+ -- Ilias Tsitsimpis <iliastsi at debian.org>  Thu, 12 Oct 2023 21:02:40 +0300
+
 ghc (9.4.7-1~exp2) experimental; urgency=medium
 
   * Fix mxgot parameter for mips64el build


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


=====================================
p/ghc/debian/patches/hadrian-fix-dnosmp
=====================================
@@ -0,0 +1,62 @@
+commit bea762f2c9d3ff1f67e3fdb22a8ac288b32225b0
+Author: Ilias Tsitsimpis <iliastsi at debian.org>
+Date:   Thu Oct 12 12:44:02 2023 +0300
+
+    hadrian: Pass -DNOSMP to C compiler when needed
+    
+    Hadrian passes the -DNOSMP flag to GHC when the target doesn't support
+    SMP, but doesn't pass it to CC as well, leading to the following
+    compilation error on mips64el:
+    
+    | Run Cc (FindCDependencies CDep) Stage1: rts/sm/NonMovingScav.c => _build/stage1/rts/build/c/sm/NonMovingScav.o.d
+    Command line: /usr/bin/mips64el-linux-gnuabi64-gcc -E -MM -MG -MF _build/stage1/rts/build/c/hooks/FlagDefaults.thr_debug_p_o.d -MT _build/stage1/rts/build/c/hooks/FlagDefaults.o -Irts/include -I_build/stage1/rts/build -I_build/stage1/rts/build/include -Irts/include -x c rts/hooks/FlagDefaults.c -Wall -Wextra -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Winline -Wpointer-arith -Wmissing-noreturn -Wnested-externs -Wredundant-decls -Wundef -fno-strict-aliasing -DTHREADED_RTS -DDEBUG -fomit-frame-pointer -O2 -g -Irts -I_build/stage1/rts/build -DDEBUG -fno-omit-frame-pointer -g3 -O0
+    ===> Command failed with error code: 1
+    In file included from rts/include/Stg.h:348,
+                     from rts/include/Rts.h:38,
+                     from rts/hooks/FlagDefaults.c:8:
+    rts/include/stg/SMP.h:416:2: error: #error memory barriers unimplemented on this architecture
+      416 | #error memory barriers unimplemented on this architecture
+          |  ^~~~~
+    rts/include/stg/SMP.h:440:2: error: #error memory barriers unimplemented on this architecture
+      440 | #error memory barriers unimplemented on this architecture
+          |  ^~~~~
+    rts/include/stg/SMP.h:464:2: error: #error memory barriers unimplemented on this architecture
+      464 | #error memory barriers unimplemented on this architecture
+          |  ^~~~~
+    
+    The old make system correctly passed this flag to both GHC and CC [1].
+    
+    Fix this error by passing -DNOSMP to CC as well.
+    
+    [1] https://gitlab.haskell.org/ghc/ghc/-/blob/00920f176b0235d5bb52a8e054d89a664f8938fe/rts/ghc.mk#L407
+    
+    Closes #24082
+
+Index: b/hadrian/src/Settings/Packages.hs
+===================================================================
+--- a/hadrian/src/Settings/Packages.hs
++++ b/hadrian/src/Settings/Packages.hs
+@@ -300,13 +300,11 @@ rtsPackageArgs = package rts ? do
+           -- Set the namespace for the rts fs functions
+           , arg $ "-DFS_NAMESPACE=rts"
+           , arg $ "-DCOMPILING_RTS"
+-          , notM targetSupportsSMP           ? arg "-DNOSMP"
+           , way `elem` [debug, debugDynamic] ? pure [ "-DTICKY_TICKY"
+                                                     , "-optc-DTICKY_TICKY"]
+           , Profiling `wayUnit` way          ? arg "-DPROFILING"
+           , Threaded  `wayUnit` way          ? arg "-DTHREADED_RTS"
+-          , notM targetSupportsSMP           ? pure [ "-DNOSMP"
+-                                                    , "-optc-DNOSMP" ]
++          , notM targetSupportsSMP           ? arg "-optc-DNOSMP"
+           ]
+ 
+     let cArgs = mconcat
+@@ -325,6 +323,8 @@ rtsPackageArgs = package rts ? do
+           , arg "-Irts"
+           , arg $ "-I" ++ path
+ 
++          , notM targetSupportsSMP           ? arg "-DNOSMP"
++
+           , Debug     `wayUnit` way          ? pure [ "-DDEBUG"
+                                                     , "-fno-omit-frame-pointer"
+                                                     , "-g3"


=====================================
p/ghc/debian/patches/series
=====================================
@@ -18,3 +18,4 @@ sparc-support
 hadrian-disable-threaded
 fix-hs_cmpxchg64
 fix-32-bit-unreg
+hadrian-fix-dnosmp


=====================================
p/ghc/debian/rules
=====================================
@@ -79,10 +79,12 @@ ifneq (,$(filter i386 mips mipsel hppa, $(DEB_HOST_ARCH)))
 	EXTRA_HADRIAN_FLAGS += "*.*.ghc.hs.opts += -optc--param -optcggc-min-expand=10"
 endif
 
-ifneq (,$(filter mips64el, $(DEB_HOST_ARCH)))
-	# Pass -mxgot to fix relocation linker errors
-	EXTRA_HADRIAN_FLAGS += "*.*.ghc.hs.opts += -optc-mxgot"
-endif
+# mips64el compiles fine without it. Keep this commented out in
+# case we need it in the future.
+# ifneq (,$(filter mips64el, $(DEB_HOST_ARCH)))
+# 	# Pass -mxgot to fix relocation linker errors
+# 	EXTRA_HADRIAN_FLAGS += "*.*.ghc.hs.opts += -optc-mxgot"
+# endif
 
 ifneq (,$(filter x32, $(DEB_HOST_ARCH)))
 	EXTRA_HADRIAN_FLAGS += --integer-simple



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

-- 
View it on GitLab: https://salsa.debian.org/haskell-team/DHG_packages/-/commit/f9e57954d65aeaccf0061be2d4ece02553d05407
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/20231012/20131d70/attachment-0001.htm>


More information about the Pkg-haskell-commits mailing list