[Git][ghc/ghc][wip/14554-wasm-fix] Deleted 1 commit: ghc-toolchain: Make "tgt rts linker only supports shared libs" function on Target

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: f6d63a45 by Rodrigo Mesquita at 2025-08-23T19:21:31+02:00 ghc-toolchain: Make "tgt rts linker only supports shared libs" function on Target Just like with "Support SMP", "target RTS linker only supports shared libraries" is a predicate on a `Target` so we can just compute it when necessary from the given `Target`. Towards #26227 - - - - - 6 changed files: - compiler/GHC/Driver/Session.hs - compiler/GHC/Settings/IO.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 ===================================== @@ -3502,6 +3502,7 @@ compilerInfo dflags ("target has libm", queryBool tgtHasLibm), ("target has .ident directive", queryBool tgtSupportsIdentDirective), ("target has subsections via symbols", queryBool tgtSupportsSubsectionsViaSymbols), + ("target RTS linker only supports shared libraries", queryBool tgtRTSLinkerOnlySupportsSharedLibs), ("Unregisterised", queryBool tgtUnregisterised), ("LLVM target", query tgtLlvmTarget), ("LLVM llc command", queryCmdMaybe id tgtLlc), ===================================== compiler/GHC/Settings/IO.hs ===================================== @@ -146,7 +146,6 @@ initSettings top_dir = do pure (ld_r_path, map Option ld_r_args) iserv_prog = libexec "ghc-iserv" - targetRTSLinkerOnlySupportsSharedLibs <- getBooleanSetting "target RTS linker only supports shared libraries" ghcWithInterpreter <- getBooleanSetting "Use interpreter" baseUnitId <- getSetting_raw "base unit-id" @@ -231,7 +230,7 @@ initSettings top_dir = do , platformMisc_ghcWithInterpreter = ghcWithInterpreter , platformMisc_libFFI = tgtUseLibffiForAdjustors target , platformMisc_llvmTarget = tgtLlvmTarget target - , platformMisc_targetRTSLinkerOnlySupportsSharedLibs = targetRTSLinkerOnlySupportsSharedLibs + , platformMisc_targetRTSLinkerOnlySupportsSharedLibs = tgtRTSLinkerOnlySupportsSharedLibs target } , sRawSettings = settingsList ===================================== hadrian/bindist/Makefile ===================================== @@ -86,7 +86,6 @@ WrapperBinsDir=${bindir} lib/settings : config.mk @rm -f $@ @echo '[("unlit command", "$$topdir/../bin/$(CrossCompilePrefix)unlit")' >> $@ - @echo ',("target RTS linker only supports shared libraries", "$(TargetRTSLinkerOnlySupportsSharedLibs)")' >> $@ @echo ',("Use interpreter", "$(GhcWithInterpreter)")' >> $@ @echo ',("RTS ways", "$(GhcRTSWays)")' >> $@ @echo ',("Relative Global Package DB", "package.conf.d")' >> $@ ===================================== hadrian/src/Oracles/Flag.hs ===================================== @@ -80,23 +80,8 @@ platformSupportsGhciObjects = do only_shared_libs <- targetRTSLinkerOnlySupportsSharedLibs pure $ has_merge_objs && not only_shared_libs --- | Does the target RTS linker only support loading shared libraries? --- If true, this has several implications: --- 1. The GHC driver must not do loadArchive/loadObj etc and must --- always do loadDLL, regardless of whether host GHC is dynamic or --- not. --- 2. The GHC driver will always enable -dynamic-too when compiling --- vanilla way with TH codegen requirement. --- 3. ghci will always enforce dynamic ways even if -dynamic or --- -dynamic-too is not explicitly passed. --- 4. Cabal must not build ghci objects since it's not supported by --- the target. --- 5. The testsuite driver will use dyn way for TH/ghci tests even --- when host GHC is static. --- 6. TH/ghci doesn't work if stage1 is built without shared libraries --- (e.g. quickest/fully_static). targetRTSLinkerOnlySupportsSharedLibs :: Action Bool -targetRTSLinkerOnlySupportsSharedLibs = anyTargetArch [ ArchWasm32 ] +targetRTSLinkerOnlySupportsSharedLibs = queryTargetTarget Toolchain.tgtRTSLinkerOnlySupportsSharedLibs arSupportsDashL :: Stage -> Action Bool arSupportsDashL stage = Toolchain.arSupportsDashL . tgtAr <$> targetStage stage ===================================== hadrian/src/Rules/Generate.hs ===================================== @@ -484,7 +484,6 @@ generateSettings settingsFile = do settings <- traverse sequence $ [ ("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)) , ("RTS ways", escapeArgs . map show . Set.toList <$> getRtsWays) , ("Relative Global Package DB", pure rel_pkg_db) ===================================== utils/ghc-toolchain/src/GHC/Toolchain/Target.hs ===================================== @@ -9,7 +9,7 @@ module GHC.Toolchain.Target , WordSize(..), wordSize2Bytes -- ** Queries - , tgtSupportsSMP + , tgtSupportsSMP, tgtRTSLinkerOnlySupportsSharedLibs -- ** Lenses , _tgtCC, _tgtCxx, _tgtCpp, _tgtHsCpp @@ -183,6 +183,26 @@ tgtSupportsSMP Target{..} = do | goodArch -> True | otherwise -> False +-- | Does the target RTS linker only support loading shared libraries? +-- If true, this has several implications: +-- 1. The GHC driver must not do loadArchive/loadObj etc and must +-- always do loadDLL, regardless of whether host GHC is dynamic or +-- not. +-- 2. The GHC driver will always enable -dynamic-too when compiling +-- vanilla way with TH codegen requirement. +-- 3. ghci will always enforce dynamic ways even if -dynamic or +-- -dynamic-too is not explicitly passed. +-- 4. Cabal must not build ghci objects since it's not supported by +-- the target. +-- 5. The testsuite driver will use dyn way for TH/ghci tests even +-- when host GHC is static. +-- 6. TH/ghci doesn't work if stage1 is built without shared libraries +-- (e.g. quickest/fully_static). +tgtRTSLinkerOnlySupportsSharedLibs :: Target -> Bool +tgtRTSLinkerOnlySupportsSharedLibs Target{tgtArchOs} = + archOS_arch tgtArchOs `elem` + [ ArchWasm32 ] + -------------------------------------------------------------------------------- -- Lenses -------------------------------------------------------------------------------- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f6d63a45a27479cf08774e99faba23b2... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f6d63a45a27479cf08774e99faba23b2... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Cheng Shao (@TerrorJack)