X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2Fcmm%2FCLabel.hs;h=e73232176b5d017b0aa8418bc77953202850f7f6;hb=153b9cb9b11e05c4edb1b6bc0a7b972660e41f70;hp=a18755f689c3ceb5006d93afa497e7d3e89ad3ad;hpb=ef5b4b146aa172d8ac10f39b5eb3d7a0f948d8f1;p=ghc-hetmet.git diff --git a/ghc/compiler/cmm/CLabel.hs b/ghc/compiler/cmm/CLabel.hs index a18755f..e732321 100644 --- a/ghc/compiler/cmm/CLabel.hs +++ b/ghc/compiler/cmm/CLabel.hs @@ -87,6 +87,7 @@ module CLabel ( dynamicLinkerLabelInfo, mkPicBaseLabel, + mkDeadStripPreventer, infoLblToEntryLbl, entryLblToInfoLbl, needsCDecl, isAsmTemp, externallyVisibleCLabel, @@ -97,13 +98,12 @@ module CLabel ( #include "HsVersions.h" -#include "../includes/ghcconfig.h" import CmdLineOpts ( DynFlags, opt_Static, opt_DoTickyProfiling ) -import Packages ( isHomeModule ) +import Packages ( isHomeModule, isDllName ) import DataCon ( ConTag ) import Module ( moduleFS, Module ) -import Name ( Name, isExternalName, nameModule ) +import Name ( Name, isExternalName ) import Unique ( pprUnique, Unique ) import PrimOp ( PrimOp ) import Config ( cLeadingUnderscore ) @@ -196,6 +196,10 @@ data CLabel -- 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 @@ -283,24 +287,20 @@ mkLocalEntryLabel name = IdLabel name Entry mkLocalClosureTableLabel name = IdLabel name ClosureTable mkClosureLabel dflags name - | opt_Static || isHomeModule dflags mod = IdLabel name Closure - | otherwise = DynIdLabel name Closure - where mod = nameModule name + | isDllName dflags name = DynIdLabel name Closure + | otherwise = IdLabel name Closure mkInfoTableLabel dflags name - | opt_Static || isHomeModule dflags mod = IdLabel name InfoTable - | otherwise = DynIdLabel name InfoTable - where mod = nameModule name + | isDllName dflags name = DynIdLabel name InfoTable + | otherwise = IdLabel name InfoTable mkEntryLabel dflags name - | opt_Static || isHomeModule dflags mod = IdLabel name Entry - | otherwise = DynIdLabel name Entry - where mod = nameModule name + | isDllName dflags name = DynIdLabel name Entry + | otherwise = IdLabel name Entry mkClosureTableLabel dflags name - | opt_Static || isHomeModule dflags mod = IdLabel name ClosureTable - | otherwise = DynIdLabel name ClosureTable - where mod = nameModule name + | isDllName dflags name = DynIdLabel name ClosureTable + | otherwise = IdLabel name ClosureTable mkLocalConInfoTableLabel con = IdLabel con ConInfoTable mkLocalConEntryLabel con = IdLabel con ConEntry @@ -314,14 +314,12 @@ mkStaticInfoTableLabel name False = IdLabel name StaticInfoTable mkStaticInfoTableLabel name True = DynIdLabel name StaticInfoTable mkConEntryLabel dflags name - | opt_Static || isHomeModule dflags mod = IdLabel name ConEntry - | otherwise = DynIdLabel name ConEntry - where mod = nameModule name + | isDllName dflags name = DynIdLabel name ConEntry + | otherwise = IdLabel name ConEntry mkStaticConEntryLabel dflags name - | opt_Static || isHomeModule dflags mod = IdLabel name StaticConEntry - | otherwise = DynIdLabel name StaticConEntry - where mod = nameModule name + | isDllName dflags name = DynIdLabel name StaticConEntry + | otherwise = IdLabel name StaticConEntry mkReturnPtLabel uniq = CaseLabel uniq CaseReturnPt @@ -407,6 +405,9 @@ dynamicLinkerLabelInfo _ = Nothing mkPicBaseLabel :: CLabel mkPicBaseLabel = PicBaseLabel +mkDeadStripPreventer :: CLabel -> CLabel +mkDeadStripPreventer lbl = DeadStripPreventer lbl + -- ----------------------------------------------------------------------------- -- Converting info labels to entry labels. @@ -624,6 +625,9 @@ pprCLabel (DynamicLinkerLabel info lbl) pprCLabel PicBaseLabel = ptext SLIT("1b") + +pprCLabel (DeadStripPreventer lbl) + = pprCLabel lbl <> ptext SLIT("_dsp") #endif pprCLabel lbl = @@ -801,6 +805,8 @@ 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