[Git][ghc/ghc][master] Fix determinism of linker arguments
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: a8aa1868 by Ilias Tsitsimpis at 2026-03-06T06:26:29-05:00 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 - - - - - 1 changed file: - compiler/GHC/Unit/State.hs Changes: ===================================== compiler/GHC/Unit/State.hs ===================================== @@ -112,7 +112,7 @@ import System.FilePath as FilePath import Control.Monad import Data.Graph (stronglyConnComp, SCC(..)) import Data.Char ( toUpper ) -import Data.List ( intersperse, partition, sortBy, sortOn ) +import Data.List ( intersperse, partition, sortBy, sortOn, sort ) import Data.Set (Set) import Data.Monoid (First(..)) import qualified Data.Semigroup as Semigroup @@ -1695,7 +1695,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) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/a8aa18688d2aba09dede9f1f1b82a832... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/a8aa18688d2aba09dede9f1f1b82a832... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Marge Bot (@marge-bot)