1 -----------------------------------------------------------------------------
3 -- Object-file symbols (called CLabel for histerical raisins).
5 -- (c) The University of Glasgow 2004
7 -----------------------------------------------------------------------------
10 CLabel, -- abstract type
19 mkStaticConEntryLabel,
22 mkStaticInfoTableLabel,
38 mkPlainModuleInitLabel,
44 mkMainCapabilityLabel,
45 mkMAP_FROZEN_infoLabel,
46 mkEMPTY_MVAR_infoLabel,
49 mkCAFBlackHoleInfoTableLabel,
50 mkSECAFBlackHoleInfoTableLabel,
52 mkRtsSlowTickyCtrLabel,
75 mkCCLabel, mkCCSLabel,
77 DynamicLinkerLabelInfo(..),
79 dynamicLinkerLabelInfo,
83 infoLblToEntryLbl, entryLblToInfoLbl,
84 needsCDecl, isAsmTemp, externallyVisibleCLabel,
85 CLabelType(..), labelType, labelDynamic,
91 #include "HsVersions.h"
92 #include "../includes/ghcconfig.h"
94 import CmdLineOpts ( opt_Static, opt_DoTickyProfiling )
95 import DataCon ( ConTag )
96 import Module ( moduleName, moduleNameFS,
97 Module, isHomeModule )
98 import Name ( Name, isDllName, isExternalName )
99 import Unique ( pprUnique, Unique )
100 import PrimOp ( PrimOp )
101 import Config ( cLeadingUnderscore )
102 import CostCentre ( CostCentre, CostCentreStack )
106 -- -----------------------------------------------------------------------------
110 CLabel is an abstract type that supports the following operations:
114 - In a C file, does it need to be declared before use? (i.e. is it
115 guaranteed to be already in scope in the places we need to refer to it?)
117 - If it needs to be declared, what type (code or data) should it be
120 - Is it visible outside this object file or not?
122 - Is it "dynamic" (see details below)
124 - Eq and Ord, so that we can make sets of CLabels (currently only
125 used in outputting C as far as I can tell, to avoid generating
126 more than one declaration for any given label).
128 - Converting an info table label into an entry label.
132 = IdLabel -- A family of labels related to the
133 Name -- definition of a particular Id or Con
136 | CaseLabel -- A family of labels related to a particular
138 {-# UNPACK #-} !Unique -- Unique says which case expression
142 {-# UNPACK #-} !Unique
145 {-# UNPACK #-} !Unique
148 Module -- the module name
150 -- at some point we might want some kind of version number in
151 -- the module init label, to guard against compiling modules in
152 -- the wrong order. We can't use the interface file version however,
153 -- because we don't always recompile modules which depend on a module
154 -- whose version has changed.
156 | PlainModuleInitLabel Module -- without the vesrion & way info
160 | RtsLabel RtsLabelInfo
162 | ForeignLabel FastString -- a 'C' (or otherwise foreign) label
163 (Maybe Int) -- possible '@n' suffix for stdcall functions
164 -- When generating C, the '@n' suffix is omitted, but when
165 -- generating assembler we must add it to the label.
166 Bool -- True <=> is dynamic
168 | CC_Label CostCentre
169 | CCS_Label CostCentreStack
171 -- Dynamic Linking in the NCG:
172 -- generated and used inside the NCG only,
173 -- see module PositionIndependentCode for details.
175 | DynamicLinkerLabel DynamicLinkerLabelInfo CLabel
176 -- special variants of a label used for dynamic linking
178 | PicBaseLabel -- a label used as a base for PIC calculations
179 -- on some platforms.
180 -- It takes the form of a local numeric
181 -- assembler label '1'; it is pretty-printed
182 -- as 1b, referring to the previous definition
183 -- of 1: in the assembler source file.
187 = Closure -- Label for closure
188 | SRT -- Static reference table
189 | SRTDesc -- Static reference table descriptor
190 | InfoTbl -- Info tables for closures; always read-only
191 | Entry -- entry point
192 | Slow -- slow entry point
194 | RednCounts -- Label of place to keep Ticky-ticky info for
197 | Bitmap -- A bitmap (function or case return)
199 | ConEntry -- constructor entry point
200 | ConInfoTbl -- corresponding info table
201 | StaticConEntry -- static constructor entry point
202 | StaticInfoTbl -- corresponding info table
204 | ClosureTable -- table of closures for Enum tycons
218 = RtsSelectorInfoTbl Bool{-updatable-} Int{-offset-} -- Selector thunks
219 | RtsSelectorEntry Bool{-updatable-} Int{-offset-}
221 | RtsApInfoTbl Bool{-updatable-} Int{-arity-} -- AP thunks
222 | RtsApEntry Bool{-updatable-} Int{-arity-}
226 | RtsInfo LitString -- misc rts info tables
227 | RtsEntry LitString -- misc rts entry points
228 | RtsRetInfo LitString -- misc rts ret info tables
229 | RtsRet LitString -- misc rts return points
230 | RtsData LitString -- misc rts data bits, eg CHARLIKE_closure
231 | RtsCode LitString -- misc rts code
233 | RtsInfoFS FastString -- misc rts info tables
234 | RtsEntryFS FastString -- misc rts entry points
235 | RtsRetInfoFS FastString -- misc rts ret info tables
236 | RtsRetFS FastString -- misc rts return points
237 | RtsDataFS FastString -- misc rts data bits, eg CHARLIKE_closure
238 | RtsCodeFS FastString -- misc rts code
240 | RtsSlowTickyCtr String
243 -- NOTE: Eq on LitString compares the pointer only, so this isn't
246 data DynamicLinkerLabelInfo
247 = CodeStub -- MachO: Lfoo$stub, ELF: foo@plt
248 | SymbolPtr -- MachO: Lfoo$non_lazy_ptr, Windows: __imp_foo
249 | GotSymbolPtr -- ELF: foo@got
250 | GotSymbolOffset -- ELF: foo@gotoff
254 -- -----------------------------------------------------------------------------
255 -- Constructing CLabels
257 mkClosureLabel id = IdLabel id Closure
258 mkSRTLabel id = IdLabel id SRT
259 mkSRTDescLabel id = IdLabel id SRTDesc
260 mkInfoTableLabel id = IdLabel id InfoTbl
261 mkEntryLabel id = IdLabel id Entry
262 mkSlowEntryLabel id = IdLabel id Slow
263 mkBitmapLabel id = IdLabel id Bitmap
264 mkRednCountsLabel id = IdLabel id RednCounts
266 mkConInfoTableLabel con = IdLabel con ConInfoTbl
267 mkConEntryLabel con = IdLabel con ConEntry
268 mkStaticInfoTableLabel con = IdLabel con StaticInfoTbl
269 mkStaticConEntryLabel con = IdLabel con StaticConEntry
271 mkClosureTblLabel id = IdLabel id ClosureTable
273 mkReturnPtLabel uniq = CaseLabel uniq CaseReturnPt
274 mkReturnInfoLabel uniq = CaseLabel uniq CaseReturnInfo
275 mkAltLabel uniq tag = CaseLabel uniq (CaseAlt tag)
276 mkDefaultLabel uniq = CaseLabel uniq CaseDefault
278 mkStringLitLabel = StringLitLabel
279 mkAsmTempLabel = AsmTempLabel
281 mkModuleInitLabel = ModuleInitLabel
282 mkPlainModuleInitLabel = PlainModuleInitLabel
284 -- Some fixed runtime system labels
286 mkSplitMarkerLabel = RtsLabel (RtsCode SLIT("__stg_split_marker"))
287 mkUpdInfoLabel = RtsLabel (RtsInfo SLIT("stg_upd_frame"))
288 mkSeqInfoLabel = RtsLabel (RtsInfo SLIT("stg_seq_frame"))
289 mkIndStaticInfoLabel = RtsLabel (RtsInfo SLIT("stg_IND_STATIC"))
290 mkMainCapabilityLabel = RtsLabel (RtsData SLIT("MainCapability"))
291 mkMAP_FROZEN_infoLabel = RtsLabel (RtsInfo SLIT("stg_MUT_ARR_PTRS_FROZEN"))
292 mkEMPTY_MVAR_infoLabel = RtsLabel (RtsInfo SLIT("stg_EMPTY_MVAR"))
294 mkTopTickyCtrLabel = RtsLabel (RtsData SLIT("top_ct"))
295 mkCAFBlackHoleInfoTableLabel = RtsLabel (RtsInfo SLIT("stg_CAF_BLACKHOLE"))
296 mkSECAFBlackHoleInfoTableLabel = if opt_DoTickyProfiling then
297 RtsLabel (RtsInfo SLIT("stg_SE_CAF_BLACKHOLE"))
298 else -- RTS won't have info table unless -ticky is on
299 panic "mkSECAFBlackHoleInfoTableLabel requires -ticky"
300 mkRtsPrimOpLabel primop = RtsLabel (RtsPrimOp primop)
302 moduleRegdLabel = ModuleRegdLabel
304 mkSelectorInfoLabel upd off = RtsLabel (RtsSelectorInfoTbl upd off)
305 mkSelectorEntryLabel upd off = RtsLabel (RtsSelectorEntry upd off)
307 mkApInfoTableLabel upd off = RtsLabel (RtsApInfoTbl upd off)
308 mkApEntryLabel upd off = RtsLabel (RtsApEntry upd off)
312 mkForeignLabel :: FastString -> Maybe Int -> Bool -> CLabel
313 mkForeignLabel str mb_sz is_dynamic = ForeignLabel str mb_sz is_dynamic
317 mkCCLabel cc = CC_Label cc
318 mkCCSLabel ccs = CCS_Label ccs
320 mkRtsInfoLabel str = RtsLabel (RtsInfo str)
321 mkRtsEntryLabel str = RtsLabel (RtsEntry str)
322 mkRtsRetInfoLabel str = RtsLabel (RtsRetInfo str)
323 mkRtsRetLabel str = RtsLabel (RtsRet str)
324 mkRtsCodeLabel str = RtsLabel (RtsCode str)
325 mkRtsDataLabel str = RtsLabel (RtsData str)
327 mkRtsInfoLabelFS str = RtsLabel (RtsInfoFS str)
328 mkRtsEntryLabelFS str = RtsLabel (RtsEntryFS str)
329 mkRtsRetInfoLabelFS str = RtsLabel (RtsRetInfoFS str)
330 mkRtsRetLabelFS str = RtsLabel (RtsRetFS str)
331 mkRtsCodeLabelFS str = RtsLabel (RtsCodeFS str)
332 mkRtsDataLabelFS str = RtsLabel (RtsDataFS str)
334 mkRtsSlowTickyCtrLabel :: String -> CLabel
335 mkRtsSlowTickyCtrLabel pat = RtsLabel (RtsSlowTickyCtr pat)
339 mkDynamicLinkerLabel :: DynamicLinkerLabelInfo -> CLabel -> CLabel
340 mkDynamicLinkerLabel = DynamicLinkerLabel
342 dynamicLinkerLabelInfo :: CLabel -> Maybe (DynamicLinkerLabelInfo, CLabel)
343 dynamicLinkerLabelInfo (DynamicLinkerLabel info lbl) = Just (info, lbl)
344 dynamicLinkerLabelInfo _ = Nothing
346 -- Position independent code
348 mkPicBaseLabel :: CLabel
349 mkPicBaseLabel = PicBaseLabel
351 -- -----------------------------------------------------------------------------
352 -- Converting info labels to entry labels.
354 infoLblToEntryLbl :: CLabel -> CLabel
355 infoLblToEntryLbl (IdLabel n InfoTbl) = IdLabel n Entry
356 infoLblToEntryLbl (IdLabel n ConInfoTbl) = IdLabel n ConEntry
357 infoLblToEntryLbl (IdLabel n StaticInfoTbl) = IdLabel n StaticConEntry
358 infoLblToEntryLbl (CaseLabel n CaseReturnInfo) = CaseLabel n CaseReturnPt
359 infoLblToEntryLbl (RtsLabel (RtsInfo s)) = RtsLabel (RtsEntry s)
360 infoLblToEntryLbl (RtsLabel (RtsRetInfo s)) = RtsLabel (RtsRet s)
361 infoLblToEntryLbl (RtsLabel (RtsInfoFS s)) = RtsLabel (RtsEntryFS s)
362 infoLblToEntryLbl (RtsLabel (RtsRetInfoFS s)) = RtsLabel (RtsRetFS s)
363 infoLblToEntryLbl _ = panic "CLabel.infoLblToEntryLbl"
365 entryLblToInfoLbl :: CLabel -> CLabel
366 entryLblToInfoLbl (IdLabel n Entry) = IdLabel n InfoTbl
367 entryLblToInfoLbl (IdLabel n ConEntry) = IdLabel n ConInfoTbl
368 entryLblToInfoLbl (IdLabel n StaticConEntry) = IdLabel n StaticInfoTbl
369 entryLblToInfoLbl (CaseLabel n CaseReturnPt) = CaseLabel n CaseReturnInfo
370 entryLblToInfoLbl (RtsLabel (RtsEntry s)) = RtsLabel (RtsInfo s)
371 entryLblToInfoLbl (RtsLabel (RtsRet s)) = RtsLabel (RtsRetInfo s)
372 entryLblToInfoLbl (RtsLabel (RtsEntryFS s)) = RtsLabel (RtsInfoFS s)
373 entryLblToInfoLbl (RtsLabel (RtsRetFS s)) = RtsLabel (RtsRetInfoFS s)
374 entryLblToInfoLbl l = pprPanic "CLabel.entryLblToInfoLbl" (pprCLabel l)
376 -- -----------------------------------------------------------------------------
377 -- Does a CLabel need declaring before use or not?
379 needsCDecl :: CLabel -> Bool
380 -- False <=> it's pre-declared; don't bother
381 -- don't bother declaring SRT & Bitmap labels, we always make sure
382 -- they are defined before use.
383 needsCDecl (IdLabel _ SRT) = False
384 needsCDecl (IdLabel _ SRTDesc) = False
385 needsCDecl (IdLabel _ Bitmap) = False
386 needsCDecl (IdLabel _ _) = True
387 needsCDecl (CaseLabel _ _) = True
388 needsCDecl (ModuleInitLabel _ _) = True
389 needsCDecl (PlainModuleInitLabel _) = True
390 needsCDecl ModuleRegdLabel = False
392 needsCDecl (CaseLabel _ _) = False
393 needsCDecl (StringLitLabel _) = False
394 needsCDecl (AsmTempLabel _) = False
395 needsCDecl (RtsLabel _) = False
396 needsCDecl (ForeignLabel _ _ _) = False
397 needsCDecl (CC_Label _) = True
398 needsCDecl (CCS_Label _) = True
400 -- Whether the label is an assembler temporary:
402 isAsmTemp :: CLabel -> Bool -- is a local temporary for native code generation
403 isAsmTemp (AsmTempLabel _) = True
406 -- -----------------------------------------------------------------------------
407 -- Is a CLabel visible outside this object file or not?
409 -- From the point of view of the code generator, a name is
410 -- externally visible if it has to be declared as exported
411 -- in the .o file's symbol table; that is, made non-static.
413 externallyVisibleCLabel :: CLabel -> Bool -- not C "static"
414 externallyVisibleCLabel (CaseLabel _ _) = False
415 externallyVisibleCLabel (StringLitLabel _) = False
416 externallyVisibleCLabel (AsmTempLabel _) = False
417 externallyVisibleCLabel (ModuleInitLabel _ _)= True
418 externallyVisibleCLabel (PlainModuleInitLabel _)= True
419 externallyVisibleCLabel ModuleRegdLabel = False
420 externallyVisibleCLabel (RtsLabel _) = True
421 externallyVisibleCLabel (ForeignLabel _ _ _) = True
422 externallyVisibleCLabel (IdLabel id _) = isExternalName id
423 externallyVisibleCLabel (CC_Label _) = True
424 externallyVisibleCLabel (CCS_Label _) = True
425 externallyVisibleCLabel (DynamicLinkerLabel _ _) = False
427 -- -----------------------------------------------------------------------------
428 -- Finding the "type" of a CLabel
430 -- For generating correct types in label declarations:
436 labelType :: CLabel -> CLabelType
437 labelType (RtsLabel (RtsSelectorInfoTbl _ _)) = DataLabel
438 labelType (RtsLabel (RtsApInfoTbl _ _)) = DataLabel
439 labelType (RtsLabel (RtsData _)) = DataLabel
440 labelType (RtsLabel (RtsCode _)) = CodeLabel
441 labelType (RtsLabel (RtsInfo _)) = DataLabel
442 labelType (RtsLabel (RtsEntry _)) = CodeLabel
443 labelType (RtsLabel (RtsRetInfo _)) = DataLabel
444 labelType (RtsLabel (RtsRet _)) = CodeLabel
445 labelType (RtsLabel (RtsDataFS _)) = DataLabel
446 labelType (RtsLabel (RtsCodeFS _)) = CodeLabel
447 labelType (RtsLabel (RtsInfoFS _)) = DataLabel
448 labelType (RtsLabel (RtsEntryFS _)) = CodeLabel
449 labelType (RtsLabel (RtsRetInfoFS _)) = DataLabel
450 labelType (RtsLabel (RtsRetFS _)) = CodeLabel
451 labelType (CaseLabel _ CaseReturnInfo) = DataLabel
452 labelType (CaseLabel _ _) = CodeLabel
453 labelType (ModuleInitLabel _ _) = CodeLabel
454 labelType (PlainModuleInitLabel _) = CodeLabel
456 labelType (IdLabel _ info) =
461 ConInfoTbl -> DataLabel
462 StaticInfoTbl -> DataLabel
463 ClosureTable -> DataLabel
466 labelType _ = DataLabel
469 -- -----------------------------------------------------------------------------
470 -- Does a CLabel need dynamic linkage?
472 -- When referring to data in code, we need to know whether
473 -- that data resides in a DLL or not. [Win32 only.]
474 -- @labelDynamic@ returns @True@ if the label is located
475 -- in a DLL, be it a data reference or not.
477 labelDynamic :: CLabel -> Bool
480 RtsLabel _ -> not opt_Static -- i.e., is the RTS in a DLL or not?
481 IdLabel n k -> isDllName n
482 #if mingw32_TARGET_OS
483 ForeignLabel _ _ d -> d
485 -- On Mac OS X and on ELF platforms, false positives are OK,
486 -- so we claim that all foreign imports come from dynamic libraries
487 ForeignLabel _ _ _ -> True
489 ModuleInitLabel m _ -> (not opt_Static) && (not (isHomeModule m))
490 PlainModuleInitLabel m -> (not opt_Static) && (not (isHomeModule m))
492 -- Note that DynamicLinkerLabels do NOT require dynamic linking themselves.
496 OLD?: These GRAN functions are needed for spitting out GRAN_FETCH() at the
497 right places. It is used to detect when the abstractC statement of an
498 CCodeBlock actually contains the code for a slow entry point. -- HWL
500 We need at least @Eq@ for @CLabels@, because we want to avoid
501 duplicate declarations in generating C (see @labelSeenTE@ in
505 -----------------------------------------------------------------------------
506 -- Printing out CLabels.
513 where <name> is <Module>_<name> for external names and <unique> for
514 internal names. <type> is one of the following:
517 srt Static reference table
518 srtd Static reference table descriptor
519 entry Entry code (function, closure)
520 slow Slow entry code (if any)
521 ret Direct return address
523 <n>_alt Case alternative (tag n)
524 dflt Default case alternative
525 btm Large bitmap vector
526 closure Static closure
527 con_entry Dynamic Constructor entry code
528 con_info Dynamic Constructor info table
529 static_entry Static Constructor entry code
530 static_info Static Constructor info table
531 sel_info Selector info table
532 sel_entry Selector entry code
534 ccs Cost centre stack
536 Many of these distinctions are only for documentation reasons. For
537 example, _ret is only distinguished from _entry to make it easy to
538 tell whether a code fragment is a return point or a closure/function
542 pprCLabel :: CLabel -> SDoc
544 #if ! OMIT_NATIVE_CODEGEN
545 pprCLabel (AsmTempLabel u)
546 = getPprStyle $ \ sty ->
548 ptext asmTempLabelPrefix <> pprUnique u
550 char '_' <> pprUnique u
552 pprCLabel (DynamicLinkerLabel info lbl)
553 = pprDynamicLinkerAsmLabel info lbl
555 pprCLabel PicBaseLabel
560 #if ! OMIT_NATIVE_CODEGEN
561 getPprStyle $ \ sty ->
563 maybe_underscore (pprAsmCLbl lbl)
569 | underscorePrefix = pp_cSEP <> doc
572 #ifdef mingw32_TARGET_OS
573 -- In asm mode, we need to put the suffix on a stdcall ForeignLabel.
574 -- (The C compiler does this itself).
575 pprAsmCLbl (ForeignLabel fs (Just sz) _)
576 = ftext fs <> char '@' <> int sz
581 pprCLbl (StringLitLabel u)
582 = pprUnique u <> ptext SLIT("_str")
584 pprCLbl (CaseLabel u CaseReturnPt)
585 = hcat [pprUnique u, ptext SLIT("_ret")]
586 pprCLbl (CaseLabel u CaseReturnInfo)
587 = hcat [pprUnique u, ptext SLIT("_info")]
588 pprCLbl (CaseLabel u (CaseAlt tag))
589 = hcat [pprUnique u, pp_cSEP, int tag, ptext SLIT("_alt")]
590 pprCLbl (CaseLabel u CaseDefault)
591 = hcat [pprUnique u, ptext SLIT("_dflt")]
593 pprCLbl (RtsLabel (RtsCode str)) = ptext str
594 pprCLbl (RtsLabel (RtsData str)) = ptext str
595 pprCLbl (RtsLabel (RtsCodeFS str)) = ftext str
596 pprCLbl (RtsLabel (RtsDataFS str)) = ftext str
598 pprCLbl (RtsLabel (RtsSelectorInfoTbl upd_reqd offset))
599 = hcat [ptext SLIT("stg_sel_"), text (show offset),
601 then SLIT("_upd_info")
602 else SLIT("_noupd_info"))
605 pprCLbl (RtsLabel (RtsSelectorEntry upd_reqd offset))
606 = hcat [ptext SLIT("stg_sel_"), text (show offset),
608 then SLIT("_upd_entry")
609 else SLIT("_noupd_entry"))
612 pprCLbl (RtsLabel (RtsApInfoTbl upd_reqd arity))
613 = hcat [ptext SLIT("stg_ap_"), text (show arity),
615 then SLIT("_upd_info")
616 else SLIT("_noupd_info"))
619 pprCLbl (RtsLabel (RtsApEntry upd_reqd arity))
620 = hcat [ptext SLIT("stg_ap_"), text (show arity),
622 then SLIT("_upd_entry")
623 else SLIT("_noupd_entry"))
626 pprCLbl (RtsLabel (RtsInfo fs))
627 = ptext fs <> ptext SLIT("_info")
629 pprCLbl (RtsLabel (RtsEntry fs))
630 = ptext fs <> ptext SLIT("_entry")
632 pprCLbl (RtsLabel (RtsRetInfo fs))
633 = ptext fs <> ptext SLIT("_info")
635 pprCLbl (RtsLabel (RtsRet fs))
636 = ptext fs <> ptext SLIT("_ret")
638 pprCLbl (RtsLabel (RtsInfoFS fs))
639 = ftext fs <> ptext SLIT("_info")
641 pprCLbl (RtsLabel (RtsEntryFS fs))
642 = ftext fs <> ptext SLIT("_entry")
644 pprCLbl (RtsLabel (RtsRetInfoFS fs))
645 = ftext fs <> ptext SLIT("_info")
647 pprCLbl (RtsLabel (RtsRetFS fs))
648 = ftext fs <> ptext SLIT("_ret")
650 pprCLbl (RtsLabel (RtsPrimOp primop))
651 = ppr primop <> ptext SLIT("_fast")
653 pprCLbl (RtsLabel (RtsSlowTickyCtr pat))
654 = ptext SLIT("SLOW_CALL_") <> text pat <> ptext SLIT("_ctr")
656 pprCLbl ModuleRegdLabel
657 = ptext SLIT("_module_registered")
659 pprCLbl (ForeignLabel str _ _)
662 pprCLbl (IdLabel id flavor) = ppr id <> ppIdFlavor flavor
664 pprCLbl (CC_Label cc) = ppr cc
665 pprCLbl (CCS_Label ccs) = ppr ccs
667 pprCLbl (ModuleInitLabel mod way)
668 = ptext SLIT("__stginit_") <> ftext (moduleNameFS (moduleName mod))
669 <> char '_' <> text way
670 pprCLbl (PlainModuleInitLabel mod)
671 = ptext SLIT("__stginit_") <> ftext (moduleNameFS (moduleName mod))
673 ppIdFlavor :: IdLabelInfo -> SDoc
674 ppIdFlavor x = pp_cSEP <>
676 Closure -> ptext SLIT("closure")
677 SRT -> ptext SLIT("srt")
678 SRTDesc -> ptext SLIT("srtd")
679 InfoTbl -> ptext SLIT("info")
680 Entry -> ptext SLIT("entry")
681 Slow -> ptext SLIT("slow")
682 RednCounts -> ptext SLIT("ct")
683 Bitmap -> ptext SLIT("btm")
684 ConEntry -> ptext SLIT("con_entry")
685 ConInfoTbl -> ptext SLIT("con_info")
686 StaticConEntry -> ptext SLIT("static_entry")
687 StaticInfoTbl -> ptext SLIT("static_info")
688 ClosureTable -> ptext SLIT("closure_tbl")
694 -- -----------------------------------------------------------------------------
695 -- Machine-dependent knowledge about labels.
697 underscorePrefix :: Bool -- leading underscore on assembler labels?
698 underscorePrefix = (cLeadingUnderscore == "YES")
700 asmTempLabelPrefix :: LitString -- for formatting labels
703 {- The alpha assembler likes temporary labels to look like $L123
704 instead of L123. (Don't toss the L, because then Lf28
708 #elif darwin_TARGET_OS
714 pprDynamicLinkerAsmLabel :: DynamicLinkerLabelInfo -> CLabel -> SDoc
717 pprDynamicLinkerAsmLabel SymbolPtr lbl
718 = char 'L' <> pprCLabel lbl <> text "$non_lazy_ptr"
719 pprDynamicLinkerAsmLabel CodeStub lbl
720 = char 'L' <> pprCLabel lbl <> text "$stub"
721 #elif powerpc_TARGET_ARCH && linux_TARGET_OS
722 pprDynamicLinkerAsmLabel CodeStub lbl
723 = pprCLabel lbl <> text "@plt"
724 pprDynamicLinkerAsmLabel SymbolPtr lbl
725 = text ".LC_" <> pprCLabel lbl
726 #elif linux_TARGET_OS
727 pprDynamicLinkerAsmLabel CodeStub lbl
728 = pprCLabel lbl <> text "@plt"
729 pprDynamicLinkerAsmLabel GotSymbolPtr lbl
730 = pprCLabel lbl <> text "@got"
731 pprDynamicLinkerAsmLabel GotSymbolOffset lbl
732 = pprCLabel lbl <> text "@gotoff"
733 #elif mingw32_TARGET_OS
734 pprDynamicLinkerAsmLabel SymbolPtr lbl
735 = text "__imp_" <> pprCLabel lbl
737 pprDynamicLinkerAsmLabel _ _
738 = panic "pprDynamicLinkerAsmLabel"