summaryrefslogtreecommitdiff
path: root/libraries/ghc-boot
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2020-07-07 13:16:47 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-07-25 00:45:08 -0400
commit6333d7391068d8029eed3e8eff019b9e2c104c7b (patch)
treeed9c42bf6df586a976db83ff448b3efd16ef9764 /libraries/ghc-boot
parent342a01af624840ba94f22256079ff4f3cee09ca2 (diff)
downloadhaskell-6333d7391068d8029eed3e8eff019b9e2c104c7b.tar.gz
Put PlatformConstants into Platform
Diffstat (limited to 'libraries/ghc-boot')
-rw-r--r--libraries/ghc-boot/GHC/Platform.hs4
-rw-r--r--libraries/ghc-boot/GHC/Settings/Platform.hs8
-rw-r--r--libraries/ghc-boot/ghc-boot.cabal.in2
3 files changed, 12 insertions, 2 deletions
diff --git a/libraries/ghc-boot/GHC/Platform.hs b/libraries/ghc-boot/GHC/Platform.hs
index 326b93f9fa..9191dda44f 100644
--- a/libraries/ghc-boot/GHC/Platform.hs
+++ b/libraries/ghc-boot/GHC/Platform.hs
@@ -5,6 +5,7 @@
module GHC.Platform
( PlatformMini(..)
, PlatformWordSize(..)
+ , PlatformConstants(..)
, Platform(..)
, platformArch
, platformOS
@@ -39,6 +40,7 @@ where
import Prelude -- See Note [Why do we import Prelude here?]
import GHC.Read
import GHC.ByteOrder (ByteOrder(..))
+import GHC.Platform.Constants
import Data.Word
import Data.Int
@@ -68,6 +70,8 @@ data Platform = Platform
-- ^ Determines whether we will be compiling info tables that reside just
-- before the entry code, or with an indirection to the entry code. See
-- TABLES_NEXT_TO_CODE in includes/rts/storage/InfoTables.h.
+ , platformConstants :: !PlatformConstants
+ -- ^ Constants such as structure offsets, type sizes, etc.
}
deriving (Read, Show, Eq)
diff --git a/libraries/ghc-boot/GHC/Settings/Platform.hs b/libraries/ghc-boot/GHC/Settings/Platform.hs
index bfe9b53dc5..95278da76e 100644
--- a/libraries/ghc-boot/GHC/Settings/Platform.hs
+++ b/libraries/ghc-boot/GHC/Settings/Platform.hs
@@ -26,8 +26,11 @@ import qualified Data.Map as Map
-- parts of settings file
getTargetPlatform
- :: FilePath -> RawSettings -> Either String Platform
-getTargetPlatform settingsFile mySettings = do
+ :: FilePath -- ^ Settings filepath (for error messages)
+ -> RawSettings -- ^ Raw settings file contents
+ -> PlatformConstants -- ^ Platform constants
+ -> Either String Platform
+getTargetPlatform settingsFile mySettings constants = do
let
getBooleanSetting = getBooleanSetting0 settingsFile mySettings
readSetting :: (Show a, Read a) => String -> Either String a
@@ -59,6 +62,7 @@ getTargetPlatform settingsFile mySettings = do
, platformIsCrossCompiling = crossCompiling
, platformLeadingUnderscore = targetLeadingUnderscore
, platformTablesNextToCode = tablesNextToCode
+ , platformConstants = constants
}
-----------------------------------------------------------------------------
diff --git a/libraries/ghc-boot/ghc-boot.cabal.in b/libraries/ghc-boot/ghc-boot.cabal.in
index bf68363827..aed65d8f0a 100644
--- a/libraries/ghc-boot/ghc-boot.cabal.in
+++ b/libraries/ghc-boot/ghc-boot.cabal.in
@@ -45,6 +45,7 @@ Library
GHC.HandleEncoding
GHC.Platform
GHC.Platform.Host
+ GHC.Platform.Constants
GHC.Settings.Platform
GHC.Settings.Utils
GHC.UniqueSubdir
@@ -54,6 +55,7 @@ Library
-- autogen-modules:
-- GHC.Version
-- GHC.Platform.Host
+ -- GHC.Platform.Constants
build-depends: base >= 4.7 && < 4.16,
binary == 0.8.*,