[Git][haskell-team/DHG_packages][master] 5 commits: ghc: Fix determinism of linker arguments

Ilias Tsitsimpis (@iliastsi) gitlab at salsa.debian.org
Fri Mar 6 22:24:27 GMT 2026



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


Commits:
3ec86fdd by Ilias Tsitsimpis at 2026-03-07T00:17:32+02:00
ghc: Fix determinism of linker arguments

- - - - -
d4c43419 by Ilias Tsitsimpis at 2026-03-07T00:17:32+02:00
Bump standards version to 4.7.3

- - - - -
d7d83b3c by Ilias Tsitsimpis at 2026-03-07T00:17:32+02:00
Bump debhelper compat to 13

- - - - -
47af15b6 by Ilias Tsitsimpis at 2026-03-07T00:17:32+02:00
Add bash completion

- - - - -
af864409 by Ilias Tsitsimpis at 2026-03-07T00:18:55+02:00
Backport patches to build on hurd-any

- - - - -


12 changed files:

- p/ghc/debian/changelog
- p/ghc/debian/control
- + p/ghc/debian/ghc.bash-completion
- p/ghc/debian/patches/0004-llvmGen-Pass-mcmodel-medium-option-to-LLVM-backend-on-LoongArch.patch
- p/ghc/debian/patches/0005-Pass-the-mcmodel-medium-parameter-to-CC-via-GHC.patch
- + p/ghc/debian/patches/fix-determinism-in-linker
- p/ghc/debian/patches/gnu-hurd → p/ghc/debian/patches/gnu-hurd-getExecutablePath
- + p/ghc/debian/patches/gnu-hurd-linklm
- + p/ghc/debian/patches/gnu-hurd-os-string
- p/ghc/debian/patches/hppa-sparc64-support.patch
- p/ghc/debian/patches/series
- p/ghc/debian/rules


Changes:

=====================================
p/ghc/debian/changelog
=====================================
@@ -1,5 +1,6 @@
-ghc (9.10.3-4) UNRELEASED; urgency=medium
+ghc (9.10.3-4) unstable; urgency=medium
 
+  [ John Paul Adrian Glaubitz ]
   * Build with -optc-no-integrated-cpp on hppa
   * Build with --enable-ld-override on loong64 (Closes: #1125455)
   * Drop --enable-unregisterised on loong64 after bootstrap
@@ -8,7 +9,14 @@ ghc (9.10.3-4) UNRELEASED; urgency=medium
   * Stop passing -optc-mcmodel=medium in EXTRA_HADRIAN_FLAGS on loong64
   * Update patch to pass -mcmodel=medium to LLVM backend on loong64
 
- -- John Paul Adrian Glaubitz <glaubitz at physik.fu-berlin.de>  Sun, 25 Jan 2026 17:56:20 +0100
+  [ Ilias Tsitsimpis ]
+  * Fix determinism of linker arguments (Closes: #1125305)
+  * Bump standards version to 4.7.3
+  * Bump debhelper compat to 13
+  * Add bash completion
+  * Backport patches to build on hurd-any (Closes: #1128371)
+
+ -- Ilias Tsitsimpis <iliastsi at debian.org>  Sun, 01 Mar 2026 12:31:29 +0200
 
 ghc (9.10.3-3) unstable; urgency=medium
 


=====================================
p/ghc/debian/control
=====================================
@@ -1,14 +1,13 @@
 Source: ghc
 Section: haskell
-Priority: optional
 Maintainer: Debian Haskell Group <pkg-haskell-maintainers at lists.alioth.debian.org>
 Uploaders:
  Clint Adams <clint at debian.org>,
  Ilias Tsitsimpis <iliastsi at debian.org>
-Standards-Version: 4.7.2
+Standards-Version: 4.7.3
 Rules-Requires-Root: no
 Build-Depends:
-  debhelper-compat (= 12),
+  debhelper-compat (= 13),
   haskell-devscripts-minimal (>= 0.16.36) <!cross>,
   gcc,
   g++,
@@ -25,6 +24,7 @@ Build-Depends:
   libnuma-dev [linux-any],
   python3:native,
   python3-sphinx <!cross>,
+  bash-completion,
 Build-Depends-Indep:
   hscolour,
   python3-sphinx-rtd-theme,


=====================================
p/ghc/debian/ghc.bash-completion
=====================================
@@ -0,0 +1,2 @@
+utils/completion/ghc.bash ghc
+utils/completion/ghc.bash ghci


=====================================
p/ghc/debian/patches/0004-llvmGen-Pass-mcmodel-medium-option-to-LLVM-backend-on-LoongArch.patch
=====================================
@@ -18,11 +18,11 @@ Add new type for codemodel
  compiler/GHC/CmmToLlvm.hs | 16 +++++++++++++++-
  1 file changed, 15 insertions(+), 1 deletion(-)
 
-diff --git a/compiler/GHC/CmmToLlvm.hs b/compiler/GHC/CmmToLlvm.hs
-index 7ab55d975a..372a41acdd 100644
+Index: b/compiler/GHC/CmmToLlvm.hs
+===================================================================
 --- a/compiler/GHC/CmmToLlvm.hs
 +++ b/compiler/GHC/CmmToLlvm.hs
-@@ -221,7 +221,12 @@ cmmMetaLlvmPrelude = do
+@@ -218,7 +218,12 @@ cmmMetaLlvmPrelude = do
            case platformArch platform of
              ArchX86_64 | llvmCgAvxEnabled cfg -> [mkStackAlignmentMeta 32]
              _                                 -> []
@@ -36,7 +36,7 @@ index 7ab55d975a..372a41acdd 100644
    let metas = tbaa_metas ++ module_flags_metas
    cfg <- getConfig
    renderLlvm (ppLlvmMetas cfg metas)
-@@ -244,6 +249,15 @@ mkStackAlignmentMeta :: Integer -> ModuleFlag
+@@ -241,6 +246,15 @@ mkStackAlignmentMeta :: Integer -> Modul
  mkStackAlignmentMeta alignment =
      ModuleFlag MFBError "override-stack-alignment" (MetaLit $ LMIntLit alignment i32)
  
@@ -52,6 +52,3 @@ index 7ab55d975a..372a41acdd 100644
  
  -- -----------------------------------------------------------------------------
  -- | Marks variables as used where necessary
--- 
-2.47.3
-


=====================================
p/ghc/debian/patches/0005-Pass-the-mcmodel-medium-parameter-to-CC-via-GHC.patch
=====================================
@@ -15,11 +15,11 @@ R_LARCH_B26 overflow error.
  m4/fptools_set_c_ld_flags.m4 | 4 ++++
  1 file changed, 4 insertions(+)
 
-diff --git a/m4/fptools_set_c_ld_flags.m4 b/m4/fptools_set_c_ld_flags.m4
-index 13913709c9..0fc4b0198b 100644
+Index: b/m4/fptools_set_c_ld_flags.m4
+===================================================================
 --- a/m4/fptools_set_c_ld_flags.m4
 +++ b/m4/fptools_set_c_ld_flags.m4
-@@ -93,6 +93,10 @@ AC_DEFUN([FPTOOLS_SET_C_LD_FLAGS],
+@@ -108,6 +108,10 @@ AC_DEFUN([FPTOOLS_SET_C_LD_FLAGS],
          $5="$$5 -D_THREAD_SAFE"
          ;;
  
@@ -30,6 +30,3 @@ index 13913709c9..0fc4b0198b 100644
      esac
  
      AC_MSG_RESULT([done])
--- 
-2.49.0
-


=====================================
p/ghc/debian/patches/fix-determinism-in-linker
=====================================
@@ -0,0 +1,43 @@
+From a0afb3ad44c1ecc8ac8125c1ac882580b28bf9bc Mon Sep 17 00:00:00 2001
+From: Ilias Tsitsimpis <iliastsi at debian.org>
+Date: Thu, 29 Jan 2026 21:34:53 +0200
+Subject: [PATCH] Fix determinism of linker arguments
+
+The switch from Data.Map to UniqMap in 3b5be05ac29 introduced
+non-determinism in the order of packages passed to the linker.
+
+This resulted in non-reproducible builds where the DT_NEEDED entries in
+dynamic libraries were ordered differently across builds.
+
+Fix the regression by explicitly sorting the package list derived from
+UniqMap.
+
+Fixes #26838
+---
+ compiler/GHC/Unit/State.hs | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+Index: b/compiler/GHC/Unit/State.hs
+===================================================================
+--- a/compiler/GHC/Unit/State.hs
++++ b/compiler/GHC/Unit/State.hs
+@@ -111,7 +111,7 @@ import System.FilePath as FilePath
+ import Control.Monad
+ import Data.Graph (stronglyConnComp, SCC(..))
+ import Data.Char ( toUpper )
+-import Data.List ( intersperse, partition, sortBy, isSuffixOf, sortOn )
++import Data.List ( intersperse, partition, sortBy, isSuffixOf, sortOn, sort )
+ import Data.Set (Set)
+ import Data.Monoid (First(..))
+ import qualified Data.Semigroup as Semigroup
+@@ -1676,7 +1676,9 @@ mkUnitState logger cfg = do
+   -- NB: preload IS important even for type-checking, because we
+   -- need the correct include path to be set.
+   --
+-  let preload1 = nonDetKeysUniqMap (filterUniqMap (isJust . uv_explicit) vis_map)
++  -- NB: Sorting keys here to ensure a deterministic order for the linker.
++  --
++  let preload1 = sort $ nonDetKeysUniqMap (filterUniqMap (isJust . uv_explicit) vis_map)
+ 
+       -- add default preload units if they can be found in the db
+       basicLinkedUnits = fmap (RealUnit . Definite)


=====================================
p/ghc/debian/patches/gnu-hurd → p/ghc/debian/patches/gnu-hurd-getExecutablePath
=====================================


=====================================
p/ghc/debian/patches/gnu-hurd-linklm
=====================================
@@ -0,0 +1,39 @@
+commit bf4694e9d10b7d9898ed1e3cd7ae115fd33ac725
+Author: Samuel Thibault <samuel.thibault at ens-lyon.org>
+Date:   Sat Jan 10 15:53:10 2026 +0100
+
+    Fix linking against libm by moving the -lm option
+    
+    For those systems that need -lm for getting math functions, this is
+    currently added on the link line very early, before the object files being
+    linked together. Newer toolchains enable --as-needed by default, which means
+    -lm is ignored at that point because no object requires a math function
+    yet. With such toolchains, we thus have to add -lm after the objects, so the
+    linker actually includes libm in the link.
+
+---
+ compiler/GHC/Linker/Dynamic.hs |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+https://gitlab.haskell.org/ghc/ghc/-/merge_requests/15319
+
+Index: b/compiler/GHC/Linker/Dynamic.hs
+===================================================================
+--- a/compiler/GHC/Linker/Dynamic.hs
++++ b/compiler/GHC/Linker/Dynamic.hs
+@@ -223,7 +223,6 @@ linkDynLib logger tmpfs dflags0 unit_env
+ 
+             runLink logger tmpfs linker_config (
+                     map Option verbFlags
+-                 ++ libmLinkOpts platform
+                  ++ [ Option "-o"
+                     , FileOption "" output_fn
+                     ]
+@@ -234,6 +233,7 @@ linkDynLib logger tmpfs dflags0 unit_env
+                     -- Solaris 10 doesn't support the latter:
+                  ++ [ Option ("-Wl,-h," ++ takeFileName output_fn) ]
+                  ++ extra_ld_inputs
++                 ++ libmLinkOpts platform
+                  ++ map Option lib_path_opts
+                  ++ map Option pkg_lib_path_opts
+                  ++ map Option pkg_link_opts


=====================================
p/ghc/debian/patches/gnu-hurd-os-string
=====================================
@@ -0,0 +1,39 @@
+commit 95773d289c62373772f676df91c1278b7d382e30
+Author: Samuel Thibault <samuel.thibault at ens-lyon.org>
+Date:   Sat Jan 10 15:59:18 2026 +0100
+
+    Fix the OS string encoding for GNU/Hurd
+    
+    Following https://github.com/haskell/cabal/pull/9434/files , and as seen
+    in the various gnu_HOST_OS usages in the source code, it is expected that
+    GNU/Hurd is advertised as "gnu", like the autotools do.
+
+https://gitlab.haskell.org/ghc/ghc/-/merge_requests/15320
+https://github.com/haskell/cabal/pull/11401
+
+Index: b/libraries/Cabal/Cabal/src/Distribution/Simple/PreProcess.hs
+===================================================================
+--- a/libraries/Cabal/Cabal/src/Distribution/Simple/PreProcess.hs
++++ b/libraries/Cabal/Cabal/src/Distribution/Simple/PreProcess.hs
+@@ -780,7 +780,7 @@ platformDefines lbi =
+       Android -> ["android"]
+       Ghcjs -> ["ghcjs"]
+       Wasi -> ["wasi"]
+-      Hurd -> ["hurd"]
++      Hurd -> ["gnu"]
+       Haiku -> ["haiku"]
+       OtherOS _ -> []
+     archStr = case hostArch of
+Index: b/libraries/ghc-platform/src/GHC/Platform/ArchOS.hs
+===================================================================
+--- a/libraries/ghc-platform/src/GHC/Platform/ArchOS.hs
++++ b/libraries/ghc-platform/src/GHC/Platform/ArchOS.hs
+@@ -161,7 +161,7 @@ stringEncodeOS = \case
+   OSHaiku     -> "haiku"
+   OSQNXNTO    -> "nto-qnx"
+   OSAIX       -> "aix"
+-  OSHurd      -> "hurd"
++  OSHurd      -> "gnu"
+   OSWasi      -> "wasi"
+   OSGhcjs     -> "ghcjs"
+ 


=====================================
p/ghc/debian/patches/hppa-sparc64-support.patch
=====================================
@@ -1,7 +1,7 @@
-Index: ghc-9.10.3/compiler/GHC/CmmToC.hs
+Index: b/compiler/GHC/CmmToC.hs
 ===================================================================
---- ghc-9.10.3.orig/compiler/GHC/CmmToC.hs
-+++ ghc-9.10.3/compiler/GHC/CmmToC.hs
+--- a/compiler/GHC/CmmToC.hs
++++ b/compiler/GHC/CmmToC.hs
 @@ -1350,6 +1350,7 @@ cLoad platform expr rep
            bewareLoadStoreAlignment ArchMipsel   = True
            bewareLoadStoreAlignment (ArchARM {}) = True
@@ -10,10 +10,10 @@ Index: ghc-9.10.3/compiler/GHC/CmmToC.hs
            -- Pessimistically assume that they will also cause problems
            -- on unknown arches
            bewareLoadStoreAlignment ArchUnknown  = True
-Index: ghc-9.10.3/libraries/ghc-platform/src/GHC/Platform/ArchOS.hs
+Index: b/libraries/ghc-platform/src/GHC/Platform/ArchOS.hs
 ===================================================================
---- ghc-9.10.3.orig/libraries/ghc-platform/src/GHC/Platform/ArchOS.hs
-+++ ghc-9.10.3/libraries/ghc-platform/src/GHC/Platform/ArchOS.hs
+--- a/libraries/ghc-platform/src/GHC/Platform/ArchOS.hs
++++ b/libraries/ghc-platform/src/GHC/Platform/ArchOS.hs
 @@ -42,9 +42,11 @@ data Arch
     | ArchARM ArmISA [ArmISAExt] ArmABI
     | ArchAArch64
@@ -39,10 +39,10 @@ Index: ghc-9.10.3/libraries/ghc-platform/src/GHC/Platform/ArchOS.hs
    ArchJavaScript    -> "javascript"
    ArchWasm32        -> "wasm32"
  
-Index: ghc-9.10.3/m4/fptools_set_haskell_platform_vars.m4
+Index: b/m4/fptools_set_haskell_platform_vars.m4
 ===================================================================
---- ghc-9.10.3.orig/m4/fptools_set_haskell_platform_vars.m4
-+++ ghc-9.10.3/m4/fptools_set_haskell_platform_vars.m4
+--- a/m4/fptools_set_haskell_platform_vars.m4
++++ b/m4/fptools_set_haskell_platform_vars.m4
 @@ -33,6 +33,9 @@ AC_DEFUN([FPTOOLS_SET_HASKELL_PLATFORM_V
          alpha)
              test -z "[$]2" || eval "[$]2=ArchAlpha"
@@ -65,10 +65,10 @@ Index: ghc-9.10.3/m4/fptools_set_haskell_platform_vars.m4
              test -z "[$]2" || eval "[$]2=ArchUnknown"
              ;;
          javascript)
-Index: ghc-9.10.3/utils/ghc-toolchain/src/GHC/Toolchain/ParseTriple.hs
+Index: b/utils/ghc-toolchain/src/GHC/Toolchain/ParseTriple.hs
 ===================================================================
---- ghc-9.10.3.orig/utils/ghc-toolchain/src/GHC/Toolchain/ParseTriple.hs
-+++ ghc-9.10.3/utils/ghc-toolchain/src/GHC/Toolchain/ParseTriple.hs
+--- a/utils/ghc-toolchain/src/GHC/Toolchain/ParseTriple.hs
++++ b/utils/ghc-toolchain/src/GHC/Toolchain/ParseTriple.hs
 @@ -51,10 +51,11 @@ parseArch cc arch =
        "mipseb" -> pure ArchMipseb
        "mipsel" -> pure ArchMipsel


=====================================
p/ghc/debian/patches/series
=====================================
@@ -19,7 +19,10 @@ alpha-fix-ieee_set_fp_control-invocation.patch
 0005-Pass-the-mcmodel-medium-parameter-to-CC-via-GHC.patch
 hadrian-bootstrap-plan
 hadrian-unreg-template-haskell
-gnu-hurd
+gnu-hurd-getExecutablePath
 hppa-sparc64-support.patch
 ghc-prim-modern-atomics.patch
 armhf-target-platform
+fix-determinism-in-linker
+gnu-hurd-linklm
+gnu-hurd-os-string


=====================================
p/ghc/debian/rules
=====================================
@@ -139,7 +139,7 @@ EXTRA_INSTALL_CONFIGURE_FLAGS += LLC=llc-21 OPT=opt-21 LLVMAS=clang-21
 
 
 %:
-	dh $@
+	dh $@ --with bash-completion
 
 # --------------------------------------------------------------------
 # Configure hadrian
@@ -254,6 +254,12 @@ debian/tmp: $(BINDIST)/config.mk
 	# package.
 	find debian/tmp -name \*.conf.copy -delete
 
+	# Remove any directories under usr/share/doc/ other than 'ghc-doc'.
+	find debian/tmp/usr/share/doc -mindepth 1 -maxdepth 1 -type d ! -name 'ghc-doc' -exec rm -rf {} \;
+
+	# Remove 'archives' directory in ghc-doc.
+	rm -rf debian/tmp/usr/share/doc/ghc-doc/archives
+
 	# Move the package.conf files
 	# GHC installs package configuration files under '/usr/lib/ghc/lib/package.conf.d'
 	# but in Debian we move these files under 'var/lib/ghc/package.conf.d'.
@@ -287,7 +293,7 @@ ifeq (NO,$(BUILD_CROSS))
 endif
 
 	# Delete all the library LICENSE files
-	rm -f debian/tmp/usr/share/doc/ghc-doc/html/libraries/*/LICENSE
+	# rm -f debian/tmp/usr/share/doc/ghc-doc/html/libraries/*/LICENSE
 
 	# Move gen_contents_index binary
 	# We use our own binary because upstream expects to be run from



View it on GitLab: https://salsa.debian.org/haskell-team/DHG_packages/-/compare/2924605da664043bd489d494ee315aca9a309088...af8644097e9e8b8fd9b95c0305bd01738cca6e85

-- 
View it on GitLab: https://salsa.debian.org/haskell-team/DHG_packages/-/compare/2924605da664043bd489d494ee315aca9a309088...af8644097e9e8b8fd9b95c0305bd01738cca6e85
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/20260306/68818c19/attachment-0001.htm>


More information about the Pkg-haskell-commits mailing list