Commit cab1871a authored by Sylvain Henry's avatar Sylvain Henry Committed by Marge Bot
Browse files

Move LeadingUnderscore into Platform (#17957)

Avoid direct use of DynFlags to know if symbols must be prefixed by an
underscore.
parent a95e7fe0
...@@ -1218,7 +1218,7 @@ pprCLabel dflags = \case ...@@ -1218,7 +1218,7 @@ pprCLabel dflags = \case
maybe_underscore :: SDoc -> SDoc maybe_underscore :: SDoc -> SDoc
maybe_underscore doc = maybe_underscore doc =
if platformMisc_leadingUnderscore $ platformMisc dflags if platformLeadingUnderscore platform
then pp_cSEP <> doc then pp_cSEP <> doc
else doc else doc
......
...@@ -135,7 +135,6 @@ module GHC.Driver.Session ( ...@@ -135,7 +135,6 @@ module GHC.Driver.Session (
sGhcWithSMP, sGhcWithSMP,
sGhcRTSWays, sGhcRTSWays,
sTablesNextToCode, sTablesNextToCode,
sLeadingUnderscore,
sLibFFI, sLibFFI,
sGhcThreaded, sGhcThreaded,
sGhcDebugged, sGhcDebugged,
......
...@@ -62,7 +62,6 @@ module GHC.Settings ...@@ -62,7 +62,6 @@ module GHC.Settings
, sGhcWithSMP , sGhcWithSMP
, sGhcRTSWays , sGhcRTSWays
, sTablesNextToCode , sTablesNextToCode
, sLeadingUnderscore
, sLibFFI , sLibFFI
, sGhcThreaded , sGhcThreaded
, sGhcDebugged , sGhcDebugged
...@@ -277,8 +276,6 @@ sGhcRTSWays :: Settings -> String ...@@ -277,8 +276,6 @@ sGhcRTSWays :: Settings -> String
sGhcRTSWays = platformMisc_ghcRTSWays . sPlatformMisc sGhcRTSWays = platformMisc_ghcRTSWays . sPlatformMisc
sTablesNextToCode :: Settings -> Bool sTablesNextToCode :: Settings -> Bool
sTablesNextToCode = platformMisc_tablesNextToCode . sPlatformMisc sTablesNextToCode = platformMisc_tablesNextToCode . sPlatformMisc
sLeadingUnderscore :: Settings -> Bool
sLeadingUnderscore = platformMisc_leadingUnderscore . sPlatformMisc
sLibFFI :: Settings -> Bool sLibFFI :: Settings -> Bool
sLibFFI = platformMisc_libFFI . sPlatformMisc sLibFFI = platformMisc_libFFI . sPlatformMisc
sGhcThreaded :: Settings -> Bool sGhcThreaded :: Settings -> Bool
......
...@@ -166,7 +166,6 @@ initSettings top_dir = do ...@@ -166,7 +166,6 @@ initSettings top_dir = do
ghcWithNativeCodeGen <- getBooleanSetting "Use native code generator" ghcWithNativeCodeGen <- getBooleanSetting "Use native code generator"
ghcWithSMP <- getBooleanSetting "Support SMP" ghcWithSMP <- getBooleanSetting "Support SMP"
ghcRTSWays <- getSetting "RTS ways" ghcRTSWays <- getSetting "RTS ways"
leadingUnderscore <- getBooleanSetting "Leading underscore"
useLibFFI <- getBooleanSetting "Use LibFFI" useLibFFI <- getBooleanSetting "Use LibFFI"
ghcThreaded <- getBooleanSetting "Use Threads" ghcThreaded <- getBooleanSetting "Use Threads"
ghcDebugged <- getBooleanSetting "Use Debugging" ghcDebugged <- getBooleanSetting "Use Debugging"
...@@ -237,7 +236,6 @@ initSettings top_dir = do ...@@ -237,7 +236,6 @@ initSettings top_dir = do
, platformMisc_ghcWithSMP = ghcWithSMP , platformMisc_ghcWithSMP = ghcWithSMP
, platformMisc_ghcRTSWays = ghcRTSWays , platformMisc_ghcRTSWays = ghcRTSWays
, platformMisc_tablesNextToCode = tablesNextToCode , platformMisc_tablesNextToCode = tablesNextToCode
, platformMisc_leadingUnderscore = leadingUnderscore
, platformMisc_libFFI = useLibFFI , platformMisc_libFFI = useLibFFI
, platformMisc_ghcThreaded = ghcThreaded , platformMisc_ghcThreaded = ghcThreaded
, platformMisc_ghcDebugged = ghcDebugged , platformMisc_ghcDebugged = ghcDebugged
......
...@@ -55,16 +55,17 @@ data PlatformMini ...@@ -55,16 +55,17 @@ data PlatformMini
deriving (Read, Show, Eq) deriving (Read, Show, Eq)
-- | Contains enough information for the native code generator to emit -- | Contains enough information for the native code generator to emit
-- code for this platform. -- code for this platform.
data Platform = Platform data Platform = Platform
{ platformMini :: PlatformMini { platformMini :: !PlatformMini
, platformWordSize :: PlatformWordSize , platformWordSize :: !PlatformWordSize -- ^ Word size
, platformByteOrder :: ByteOrder , platformByteOrder :: !ByteOrder -- ^ Byte order (endianness)
, platformUnregisterised :: Bool , platformUnregisterised :: !Bool
, platformHasGnuNonexecStack :: Bool , platformHasGnuNonexecStack :: !Bool
, platformHasIdentDirective :: Bool , platformHasIdentDirective :: !Bool
, platformHasSubsectionsViaSymbols :: Bool , platformHasSubsectionsViaSymbols :: !Bool
, platformIsCrossCompiling :: Bool , platformIsCrossCompiling :: !Bool
, platformLeadingUnderscore :: !Bool -- ^ Symbols need underscore prefix
} }
deriving (Read, Show, Eq) deriving (Read, Show, Eq)
...@@ -301,7 +302,6 @@ data PlatformMisc = PlatformMisc ...@@ -301,7 +302,6 @@ data PlatformMisc = PlatformMisc
-- before the entry code, or with an indirection to the entry code. See -- before the entry code, or with an indirection to the entry code. See
-- TABLES_NEXT_TO_CODE in includes/rts/storage/InfoTables.h. -- TABLES_NEXT_TO_CODE in includes/rts/storage/InfoTables.h.
, platformMisc_tablesNextToCode :: Bool , platformMisc_tablesNextToCode :: Bool
, platformMisc_leadingUnderscore :: Bool
, platformMisc_libFFI :: Bool , platformMisc_libFFI :: Bool
, platformMisc_ghcThreaded :: Bool , platformMisc_ghcThreaded :: Bool
, platformMisc_ghcDebugged :: Bool , platformMisc_ghcDebugged :: Bool
......
...@@ -37,6 +37,7 @@ getTargetPlatform settingsFile mySettings = do ...@@ -37,6 +37,7 @@ getTargetPlatform settingsFile mySettings = do
targetOS <- readSetting "target os" targetOS <- readSetting "target os"
targetWordSize <- readSetting "target word size" targetWordSize <- readSetting "target word size"
targetWordBigEndian <- getBooleanSetting "target word big endian" targetWordBigEndian <- getBooleanSetting "target word big endian"
targetLeadingUnderscore <- getBooleanSetting "Leading underscore"
targetUnregisterised <- getBooleanSetting "Unregisterised" targetUnregisterised <- getBooleanSetting "Unregisterised"
targetHasGnuNonexecStack <- getBooleanSetting "target has GNU nonexec stack" targetHasGnuNonexecStack <- getBooleanSetting "target has GNU nonexec stack"
targetHasIdentDirective <- getBooleanSetting "target has .ident directive" targetHasIdentDirective <- getBooleanSetting "target has .ident directive"
...@@ -55,6 +56,7 @@ getTargetPlatform settingsFile mySettings = do ...@@ -55,6 +56,7 @@ getTargetPlatform settingsFile mySettings = do
, platformHasIdentDirective = targetHasIdentDirective , platformHasIdentDirective = targetHasIdentDirective
, platformHasSubsectionsViaSymbols = targetHasSubsectionsViaSymbols , platformHasSubsectionsViaSymbols = targetHasSubsectionsViaSymbols
, platformIsCrossCompiling = crossCompiling , platformIsCrossCompiling = crossCompiling
, platformLeadingUnderscore = targetLeadingUnderscore
} }
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment