[Git][ghc/ghc][wip/romes/26227] Drop "unlit command" from settings

Rodrigo Mesquita pushed to branch wip/romes/26227 at Glasgow Haskell Compiler / GHC Commits: 3150b664 by Rodrigo Mesquita at 2025-08-01T16:07:33+01:00 Drop "unlit command" from settings The `unlit` program is a binary distributed with ghc. Its location is hardcoded to a path relative to its `$topdir`. It's unnecessary and confusing to write this into a global or per-target settings file since we don't allow it to be configured (except at runtime with -pgmL). Towards #26227 - - - - - 4 changed files: - compiler/GHC/Driver/Session.hs - compiler/GHC/Settings/IO.hs - hadrian/bindist/Makefile - hadrian/src/Rules/Generate.hs Changes: ===================================== compiler/GHC/Driver/Session.hs ===================================== @@ -3502,6 +3502,7 @@ compilerInfo dflags ("target has .ident directive", queryBool tgtSupportsIdentDirective), ("target has subsections via symbols", queryBool tgtSupportsSubsectionsViaSymbols), ("target RTS linker only supports shared libraries", queryBool tgtRTSLinkerOnlySupportsSharedLibs), + ("unlit command", toolSettings_pgm_L (toolSettings dflags)), ("Unregisterised", queryBool tgtUnregisterised), ("LLVM target", query tgtLlvmTarget), ("LLVM llc command", queryCmdMaybe id tgtLlc), ===================================== compiler/GHC/Settings/IO.hs ===================================== @@ -131,12 +131,8 @@ initSettings top_dir = do let ghc_usage_msg_path = installed "ghc-usage.txt" ghci_usage_msg_path = installed "ghci-usage.txt" - -- For all systems, unlit, split, mangle are GHC utilities - -- architecture-specific stuff is done when building Config.hs - unlit_path <- getToolSetting "unlit command" - - -- Other things being equal, 'as' is simply 'gcc' - let (cc_link, cc_link_args) = getTool (ccLinkProgram . tgtCCompilerLink) + -- Other things being equal, 'as' is simply 'gcc' + (cc_link, cc_link_args) = getTool (ccLinkProgram . tgtCCompilerLink) as_prog = cc_prog as_args = map Option cc_args ld_prog = cc_link @@ -146,6 +142,9 @@ initSettings top_dir = do let (ld_r_path, ld_r_args) = getTool (mergeObjsProgram . const ld_r_prog) pure (ld_r_path, map Option ld_r_args) iserv_prog = libexec "ghc-iserv" + unlit_prog = libexec (if (tgtLocallyExecutable target) + then "unlit" -- not a cross compiler + else targetPlatformTriple target ++ "-unlit") baseUnitId <- getSetting_raw "base unit-id" @@ -180,7 +179,7 @@ initSettings top_dir = do , toolSettings_arSupportsDashL = arSupportsDashL $ tgtAr target , toolSettings_cmmCppSupportsG0 = cmmCppSupportsG0 $ tgtCmmCPreprocessor target - , toolSettings_pgm_L = unlit_path + , toolSettings_pgm_L = unlit_prog , toolSettings_pgm_P = (hs_cpp_prog, map Option hs_cpp_args) , toolSettings_pgm_JSP = (js_cpp_prog, map Option js_cpp_args) , toolSettings_pgm_CmmP = (cmmCpp_prog, map Option cmmCpp_args) ===================================== hadrian/bindist/Makefile ===================================== @@ -85,8 +85,7 @@ WrapperBinsDir=${bindir} # N.B. this is duplicated from includes/ghc.mk. lib/settings : config.mk @rm -f $@ - @echo '[("unlit command", "$$topdir/../bin/$(CrossCompilePrefix)unlit")' >> $@ - @echo ',("RTS ways", "$(GhcRTSWays)")' >> $@ + @echo '[("RTS ways", "$(GhcRTSWays)")' >> $@ @echo ',("Relative Global Package DB", "package.conf.d")' >> $@ @echo ',("base unit-id", "$(BaseUnitId)")' >> $@ @echo "]" >> $@ ===================================== hadrian/src/Rules/Generate.hs ===================================== @@ -8,7 +8,6 @@ import Development.Shake.FilePath import Data.Char (isSpace) import qualified Data.Set as Set import Base -import qualified Context import Expression import Hadrian.Oracles.TextFile (lookupSystemConfig, getTargetTarget) import Oracles.Flag hiding (arSupportsAtFile, arSupportsDashL) @@ -460,7 +459,6 @@ ghcWrapper stage = do generateSettings :: FilePath -> Expr String generateSettings settingsFile = do - ctx <- getContext stage <- getStage package_db_path <- expr $ do @@ -482,8 +480,7 @@ generateSettings settingsFile = do let rel_pkg_db = makeRelativeNoSysLink (dropFileName settingsFile) package_db_path settings <- traverse sequence $ - [ ("unlit command", ("$topdir/../bin/" <>) <$> expr (programName (ctx { Context.package = unlit }))) - , ("RTS ways", escapeArgs . map show . Set.toList <$> getRtsWays) + [ ("RTS ways", escapeArgs . map show . Set.toList <$> getRtsWays) , ("Relative Global Package DB", pure rel_pkg_db) , ("base unit-id", pure base_unit_id) ] View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/3150b6645fac3a4223e4a3fa2cb4a32b... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/3150b6645fac3a4223e4a3fa2cb4a32b... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Rodrigo Mesquita (@alt-romes)