[Git][ghc/ghc][wip/davide/windows-dlls] WIP place SRT info tables into .rdata on windows
David Eichmann pushed to branch wip/davide/windows-dlls at Glasgow Haskell Compiler / GHC Commits: c127e500 by David Eichmann at 2026-06-22T13:54:47+01:00 WIP place SRT info tables into .rdata on windows - - - - - 2 changed files: - compiler/GHC/Cmm/CLabel.hs - compiler/GHC/CmmToAsm/X86/Ppr.hs Changes: ===================================== compiler/GHC/Cmm/CLabel.hs ===================================== @@ -106,6 +106,7 @@ module GHC.Cmm.CLabel ( labelDynamic, isLocalCLabel, mayRedirectTo, + isSRTInfoLabel, isInfoTableLabel, isCmmInfoTableLabel, isConInfoTableLabel, @@ -730,6 +731,27 @@ mkOutOfBoundsAccessLabel = mkForeignLabel (fsLit "rtsOutOfBoundsAccess") mkMemcpyRangeOverlapLabel = mkForeignLabel (fsLit "rtsMemcpyRangeOverlap") ForeignLabelInExternalPackage ForeignLabelIsFunction mkMUT_VAR_CLEAN_infoLabel = CmmLabel rtsUnitId (NeedExternDecl False) (fsLit "stg_MUT_VAR_CLEAN") CmmInfo +isSRTInfoLabel :: CLabel -> Bool +isSRTInfoLabel clbl = case clbl of + CmmLabel _ _ lbl CmmInfo -> + lbl == fsLit "stg_SRT_1" + || lbl == fsLit "stg_SRT_2" + || lbl == fsLit "stg_SRT_3" + || lbl == fsLit "stg_SRT_4" + || lbl == fsLit "stg_SRT_5" + || lbl == fsLit "stg_SRT_6" + || lbl == fsLit "stg_SRT_7" + || lbl == fsLit "stg_SRT_8" + || lbl == fsLit "stg_SRT_9" + || lbl == fsLit "stg_SRT_10" + || lbl == fsLit "stg_SRT_11" + || lbl == fsLit "stg_SRT_12" + || lbl == fsLit "stg_SRT_13" + || lbl == fsLit "stg_SRT_14" + || lbl == fsLit "stg_SRT_15" + || lbl == fsLit "stg_SRT_16" + _ -> False + mkSRTInfoLabel :: Int -> CLabel mkSRTInfoLabel n = CmmLabel rtsUnitId (NeedExternDecl False) lbl CmmInfo where ===================================== compiler/GHC/CmmToAsm/X86/Ppr.hs ===================================== @@ -33,7 +33,7 @@ import GHC.CmmToAsm.Ppr import GHC.Cmm hiding (topInfoTable) import GHC.Cmm.Dataflow.Label import GHC.Cmm.BlockId -import GHC.Cmm.CLabel +import GHC.Cmm.CLabel as CLabel import GHC.Cmm.InitFini import GHC.Cmm.DebugBlock (pprUnwindTable) @@ -96,10 +96,15 @@ pprNatCmmDecl config proc@(CmmProc top_info entry_lbl _ (ListGraph blocks)) = ) | otherwise = (empty,empty) + section = if platformOS platform == OSMinGW32 + && treatAsFunction platform proc_lbl + then ReadOnlyData + else Text + in vcat [ -- section directive. Requires proc_lbl when split-section is enabled to -- use as a subsection name. - pprSectionAlign config (Section Text proc_lbl) + pprSectionAlign config (Section section proc_lbl) -- section alignment. Note that when there is an info table, we align the -- info table and not the entry code! @@ -234,7 +239,7 @@ pprGloblDecl platform lbl pprLabelType' :: IsLine doc => Platform -> CLabel -> doc pprLabelType' platform lbl = - if isCFunctionLabel lbl || functionOkInfoTable then + if treatAsFunction platform lbl then text "@function" else text "@object" @@ -286,10 +291,15 @@ pprLabelType' platform lbl = every code-like thing to give the needed information for to the tools but mess up with the relocation. https://phabricator.haskell.org/D4730 -} + +treatAsFunction :: Platform -> CLabel -> Bool +treatAsFunction platform lbl = isCFunctionLabel lbl || functionOkInfoTable + where functionOkInfoTable = platformTablesNextToCode platform && isInfoTableLabel lbl && not (isCmmInfoTableLabel lbl) && not (isConInfoTableLabel lbl) + pprTypeDecl :: IsDoc doc => Platform -> CLabel -> doc pprTypeDecl platform lbl = if osElfTarget (platformOS platform) && externallyVisibleCLabel lbl View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/c127e5006dfb226c6332665a18358d91... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/c127e5006dfb226c6332665a18358d91... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
David Eichmann (@DavidEichmann)