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

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