X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2Fcmm%2FCLabel.hs;h=6216d38e0eb976b00e886f7182bb839dca09de3d;hb=91b07216be1cb09230b7d1b417899ddea8620ff3;hp=c0c6e34ac4617b4312598e5af6752b627fea9802;hpb=b2746a8e187a98e251461115e8eaea69196753fc;p=ghc-hetmet.git diff --git a/ghc/compiler/cmm/CLabel.hs b/ghc/compiler/cmm/CLabel.hs index c0c6e34..6216d38 100644 --- a/ghc/compiler/cmm/CLabel.hs +++ b/ghc/compiler/cmm/CLabel.hs @@ -22,6 +22,16 @@ module CLabel ( mkStaticInfoTableLabel, mkApEntryLabel, mkApInfoTableLabel, + mkClosureTableLabel, + + mkLocalClosureLabel, + mkLocalInfoTableLabel, + mkLocalEntryLabel, + mkLocalConEntryLabel, + mkLocalStaticConEntryLabel, + mkLocalConInfoTableLabel, + mkLocalStaticInfoTableLabel, + mkLocalClosureTableLabel, mkReturnPtLabel, mkReturnInfoLabel, @@ -30,19 +40,19 @@ module CLabel ( mkBitmapLabel, mkStringLitLabel, - mkClosureTblLabel, - mkAsmTempLabel, mkModuleInitLabel, mkPlainModuleInitLabel, mkSplitMarkerLabel, + mkDirty_MUT_VAR_Label, mkUpdInfoLabel, mkSeqInfoLabel, mkIndStaticInfoLabel, mkMainCapabilityLabel, mkMAP_FROZEN_infoLabel, + mkMAP_DIRTY_infoLabel, mkEMPTY_MVAR_infoLabel, mkTopTickyCtrLabel, @@ -74,22 +84,29 @@ module CLabel ( mkCCLabel, mkCCSLabel, + DynamicLinkerLabelInfo(..), + mkDynamicLinkerLabel, + dynamicLinkerLabelInfo, + + mkPicBaseLabel, + mkDeadStripPreventer, + infoLblToEntryLbl, entryLblToInfoLbl, needsCDecl, isAsmTemp, externallyVisibleCLabel, - CLabelType(..), labelType, labelDynamic, labelCouldBeDynamic, + CLabelType(..), labelType, labelDynamic, pprCLabel ) where #include "HsVersions.h" -#include "../includes/ghcconfig.h" -import CmdLineOpts ( opt_Static, opt_DoTickyProfiling ) +import Packages ( HomeModules ) +import StaticFlags ( opt_Static, opt_DoTickyProfiling ) +import Packages ( isHomeModule, isDllName ) import DataCon ( ConTag ) -import Module ( moduleName, moduleNameFS, - Module, isHomeModule ) -import Name ( Name, isDllName, isExternalName ) +import Module ( moduleFS, Module ) +import Name ( Name, isExternalName ) import Unique ( pprUnique, Unique ) import PrimOp ( PrimOp ) import Config ( cLeadingUnderscore ) @@ -97,7 +114,6 @@ import CostCentre ( CostCentre, CostCentreStack ) import Outputable import FastString - -- ----------------------------------------------------------------------------- -- The CLabel type @@ -128,6 +144,10 @@ data CLabel Name -- definition of a particular Id or Con IdLabelInfo + | DynIdLabel -- like IdLabel, but in a separate package, + Name -- and might therefore need a dynamic + IdLabelInfo -- reference. + | CaseLabel -- A family of labels related to a particular -- case expression. {-# UNPACK #-} !Unique -- Unique says which case expression @@ -142,13 +162,16 @@ data CLabel | ModuleInitLabel Module -- the module name String -- its "way" + Bool -- True <=> is in a different package -- at some point we might want some kind of version number in -- the module init label, to guard against compiling modules in -- the wrong order. We can't use the interface file version however, -- because we don't always recompile modules which depend on a module -- whose version has changed. - | PlainModuleInitLabel Module -- without the vesrion & way info + | PlainModuleInitLabel -- without the vesrion & way info + Module + Bool -- True <=> is in a different package | ModuleRegdLabel @@ -163,14 +186,30 @@ data CLabel | CC_Label CostCentre | CCS_Label CostCentreStack - deriving (Eq, Ord) + -- Dynamic Linking in the NCG: + -- generated and used inside the NCG only, + -- see module PositionIndependentCode for details. + + | DynamicLinkerLabel DynamicLinkerLabelInfo CLabel + -- special variants of a label used for dynamic linking + + | PicBaseLabel -- a label used as a base for PIC calculations + -- on some platforms. + -- It takes the form of a local numeric + -- assembler label '1'; it is pretty-printed + -- as 1b, referring to the previous definition + -- of 1: in the assembler source file. + | DeadStripPreventer CLabel + -- label before an info table to prevent excessive dead-stripping on darwin + + deriving (Eq, Ord) data IdLabelInfo = Closure -- Label for closure | SRT -- Static reference table | SRTDesc -- Static reference table descriptor - | InfoTbl -- Info tables for closures; always read-only + | InfoTable -- Info tables for closures; always read-only | Entry -- entry point | Slow -- slow entry point @@ -180,9 +219,9 @@ data IdLabelInfo | Bitmap -- A bitmap (function or case return) | ConEntry -- constructor entry point - | ConInfoTbl -- corresponding info table + | ConInfoTable -- corresponding info table | StaticConEntry -- static constructor entry point - | StaticInfoTbl -- corresponding info table + | StaticInfoTable -- corresponding info table | ClosureTable -- table of closures for Enum tycons @@ -198,10 +237,10 @@ data CaseLabelInfo data RtsLabelInfo - = RtsSelectorInfoTbl Bool{-updatable-} Int{-offset-} -- Selector thunks + = RtsSelectorInfoTable Bool{-updatable-} Int{-offset-} -- Selector thunks | RtsSelectorEntry Bool{-updatable-} Int{-offset-} - | RtsApInfoTbl Bool{-updatable-} Int{-arity-} -- AP thunks + | RtsApInfoTable Bool{-updatable-} Int{-arity-} -- AP thunks | RtsApEntry Bool{-updatable-} Int{-arity-} | RtsPrimOp PrimOp @@ -226,24 +265,65 @@ data RtsLabelInfo -- NOTE: Eq on LitString compares the pointer only, so this isn't -- a real equality. +data DynamicLinkerLabelInfo + = CodeStub -- MachO: Lfoo$stub, ELF: foo@plt + | SymbolPtr -- MachO: Lfoo$non_lazy_ptr, Windows: __imp_foo + | GotSymbolPtr -- ELF: foo@got + | GotSymbolOffset -- ELF: foo@gotoff + + deriving (Eq, Ord) + -- ----------------------------------------------------------------------------- -- Constructing CLabels -mkClosureLabel id = IdLabel id Closure -mkSRTLabel id = IdLabel id SRT -mkSRTDescLabel id = IdLabel id SRTDesc -mkInfoTableLabel id = IdLabel id InfoTbl -mkEntryLabel id = IdLabel id Entry -mkSlowEntryLabel id = IdLabel id Slow -mkBitmapLabel id = IdLabel id Bitmap -mkRednCountsLabel id = IdLabel id RednCounts +-- These are always local: +mkSRTLabel name = IdLabel name SRT +mkSRTDescLabel name = IdLabel name SRTDesc +mkSlowEntryLabel name = IdLabel name Slow +mkBitmapLabel name = IdLabel name Bitmap +mkRednCountsLabel name = IdLabel name RednCounts + +-- These have local & (possibly) external variants: +mkLocalClosureLabel name = IdLabel name Closure +mkLocalInfoTableLabel name = IdLabel name InfoTable +mkLocalEntryLabel name = IdLabel name Entry +mkLocalClosureTableLabel name = IdLabel name ClosureTable + +mkClosureLabel hmods name + | isDllName hmods name = DynIdLabel name Closure + | otherwise = IdLabel name Closure + +mkInfoTableLabel hmods name + | isDllName hmods name = DynIdLabel name InfoTable + | otherwise = IdLabel name InfoTable + +mkEntryLabel hmods name + | isDllName hmods name = DynIdLabel name Entry + | otherwise = IdLabel name Entry + +mkClosureTableLabel hmods name + | isDllName hmods name = DynIdLabel name ClosureTable + | otherwise = IdLabel name ClosureTable + +mkLocalConInfoTableLabel con = IdLabel con ConInfoTable +mkLocalConEntryLabel con = IdLabel con ConEntry +mkLocalStaticInfoTableLabel con = IdLabel con StaticInfoTable +mkLocalStaticConEntryLabel con = IdLabel con StaticConEntry + +mkConInfoTableLabel name False = IdLabel name ConInfoTable +mkConInfoTableLabel name True = DynIdLabel name ConInfoTable + +mkStaticInfoTableLabel name False = IdLabel name StaticInfoTable +mkStaticInfoTableLabel name True = DynIdLabel name StaticInfoTable + +mkConEntryLabel hmods name + | isDllName hmods name = DynIdLabel name ConEntry + | otherwise = IdLabel name ConEntry -mkConInfoTableLabel con = IdLabel con ConInfoTbl -mkConEntryLabel con = IdLabel con ConEntry -mkStaticInfoTableLabel con = IdLabel con StaticInfoTbl -mkStaticConEntryLabel con = IdLabel con StaticConEntry +mkStaticConEntryLabel hmods name + | isDllName hmods name = DynIdLabel name StaticConEntry + | otherwise = IdLabel name StaticConEntry -mkClosureTblLabel id = IdLabel id ClosureTable mkReturnPtLabel uniq = CaseLabel uniq CaseReturnPt mkReturnInfoLabel uniq = CaseLabel uniq CaseReturnInfo @@ -253,17 +333,24 @@ mkDefaultLabel uniq = CaseLabel uniq CaseDefault mkStringLitLabel = StringLitLabel mkAsmTempLabel = AsmTempLabel -mkModuleInitLabel = ModuleInitLabel -mkPlainModuleInitLabel = PlainModuleInitLabel +mkModuleInitLabel :: HomeModules -> Module -> String -> CLabel +mkModuleInitLabel hmods mod way + = ModuleInitLabel mod way $! (not (isHomeModule hmods mod)) + +mkPlainModuleInitLabel :: HomeModules -> Module -> CLabel +mkPlainModuleInitLabel hmods mod + = PlainModuleInitLabel mod $! (not (isHomeModule hmods mod)) -- Some fixed runtime system labels mkSplitMarkerLabel = RtsLabel (RtsCode SLIT("__stg_split_marker")) +mkDirty_MUT_VAR_Label = RtsLabel (RtsCode SLIT("dirty_MUT_VAR")) mkUpdInfoLabel = RtsLabel (RtsInfo SLIT("stg_upd_frame")) mkSeqInfoLabel = RtsLabel (RtsInfo SLIT("stg_seq_frame")) mkIndStaticInfoLabel = RtsLabel (RtsInfo SLIT("stg_IND_STATIC")) mkMainCapabilityLabel = RtsLabel (RtsData SLIT("MainCapability")) -mkMAP_FROZEN_infoLabel = RtsLabel (RtsInfo SLIT("stg_MUT_ARR_PTRS_FROZEN")) +mkMAP_FROZEN_infoLabel = RtsLabel (RtsInfo SLIT("stg_MUT_ARR_PTRS_FROZEN0")) +mkMAP_DIRTY_infoLabel = RtsLabel (RtsInfo SLIT("stg_MUT_ARR_PTRS_DIRTY")) mkEMPTY_MVAR_infoLabel = RtsLabel (RtsInfo SLIT("stg_EMPTY_MVAR")) mkTopTickyCtrLabel = RtsLabel (RtsData SLIT("top_ct")) @@ -276,10 +363,10 @@ mkRtsPrimOpLabel primop = RtsLabel (RtsPrimOp primop) moduleRegdLabel = ModuleRegdLabel -mkSelectorInfoLabel upd off = RtsLabel (RtsSelectorInfoTbl upd off) +mkSelectorInfoLabel upd off = RtsLabel (RtsSelectorInfoTable upd off) mkSelectorEntryLabel upd off = RtsLabel (RtsSelectorEntry upd off) -mkApInfoTableLabel upd off = RtsLabel (RtsApInfoTbl upd off) +mkApInfoTableLabel upd off = RtsLabel (RtsApInfoTable upd off) mkApEntryLabel upd off = RtsLabel (RtsApEntry upd off) -- Foreign labels @@ -309,13 +396,33 @@ mkRtsDataLabelFS str = RtsLabel (RtsDataFS str) mkRtsSlowTickyCtrLabel :: String -> CLabel mkRtsSlowTickyCtrLabel pat = RtsLabel (RtsSlowTickyCtr pat) + -- Dynamic linking + +mkDynamicLinkerLabel :: DynamicLinkerLabelInfo -> CLabel -> CLabel +mkDynamicLinkerLabel = DynamicLinkerLabel + +dynamicLinkerLabelInfo :: CLabel -> Maybe (DynamicLinkerLabelInfo, CLabel) +dynamicLinkerLabelInfo (DynamicLinkerLabel info lbl) = Just (info, lbl) +dynamicLinkerLabelInfo _ = Nothing + + -- Position independent code + +mkPicBaseLabel :: CLabel +mkPicBaseLabel = PicBaseLabel + +mkDeadStripPreventer :: CLabel -> CLabel +mkDeadStripPreventer lbl = DeadStripPreventer lbl + -- ----------------------------------------------------------------------------- -- Converting info labels to entry labels. infoLblToEntryLbl :: CLabel -> CLabel -infoLblToEntryLbl (IdLabel n InfoTbl) = IdLabel n Entry -infoLblToEntryLbl (IdLabel n ConInfoTbl) = IdLabel n ConEntry -infoLblToEntryLbl (IdLabel n StaticInfoTbl) = IdLabel n StaticConEntry +infoLblToEntryLbl (IdLabel n InfoTable) = IdLabel n Entry +infoLblToEntryLbl (IdLabel n ConInfoTable) = IdLabel n ConEntry +infoLblToEntryLbl (IdLabel n StaticInfoTable) = IdLabel n StaticConEntry +infoLblToEntryLbl (DynIdLabel n InfoTable) = DynIdLabel n Entry +infoLblToEntryLbl (DynIdLabel n ConInfoTable) = DynIdLabel n ConEntry +infoLblToEntryLbl (DynIdLabel n StaticInfoTable) = DynIdLabel n StaticConEntry infoLblToEntryLbl (CaseLabel n CaseReturnInfo) = CaseLabel n CaseReturnPt infoLblToEntryLbl (RtsLabel (RtsInfo s)) = RtsLabel (RtsEntry s) infoLblToEntryLbl (RtsLabel (RtsRetInfo s)) = RtsLabel (RtsRet s) @@ -324,9 +431,12 @@ infoLblToEntryLbl (RtsLabel (RtsRetInfoFS s)) = RtsLabel (RtsRetFS s) infoLblToEntryLbl _ = panic "CLabel.infoLblToEntryLbl" entryLblToInfoLbl :: CLabel -> CLabel -entryLblToInfoLbl (IdLabel n Entry) = IdLabel n InfoTbl -entryLblToInfoLbl (IdLabel n ConEntry) = IdLabel n ConInfoTbl -entryLblToInfoLbl (IdLabel n StaticConEntry) = IdLabel n StaticInfoTbl +entryLblToInfoLbl (IdLabel n Entry) = IdLabel n InfoTable +entryLblToInfoLbl (IdLabel n ConEntry) = IdLabel n ConInfoTable +entryLblToInfoLbl (IdLabel n StaticConEntry) = IdLabel n StaticInfoTable +entryLblToInfoLbl (DynIdLabel n Entry) = DynIdLabel n InfoTable +entryLblToInfoLbl (DynIdLabel n ConEntry) = DynIdLabel n ConInfoTable +entryLblToInfoLbl (DynIdLabel n StaticConEntry) = DynIdLabel n StaticInfoTable entryLblToInfoLbl (CaseLabel n CaseReturnPt) = CaseLabel n CaseReturnInfo entryLblToInfoLbl (RtsLabel (RtsEntry s)) = RtsLabel (RtsInfo s) entryLblToInfoLbl (RtsLabel (RtsRet s)) = RtsLabel (RtsRetInfo s) @@ -345,13 +455,12 @@ needsCDecl (IdLabel _ SRT) = False needsCDecl (IdLabel _ SRTDesc) = False needsCDecl (IdLabel _ Bitmap) = False needsCDecl (IdLabel _ _) = True -needsCDecl (CaseLabel _ CaseReturnPt) = True -needsCDecl (CaseLabel _ CaseReturnInfo) = True -needsCDecl (ModuleInitLabel _ _) = True -needsCDecl (PlainModuleInitLabel _) = True +needsCDecl (DynIdLabel _ _) = True +needsCDecl (CaseLabel _ _) = True +needsCDecl (ModuleInitLabel _ _ _) = True +needsCDecl (PlainModuleInitLabel _ _) = True needsCDecl ModuleRegdLabel = False -needsCDecl (CaseLabel _ _) = False needsCDecl (StringLitLabel _) = False needsCDecl (AsmTempLabel _) = False needsCDecl (RtsLabel _) = False @@ -376,15 +485,16 @@ externallyVisibleCLabel :: CLabel -> Bool -- not C "static" externallyVisibleCLabel (CaseLabel _ _) = False externallyVisibleCLabel (StringLitLabel _) = False externallyVisibleCLabel (AsmTempLabel _) = False -externallyVisibleCLabel (ModuleInitLabel _ _)= True -externallyVisibleCLabel (PlainModuleInitLabel _)= True +externallyVisibleCLabel (ModuleInitLabel _ _ _)= True +externallyVisibleCLabel (PlainModuleInitLabel _ _)= True externallyVisibleCLabel ModuleRegdLabel = False externallyVisibleCLabel (RtsLabel _) = True externallyVisibleCLabel (ForeignLabel _ _ _) = True -externallyVisibleCLabel (IdLabel id _) = isExternalName id +externallyVisibleCLabel (IdLabel name _) = isExternalName name +externallyVisibleCLabel (DynIdLabel name _) = isExternalName name externallyVisibleCLabel (CC_Label _) = True externallyVisibleCLabel (CCS_Label _) = True - +externallyVisibleCLabel (DynamicLinkerLabel _ _) = False -- ----------------------------------------------------------------------------- -- Finding the "type" of a CLabel @@ -396,8 +506,8 @@ data CLabelType | DataLabel labelType :: CLabel -> CLabelType -labelType (RtsLabel (RtsSelectorInfoTbl _ _)) = DataLabel -labelType (RtsLabel (RtsApInfoTbl _ _)) = DataLabel +labelType (RtsLabel (RtsSelectorInfoTable _ _)) = DataLabel +labelType (RtsLabel (RtsApInfoTable _ _)) = DataLabel labelType (RtsLabel (RtsData _)) = DataLabel labelType (RtsLabel (RtsCode _)) = CodeLabel labelType (RtsLabel (RtsInfo _)) = DataLabel @@ -411,22 +521,24 @@ labelType (RtsLabel (RtsEntryFS _)) = CodeLabel labelType (RtsLabel (RtsRetInfoFS _)) = DataLabel labelType (RtsLabel (RtsRetFS _)) = CodeLabel labelType (CaseLabel _ CaseReturnInfo) = DataLabel -labelType (CaseLabel _ CaseReturnPt) = CodeLabel -labelType (ModuleInitLabel _ _) = CodeLabel -labelType (PlainModuleInitLabel _) = CodeLabel +labelType (CaseLabel _ _) = CodeLabel +labelType (ModuleInitLabel _ _ _) = CodeLabel +labelType (PlainModuleInitLabel _ _) = CodeLabel + +labelType (IdLabel _ info) = idInfoLabelType info +labelType (DynIdLabel _ info) = idInfoLabelType info +labelType _ = DataLabel -labelType (IdLabel _ info) = +idInfoLabelType info = case info of - InfoTbl -> DataLabel + InfoTable -> DataLabel Closure -> DataLabel Bitmap -> DataLabel - ConInfoTbl -> DataLabel - StaticInfoTbl -> DataLabel + ConInfoTable -> DataLabel + StaticInfoTable -> DataLabel ClosureTable -> DataLabel _ -> CodeLabel -labelType _ = DataLabel - -- ----------------------------------------------------------------------------- -- Does a CLabel need dynamic linkage? @@ -440,24 +552,21 @@ labelDynamic :: CLabel -> Bool labelDynamic lbl = case lbl of RtsLabel _ -> not opt_Static -- i.e., is the RTS in a DLL or not? - IdLabel n k -> isDllName n + IdLabel n k -> False + DynIdLabel n k -> True +#if mingw32_TARGET_OS ForeignLabel _ _ d -> d - ModuleInitLabel m _ -> (not opt_Static) && (not (isHomeModule m)) - PlainModuleInitLabel m -> (not opt_Static) && (not (isHomeModule m)) +#else + -- On Mac OS X and on ELF platforms, false positives are OK, + -- so we claim that all foreign imports come from dynamic libraries + ForeignLabel _ _ _ -> True +#endif + ModuleInitLabel m _ dyn -> not opt_Static && dyn + PlainModuleInitLabel m dyn -> not opt_Static && dyn + + -- Note that DynamicLinkerLabels do NOT require dynamic linking themselves. _ -> False --- Basically the same as above, but this time for Darwin only. --- The things that GHC does when labelDynamic returns true are not quite right --- for Darwin. Also, every ForeignLabel might possibly be from a dynamic library, --- and a 'false positive' doesn't really hurt on Darwin, so this just returns --- True for every ForeignLabel. --- --- ToDo: Clean up DLL-related code so we can do away with the distinction --- between this and labelDynamic above. - -labelCouldBeDynamic (ForeignLabel _ _ _) = True -labelCouldBeDynamic lbl = labelDynamic lbl - {- OLD?: These GRAN functions are needed for spitting out GRAN_FETCH() at the right places. It is used to detect when the abstractC statement of an @@ -514,6 +623,15 @@ pprCLabel (AsmTempLabel u) ptext asmTempLabelPrefix <> pprUnique u else char '_' <> pprUnique u + +pprCLabel (DynamicLinkerLabel info lbl) + = pprDynamicLinkerAsmLabel info lbl + +pprCLabel PicBaseLabel + = ptext SLIT("1b") + +pprCLabel (DeadStripPreventer lbl) + = pprCLabel lbl <> ptext SLIT("_dsp") #endif pprCLabel lbl = @@ -529,10 +647,12 @@ maybe_underscore doc | underscorePrefix = pp_cSEP <> doc | otherwise = doc +#ifdef mingw32_TARGET_OS -- In asm mode, we need to put the suffix on a stdcall ForeignLabel. -- (The C compiler does this itself). pprAsmCLbl (ForeignLabel fs (Just sz) _) = ftext fs <> char '@' <> int sz +#endif pprAsmCLbl lbl = pprCLbl lbl @@ -553,7 +673,7 @@ pprCLbl (RtsLabel (RtsData str)) = ptext str pprCLbl (RtsLabel (RtsCodeFS str)) = ftext str pprCLbl (RtsLabel (RtsDataFS str)) = ftext str -pprCLbl (RtsLabel (RtsSelectorInfoTbl upd_reqd offset)) +pprCLbl (RtsLabel (RtsSelectorInfoTable upd_reqd offset)) = hcat [ptext SLIT("stg_sel_"), text (show offset), ptext (if upd_reqd then SLIT("_upd_info") @@ -567,7 +687,7 @@ pprCLbl (RtsLabel (RtsSelectorEntry upd_reqd offset)) else SLIT("_noupd_entry")) ] -pprCLbl (RtsLabel (RtsApInfoTbl upd_reqd arity)) +pprCLbl (RtsLabel (RtsApInfoTable upd_reqd arity)) = hcat [ptext SLIT("stg_ap_"), text (show arity), ptext (if upd_reqd then SLIT("_upd_info") @@ -617,16 +737,17 @@ pprCLbl ModuleRegdLabel pprCLbl (ForeignLabel str _ _) = ftext str -pprCLbl (IdLabel id flavor) = ppr id <> ppIdFlavor flavor +pprCLbl (IdLabel name flavor) = ppr name <> ppIdFlavor flavor +pprCLbl (DynIdLabel name flavor) = ppr name <> ppIdFlavor flavor pprCLbl (CC_Label cc) = ppr cc pprCLbl (CCS_Label ccs) = ppr ccs -pprCLbl (ModuleInitLabel mod way) - = ptext SLIT("__stginit_") <> ftext (moduleNameFS (moduleName mod)) +pprCLbl (ModuleInitLabel mod way _) + = ptext SLIT("__stginit_") <> ppr mod <> char '_' <> text way -pprCLbl (PlainModuleInitLabel mod) - = ptext SLIT("__stginit_") <> ftext (moduleNameFS (moduleName mod)) +pprCLbl (PlainModuleInitLabel mod _) + = ptext SLIT("__stginit_") <> ppr mod ppIdFlavor :: IdLabelInfo -> SDoc ppIdFlavor x = pp_cSEP <> @@ -634,15 +755,15 @@ ppIdFlavor x = pp_cSEP <> Closure -> ptext SLIT("closure") SRT -> ptext SLIT("srt") SRTDesc -> ptext SLIT("srtd") - InfoTbl -> ptext SLIT("info") + InfoTable -> ptext SLIT("info") Entry -> ptext SLIT("entry") Slow -> ptext SLIT("slow") RednCounts -> ptext SLIT("ct") Bitmap -> ptext SLIT("btm") ConEntry -> ptext SLIT("con_entry") - ConInfoTbl -> ptext SLIT("con_info") + ConInfoTable -> ptext SLIT("con_info") StaticConEntry -> ptext SLIT("static_entry") - StaticInfoTbl -> ptext SLIT("static_info") + StaticInfoTable -> ptext SLIT("static_info") ClosureTable -> ptext SLIT("closure_tbl") ) @@ -668,3 +789,31 @@ asmTempLabelPrefix = #else SLIT(".L") #endif + +pprDynamicLinkerAsmLabel :: DynamicLinkerLabelInfo -> CLabel -> SDoc + +#if darwin_TARGET_OS +pprDynamicLinkerAsmLabel SymbolPtr lbl + = char 'L' <> pprCLabel lbl <> text "$non_lazy_ptr" +pprDynamicLinkerAsmLabel CodeStub lbl + = char 'L' <> pprCLabel lbl <> text "$stub" +#elif powerpc_TARGET_ARCH && linux_TARGET_OS +pprDynamicLinkerAsmLabel CodeStub lbl + = pprCLabel lbl <> text "@plt" +pprDynamicLinkerAsmLabel SymbolPtr lbl + = text ".LC_" <> pprCLabel lbl +#elif linux_TARGET_OS +pprDynamicLinkerAsmLabel CodeStub lbl + = pprCLabel lbl <> text "@plt" +pprDynamicLinkerAsmLabel GotSymbolPtr lbl + = pprCLabel lbl <> text "@got" +pprDynamicLinkerAsmLabel GotSymbolOffset lbl + = pprCLabel lbl <> text "@gotoff" +pprDynamicLinkerAsmLabel SymbolPtr lbl + = text ".LC_" <> pprCLabel lbl +#elif mingw32_TARGET_OS +pprDynamicLinkerAsmLabel SymbolPtr lbl + = text "__imp_" <> pprCLabel lbl +#endif +pprDynamicLinkerAsmLabel _ _ + = panic "pprDynamicLinkerAsmLabel"