summaryrefslogtreecommitdiff
path: root/libraries/ghc-boot
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/ghc-boot')
-rw-r--r--libraries/ghc-boot/GHC/Platform.hs26
-rw-r--r--libraries/ghc-boot/GHC/Settings.hs2
2 files changed, 15 insertions, 13 deletions
diff --git a/libraries/ghc-boot/GHC/Platform.hs b/libraries/ghc-boot/GHC/Platform.hs
index f6a7060b3f..b5091ae8e8 100644
--- a/libraries/ghc-boot/GHC/Platform.hs
+++ b/libraries/ghc-boot/GHC/Platform.hs
@@ -12,6 +12,7 @@ module GHC.Platform (
ArmISAExt(..),
ArmABI(..),
PPC_64ABI(..),
+ ByteOrder(..),
target32Bit,
isARM,
@@ -38,6 +39,7 @@ where
import Prelude -- See Note [Why do we import Prelude here?]
import GHC.Read
+import GHC.ByteOrder (ByteOrder(..))
import Data.Word
import Data.Int
@@ -53,19 +55,17 @@ data PlatformMini
-- | Contains enough information for the native code generator to emit
-- code for this platform.
-data Platform
- = Platform {
- platformMini :: PlatformMini,
- -- Word size in bytes (i.e. normally 4 or 8,
- -- for 32bit and 64bit platforms respectively)
- platformWordSize :: PlatformWordSize,
- platformUnregisterised :: Bool,
- platformHasGnuNonexecStack :: Bool,
- platformHasIdentDirective :: Bool,
- platformHasSubsectionsViaSymbols :: Bool,
- platformIsCrossCompiling :: Bool
- }
- deriving (Read, Show, Eq)
+data Platform = Platform
+ { platformMini :: PlatformMini
+ , platformWordSize :: PlatformWordSize
+ , platformByteOrder :: ByteOrder
+ , platformUnregisterised :: Bool
+ , platformHasGnuNonexecStack :: Bool
+ , platformHasIdentDirective :: Bool
+ , platformHasSubsectionsViaSymbols :: Bool
+ , platformIsCrossCompiling :: Bool
+ }
+ deriving (Read, Show, Eq)
data PlatformWordSize
= PW4 -- ^ A 32-bit platform
diff --git a/libraries/ghc-boot/GHC/Settings.hs b/libraries/ghc-boot/GHC/Settings.hs
index 96680dc58e..fd0a0ef3ad 100644
--- a/libraries/ghc-boot/GHC/Settings.hs
+++ b/libraries/ghc-boot/GHC/Settings.hs
@@ -36,6 +36,7 @@ getTargetPlatform settingsFile mySettings = do
targetArch <- readSetting "target arch"
targetOS <- readSetting "target os"
targetWordSize <- readSetting "target word size"
+ targetWordBigEndian <- getBooleanSetting "target word big endian"
targetUnregisterised <- getBooleanSetting "Unregisterised"
targetHasGnuNonexecStack <- getBooleanSetting "target has GNU nonexec stack"
targetHasIdentDirective <- getBooleanSetting "target has .ident directive"
@@ -48,6 +49,7 @@ getTargetPlatform settingsFile mySettings = do
, platformMini_os = targetOS
}
, platformWordSize = targetWordSize
+ , platformByteOrder = if targetWordBigEndian then BigEndian else LittleEndian
, platformUnregisterised = targetUnregisterised
, platformHasGnuNonexecStack = targetHasGnuNonexecStack
, platformHasIdentDirective = targetHasIdentDirective