Cheng Shao pushed to branch wip/14554-wasm-fix at Glasgow Haskell Compiler / GHC WARNING: The push did not contain any new commits, but force pushed to delete the commits and changes below. Deleted commits: da99e918 by Rodrigo Mesquita at 2025-08-23T19:21:31+02:00 ghc-toolchain: Make "Support SMP" a query on a Toolchain.Target "Support SMP" is merely a function of target, so we can represent it as such in `ghc-toolchain`. Hadrian queries the Target using this predicate to determine how to build GHC, and GHC queries the Target similarly to report under --info whether it "Support SMP" Towards #26227 - - - - - 5 changed files: - compiler/GHC/Driver/Session.hs - hadrian/bindist/Makefile - hadrian/src/Oracles/Flag.hs - hadrian/src/Rules/Generate.hs - utils/ghc-toolchain/src/GHC/Toolchain/Target.hs Changes: ===================================== compiler/GHC/Driver/Session.hs ===================================== @@ -3547,6 +3547,7 @@ compilerInfo dflags -- If true, we require that the 'id' field in installed package info -- match what is passed to the @-this-unit-id@ flag for modules -- built in it + ("Support SMP", queryBool tgtSupportsSMP), ("Requires unified installed package IDs", "YES"), -- Whether or not we support the @-this-package-key@ flag. Prefer -- "Uses unit IDs" over it. We still say yes even if @-this-package-key@ ===================================== hadrian/bindist/Makefile ===================================== @@ -88,7 +88,6 @@ lib/settings : config.mk @echo '[("unlit command", "$$topdir/../bin/$(CrossCompilePrefix)unlit")' >> $@ @echo ',("target RTS linker only supports shared libraries", "$(TargetRTSLinkerOnlySupportsSharedLibs)")' >> $@ @echo ',("Use interpreter", "$(GhcWithInterpreter)")' >> $@ - @echo ',("Support SMP", "$(GhcWithSMP)")' >> $@ @echo ',("RTS ways", "$(GhcRTSWays)")' >> $@ @echo ',("Relative Global Package DB", "package.conf.d")' >> $@ @echo ',("base unit-id", "$(BaseUnitId)")' >> $@ ===================================== hadrian/src/Oracles/Flag.hs ===================================== @@ -121,27 +121,7 @@ targetSupportsThreadedRts = do -- | Does the target support the -N RTS flag? targetSupportsSMP :: Action Bool -targetSupportsSMP = do - unreg <- queryTargetTarget tgtUnregisterised - armVer <- targetArmVersion - goodArch <- (||) <$> - anyTargetArch [ ArchX86 - , ArchX86_64 - , ArchPPC - , ArchPPC_64 ELF_V1 - , ArchPPC_64 ELF_V2 - , ArchAArch64 - , ArchS390X - , ArchRISCV64 - , ArchLoongArch64 ] <*> isArmTarget - if -- The THREADED_RTS requires `BaseReg` to be in a register and the - -- Unregisterised mode doesn't allow that. - | unreg -> return False - -- We don't support load/store barriers pre-ARMv7. See #10433. - | Just ver <- armVer - , ver < ARMv7 -> return False - | goodArch -> return True - | otherwise -> return False +targetSupportsSMP = queryTargetTarget Toolchain.tgtSupportsSMP useLibffiForAdjustors :: Action Bool useLibffiForAdjustors = queryTargetTarget tgtUseLibffiForAdjustors ===================================== hadrian/src/Rules/Generate.hs ===================================== @@ -486,7 +486,6 @@ generateSettings settingsFile = do [ ("unlit command", ("$topdir/../bin/" <>) <$> expr (programName (ctx { Context.package = unlit }))) , ("target RTS linker only supports shared libraries", expr $ yesNo <$> targetRTSLinkerOnlySupportsSharedLibs) , ("Use interpreter", expr $ yesNo <$> ghcWithInterpreter (predStage stage)) - , ("Support SMP", expr $ yesNo <$> targetSupportsSMP) , ("RTS ways", escapeArgs . map show . Set.toList <$> getRtsWays) , ("Relative Global Package DB", pure rel_pkg_db) , ("base unit-id", pure base_unit_id) ===================================== utils/ghc-toolchain/src/GHC/Toolchain/Target.hs ===================================== @@ -1,5 +1,6 @@ {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE NamedFieldPuns #-} +{-# LANGUAGE MultiWayIf #-} module GHC.Toolchain.Target ( -- * A Toolchain Target @@ -7,6 +8,9 @@ module GHC.Toolchain.Target , WordSize(..), wordSize2Bytes + -- ** Queries + , tgtSupportsSMP + -- ** Lenses , _tgtCC, _tgtCxx, _tgtCpp, _tgtHsCpp @@ -151,6 +155,34 @@ instance Show Target where , "}" ] +-------------------------------------------------------------------------------- +-- Queries +-------------------------------------------------------------------------------- + +tgtSupportsSMP :: Target -> Bool +tgtSupportsSMP Target{..} = do + let goodArch = + isARM (archOS_arch tgtArchOs) + || archOS_arch tgtArchOs `elem` + [ ArchX86 + , ArchX86_64 + , ArchPPC + , ArchPPC_64 ELF_V1 + , ArchPPC_64 ELF_V2 + , ArchAArch64 + , ArchS390X + , ArchRISCV64 + , ArchLoongArch64 ] + + if -- The THREADED_RTS requires `BaseReg` to be in a register and the + -- Unregisterised mode doesn't allow that. + | tgtUnregisterised -> False + -- We don't support load/store barriers pre-ARMv7. See #10433. + | ArchARM ver _ _ <- archOS_arch tgtArchOs + , ver < ARMv7 -> False + | goodArch -> True + | otherwise -> False + -------------------------------------------------------------------------------- -- Lenses -------------------------------------------------------------------------------- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/da99e918eda2c6e7b08520c3ec65df4a... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/da99e918eda2c6e7b08520c3ec65df4a... You're receiving this email because of your account on gitlab.haskell.org.