[Git][ghc/ghc][master] hadrian: build profiled dynamic objects with -dynamic-too
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: 4c58a3ae by Cheng Shao at 2026-03-11T15:09:22-04:00 hadrian: build profiled dynamic objects with -dynamic-too This patch enables hadrian to build profiled dynamic objects with `-dynamic-too`, addressing a build parallelism bottleneck in release pipelines. Closes #27010. - - - - - 2 changed files: - hadrian/src/Rules/Compile.hs - hadrian/src/Settings/Builders/Ghc.hs Changes: ===================================== hadrian/src/Rules/Compile.hs ===================================== @@ -59,14 +59,17 @@ compilePackage rs = do -- When building dynamically we depend on the static rule if shared libs -- are supported, because it will add the -dynamic-too flag when -- compiling to build the dynamic files alongside the static files - ( root -/- "**/build/**/*.dyn_o" :& root -/- "**/build/**/*.dyn_hi" :& Nil ) + forM_ wayPats $ \wayPat -> ( root -/- ("**/build/**/*." ++ wayPat ++ "dyn_o") :& root -/- ("**/build/**/*." ++ wayPat ++ "dyn_hi") :& Nil ) &%> \ ( dyn_o :& _dyn_hi :& _ ) -> do p <- platformSupportsSharedLibs if p then do + b <- parsePath (parseBuildObject root) "<object file path parser>" dyn_o + let ctx = objectContext b + way = removeWayUnit Dynamic $ C.way ctx -- We `need` ".o/.hi" because GHC is called with `-dynamic-too` -- and builds ".dyn_o/.dyn_hi" too. - changed <- needHasChanged [dyn_o -<.> "o", dyn_o -<.> "hi"] + changed <- needHasChanged [dyn_o -<.> osuf way, dyn_o -<.> hisuf way] -- If for some reason a previous Hadrian execution has been -- interrupted after the rule for .o/.hi generation has completed ===================================== hadrian/src/Settings/Builders/Ghc.hs ===================================== @@ -34,6 +34,8 @@ compileAndLinkHs = (builder (Ghc CompileHs) ||^ builder (Ghc LinkHs)) ? do useColor <- shakeColor <$> expr getShakeOptions let hasVanilla = elem vanilla ways hasDynamic = elem dynamic ways + hasProfiling = elem profiling ways + hasProfilingDynamic = elem profilingDynamic ways hieFiles <- ghcHieFiles <$> expr flavour stage <- getStage hie_path <- getHieBuildPath @@ -46,6 +48,12 @@ compileAndLinkHs = (builder (Ghc CompileHs) ||^ builder (Ghc LinkHs)) ? do , (hasVanilla && hasDynamic) ? builder (Ghc CompileHs) ? platformSupportsSharedLibs ? way vanilla ? arg "-dynamic-too" + , (hasProfiling && hasProfilingDynamic) ? builder (Ghc CompileHs) ? + platformSupportsSharedLibs ? way profiling ? mconcat + [ arg "-dynamic-too" + , arg "-dynosuf", arg $ osuf profilingDynamic + , arg "-dynhisuf", arg $ hisuf profilingDynamic + ] , commonGhcArgs , ghcLinkArgs , defaultGhcWarningsArgs View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/4c58a3aecf8071bfcda6d0787652b89d... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/4c58a3aecf8071bfcda6d0787652b89d... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Marge Bot (@marge-bot)