summaryrefslogtreecommitdiff
path: root/compiler/utils/Platform.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/utils/Platform.hs')
-rw-r--r--compiler/utils/Platform.hs22
1 files changed, 9 insertions, 13 deletions
diff --git a/compiler/utils/Platform.hs b/compiler/utils/Platform.hs
index 7253af1274..7045f4b521 100644
--- a/compiler/utils/Platform.hs
+++ b/compiler/utils/Platform.hs
@@ -14,14 +14,13 @@ module Platform (
where
-import Panic
-
-- | Contains enough information for the native code generator to emit
-- code for this platform.
data Platform
= Platform {
platformArch :: Arch,
platformOS :: OS,
+ platformWordSize :: {-# UNPACK #-} !Int,
platformHasGnuNonexecStack :: Bool,
platformHasIdentDirective :: Bool,
platformHasSubsectionsViaSymbols :: Bool
@@ -57,6 +56,7 @@ data OS
| OSFreeBSD
| OSOpenBSD
| OSNetBSD
+ | OSKFreeBSD
deriving (Read, Show, Eq)
-- | ARM Instruction Set Architecture and Extensions
@@ -77,15 +77,7 @@ data ArmISAExt
target32Bit :: Platform -> Bool
-target32Bit p = case platformArch p of
- ArchUnknown -> panic "Don't know if ArchUnknown is 32bit"
- ArchX86 -> True
- ArchX86_64 -> False
- ArchPPC -> True
- ArchPPC_64 -> False
- ArchSPARC -> True
- ArchARM _ _ -> True
-
+target32Bit p = platformWordSize p == 4
-- | This predicates tells us whether the OS supports ELF-like shared libraries.
osElfTarget :: OS -> Bool
@@ -96,5 +88,9 @@ osElfTarget OSNetBSD = True
osElfTarget OSSolaris2 = True
osElfTarget OSDarwin = False
osElfTarget OSMinGW32 = False
-osElfTarget OSUnknown = panic "Don't know if OSUnknown is elf"
-
+osElfTarget OSKFreeBSD = True
+osElfTarget OSUnknown = False
+ -- Defaulting to False is safe; it means don't rely on any
+ -- ELF-specific functionality. It is important to have a default for
+ -- portability, otherwise we have to answer this question for every
+ -- new platform we compile on (even unreg).