Rodrigo Mesquita pushed to branch wip/romes/26227 at Glasgow Haskell Compiler / GHC
Commits:
-
ac859b36
by Rodrigo Mesquita at 2025-08-01T16:42:04+01:00
4 changed files:
- compiler/GHC/Driver/Session.hs
- compiler/GHC/Settings/IO.hs
- hadrian/bindist/Makefile
- hadrian/src/Rules/Generate.hs
Changes:
| ... | ... | @@ -3502,6 +3502,7 @@ compilerInfo dflags |
| 3502 | 3502 | ("target has .ident directive", queryBool tgtSupportsIdentDirective),
|
| 3503 | 3503 | ("target has subsections via symbols", queryBool tgtSupportsSubsectionsViaSymbols),
|
| 3504 | 3504 | ("target RTS linker only supports shared libraries", queryBool tgtRTSLinkerOnlySupportsSharedLibs),
|
| 3505 | + ("unlit command", toolSettings_pgm_L (toolSettings dflags)),
|
|
| 3505 | 3506 | ("Unregisterised", queryBool tgtUnregisterised),
|
| 3506 | 3507 | ("LLVM target", query tgtLlvmTarget),
|
| 3507 | 3508 | ("LLVM llc command", queryCmdMaybe id tgtLlc),
|
| ... | ... | @@ -65,9 +65,6 @@ initSettings top_dir = do |
| 65 | 65 | Nothing -> throwE $ SettingsError_BadData $
|
| 66 | 66 | "Can't parse as Target " ++ show targetFile
|
| 67 | 67 | let mySettings = Map.fromList settingsList
|
| 68 | - getBooleanSetting :: String -> ExceptT SettingsError m Bool
|
|
| 69 | - getBooleanSetting key = either pgmError pure $
|
|
| 70 | - getRawBooleanSetting settingsFile mySettings key
|
|
| 71 | 68 | |
| 72 | 69 | -- see Note [topdir: How GHC finds its files]
|
| 73 | 70 | -- NB: top_dir is assumed to be in standard Unix
|
| ... | ... | @@ -79,10 +76,7 @@ initSettings top_dir = do |
| 79 | 76 | getRawSetting settingsFile mySettings key
|
| 80 | 77 | getSetting_topDir top key = either pgmError pure $
|
| 81 | 78 | getRawFilePathSetting top settingsFile mySettings key
|
| 82 | - getSetting_toolDir top tool key =
|
|
| 83 | - expandToolDir tool <$> getSetting_topDir top key
|
|
| 84 | 79 | getSetting key = getSetting_topDir top_dir key
|
| 85 | - getToolSetting key = getSetting_toolDir top_dir mtool_dir key
|
|
| 86 | 80 | |
| 87 | 81 | expandDirVars top tool = expandToolDir tool . expandTopDir top
|
| 88 | 82 | |
| ... | ... | @@ -131,12 +125,8 @@ initSettings top_dir = do |
| 131 | 125 | let ghc_usage_msg_path = installed "ghc-usage.txt"
|
| 132 | 126 | ghci_usage_msg_path = installed "ghci-usage.txt"
|
| 133 | 127 | |
| 134 | - -- For all systems, unlit, split, mangle are GHC utilities
|
|
| 135 | - -- architecture-specific stuff is done when building Config.hs
|
|
| 136 | - unlit_path <- getToolSetting "unlit command"
|
|
| 137 | - |
|
| 138 | - -- Other things being equal, 'as' is simply 'gcc'
|
|
| 139 | - let (cc_link, cc_link_args) = getTool (ccLinkProgram . tgtCCompilerLink)
|
|
| 128 | + -- Other things being equal, 'as' is simply 'gcc'
|
|
| 129 | + (cc_link, cc_link_args) = getTool (ccLinkProgram . tgtCCompilerLink)
|
|
| 140 | 130 | as_prog = cc_prog
|
| 141 | 131 | as_args = map Option cc_args
|
| 142 | 132 | ld_prog = cc_link
|
| ... | ... | @@ -146,6 +136,9 @@ initSettings top_dir = do |
| 146 | 136 | let (ld_r_path, ld_r_args) = getTool (mergeObjsProgram . const ld_r_prog)
|
| 147 | 137 | pure (ld_r_path, map Option ld_r_args)
|
| 148 | 138 | iserv_prog = libexec "ghc-iserv"
|
| 139 | + unlit_prog = libexec (if (tgtLocallyExecutable target)
|
|
| 140 | + then "unlit" -- not a cross compiler
|
|
| 141 | + else targetPlatformTriple target ++ "-unlit")
|
|
| 149 | 142 | |
| 150 | 143 | baseUnitId <- getSetting_raw "base unit-id"
|
| 151 | 144 | |
| ... | ... | @@ -180,7 +173,7 @@ initSettings top_dir = do |
| 180 | 173 | , toolSettings_arSupportsDashL = arSupportsDashL $ tgtAr target
|
| 181 | 174 | , toolSettings_cmmCppSupportsG0 = cmmCppSupportsG0 $ tgtCmmCPreprocessor target
|
| 182 | 175 | |
| 183 | - , toolSettings_pgm_L = unlit_path
|
|
| 176 | + , toolSettings_pgm_L = unlit_prog
|
|
| 184 | 177 | , toolSettings_pgm_P = (hs_cpp_prog, map Option hs_cpp_args)
|
| 185 | 178 | , toolSettings_pgm_JSP = (js_cpp_prog, map Option js_cpp_args)
|
| 186 | 179 | , toolSettings_pgm_CmmP = (cmmCpp_prog, map Option cmmCpp_args)
|
| ... | ... | @@ -85,8 +85,7 @@ WrapperBinsDir=${bindir} |
| 85 | 85 | # N.B. this is duplicated from includes/ghc.mk.
|
| 86 | 86 | lib/settings : config.mk
|
| 87 | 87 | @rm -f $@
|
| 88 | - @echo '[("unlit command", "$$topdir/../bin/$(CrossCompilePrefix)unlit")' >> $@
|
|
| 89 | - @echo ',("RTS ways", "$(GhcRTSWays)")' >> $@
|
|
| 88 | + @echo '[("RTS ways", "$(GhcRTSWays)")' >> $@
|
|
| 90 | 89 | @echo ',("Relative Global Package DB", "package.conf.d")' >> $@
|
| 91 | 90 | @echo ',("base unit-id", "$(BaseUnitId)")' >> $@
|
| 92 | 91 | @echo "]" >> $@
|
| ... | ... | @@ -8,7 +8,6 @@ import Development.Shake.FilePath |
| 8 | 8 | import Data.Char (isSpace)
|
| 9 | 9 | import qualified Data.Set as Set
|
| 10 | 10 | import Base
|
| 11 | -import qualified Context
|
|
| 12 | 11 | import Expression
|
| 13 | 12 | import Hadrian.Oracles.TextFile (lookupSystemConfig, getTargetTarget)
|
| 14 | 13 | import Oracles.Flag hiding (arSupportsAtFile, arSupportsDashL)
|
| ... | ... | @@ -460,7 +459,6 @@ ghcWrapper stage = do |
| 460 | 459 | |
| 461 | 460 | generateSettings :: FilePath -> Expr String
|
| 462 | 461 | generateSettings settingsFile = do
|
| 463 | - ctx <- getContext
|
|
| 464 | 462 | stage <- getStage
|
| 465 | 463 | |
| 466 | 464 | package_db_path <- expr $ do
|
| ... | ... | @@ -482,8 +480,7 @@ generateSettings settingsFile = do |
| 482 | 480 | let rel_pkg_db = makeRelativeNoSysLink (dropFileName settingsFile) package_db_path
|
| 483 | 481 | |
| 484 | 482 | settings <- traverse sequence $
|
| 485 | - [ ("unlit command", ("$topdir/../bin/" <>) <$> expr (programName (ctx { Context.package = unlit })))
|
|
| 486 | - , ("RTS ways", escapeArgs . map show . Set.toList <$> getRtsWays)
|
|
| 483 | + [ ("RTS ways", escapeArgs . map show . Set.toList <$> getRtsWays)
|
|
| 487 | 484 | , ("Relative Global Package DB", pure rel_pkg_db)
|
| 488 | 485 | , ("base unit-id", pure base_unit_id)
|
| 489 | 486 | ]
|