diff options
author | Sylvain Henry <sylvain@haskus.fr> | 2020-03-18 16:37:25 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-05-06 04:43:21 -0400 |
commit | cab1871ab93feeacf2bf9a1c65b1c919ca9c5399 (patch) | |
tree | 1c8c7a535ca81d9f8ef26532425ff746b305cc13 | |
parent | a95e7fe02efd2fdeec91ba46de64bc78c81381eb (diff) | |
download | haskell-cab1871ab93feeacf2bf9a1c65b1c919ca9c5399.tar.gz |
Move LeadingUnderscore into Platform (#17957)
Avoid direct use of DynFlags to know if symbols must be prefixed by an
underscore.
-rw-r--r-- | compiler/GHC/Cmm/CLabel.hs | 2 | ||||
-rw-r--r-- | compiler/GHC/Driver/Session.hs | 1 | ||||
-rw-r--r-- | compiler/GHC/Settings.hs | 3 | ||||
-rw-r--r-- | compiler/GHC/Settings/IO.hs | 2 | ||||
-rw-r--r-- | libraries/ghc-boot/GHC/Platform.hs | 20 | ||||
-rw-r--r-- | libraries/ghc-boot/GHC/Settings/Platform.hs | 2 |
6 files changed, 13 insertions, 17 deletions
diff --git a/compiler/GHC/Cmm/CLabel.hs b/compiler/GHC/Cmm/CLabel.hs index 891384aa55..90e401d942 100644 --- a/compiler/GHC/Cmm/CLabel.hs +++ b/compiler/GHC/Cmm/CLabel.hs @@ -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 diff --git a/compiler/GHC/Driver/Session.hs b/compiler/GHC/Driver/Session.hs index 0b76ce47e3..ac099a61dd 100644 --- a/compiler/GHC/Driver/Session.hs +++ b/compiler/GHC/Driver/Session.hs @@ -135,7 +135,6 @@ module GHC.Driver.Session ( sGhcWithSMP, sGhcRTSWays, sTablesNextToCode, - sLeadingUnderscore, sLibFFI, sGhcThreaded, sGhcDebugged, diff --git a/compiler/GHC/Settings.hs b/compiler/GHC/Settings.hs index 08b108a291..df2f817393 100644 --- a/compiler/GHC/Settings.hs +++ b/compiler/GHC/Settings.hs @@ -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 diff --git a/compiler/GHC/Settings/IO.hs b/compiler/GHC/Settings/IO.hs index 225d5a6ec8..26ad17ce80 100644 --- a/compiler/GHC/Settings/IO.hs +++ b/compiler/GHC/Settings/IO.hs @@ -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 diff --git a/libraries/ghc-boot/GHC/Platform.hs b/libraries/ghc-boot/GHC/Platform.hs index 7af9cc0890..69978387ae 100644 --- a/libraries/ghc-boot/GHC/Platform.hs +++ b/libraries/ghc-boot/GHC/Platform.hs @@ -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 diff --git a/libraries/ghc-boot/GHC/Settings/Platform.hs b/libraries/ghc-boot/GHC/Settings/Platform.hs index f97fff6b6f..0f41974002 100644 --- a/libraries/ghc-boot/GHC/Settings/Platform.hs +++ b/libraries/ghc-boot/GHC/Settings/Platform.hs @@ -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 } ----------------------------------------------------------------------------- |