[commit: ghc] master: Store the word size as determined by configure, in the settings file (#5735) (8387f01)
Simon Marlow
marlowsd at gmail.com
Wed Jan 4 14:06:29 CET 2012
Repository : ssh://darcs.haskell.org//srv/darcs/ghc
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/8387f0198e7a925d9d0754b2befb021ffa1307d7
>---------------------------------------------------------------
commit 8387f0198e7a925d9d0754b2befb021ffa1307d7
Author: Simon Marlow <marlowsd at gmail.com>
Date: Wed Jan 4 11:37:47 2012 +0000
Store the word size as determined by configure, in the settings file (#5735)
Now target32bit works for all targets without any manual intervention,
as it should do. #5735 was a portability regression.
>---------------------------------------------------------------
compiler/main/SysTools.lhs | 2 ++
compiler/utils/Platform.hs | 11 ++---------
configure.ac | 4 ++++
distrib/configure.ac.in | 5 +++++
settings.in | 1 +
5 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/compiler/main/SysTools.lhs b/compiler/main/SysTools.lhs
index 23906c6..75b4d54 100644
--- a/compiler/main/SysTools.lhs
+++ b/compiler/main/SysTools.lhs
@@ -192,6 +192,7 @@ initSysTools mbMinusB
Nothing -> pgmError ("No entry for " ++ show key ++ " in " ++ show settingsFile)
; targetArch <- readSetting "target arch"
; targetOS <- readSetting "target os"
+ ; targetWordSize <- readSetting "target word size"
; targetHasGnuNonexecStack <- readSetting "target has GNU nonexec stack"
; targetHasIdentDirective <- readSetting "target has .ident directive"
; targetHasSubsectionsViaSymbols <- readSetting "target has subsections via symbols"
@@ -257,6 +258,7 @@ initSysTools mbMinusB
sTargetPlatform = Platform {
platformArch = targetArch,
platformOS = targetOS,
+ platformWordSize = targetWordSize,
platformHasGnuNonexecStack = targetHasGnuNonexecStack,
platformHasIdentDirective = targetHasIdentDirective,
platformHasSubsectionsViaSymbols = targetHasSubsectionsViaSymbols
diff --git a/compiler/utils/Platform.hs b/compiler/utils/Platform.hs
index 7253af1..68f46e7 100644
--- a/compiler/utils/Platform.hs
+++ b/compiler/utils/Platform.hs
@@ -22,6 +22,7 @@ data Platform
= Platform {
platformArch :: Arch,
platformOS :: OS,
+ platformWordSize :: {-# UNPACK #-} !Int,
platformHasGnuNonexecStack :: Bool,
platformHasIdentDirective :: Bool,
platformHasSubsectionsViaSymbols :: Bool
@@ -77,15 +78,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
diff --git a/configure.ac b/configure.ac
index 8d74707..eda926b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -574,6 +574,10 @@ fi
AC_CHECK_SIZEOF(unsigned short, 2)
AC_CHECK_SIZEOF(void *, 4)
+dnl for use in settings.in
+WordSize=$ac_cv_sizeof_void_p
+AC_SUBST(WordSize)
+
dnl ** what are alignment constraints on various types
FP_CHECK_ALIGNMENT(char)
FP_CHECK_ALIGNMENT(double)
diff --git a/distrib/configure.ac.in b/distrib/configure.ac.in
index a9fc134..458f5f4 100644
--- a/distrib/configure.ac.in
+++ b/distrib/configure.ac.in
@@ -90,6 +90,11 @@ FPTOOLS_SET_HASKELL_PLATFORM_VARS
FP_SETTINGS
+dnl WordSize for settings.in
+AC_CHECK_SIZEOF(void *, 4)
+WordSize=$ac_cv_sizeof_void_p
+AC_SUBST(WordSize)
+
#
dnl ** how to invoke `ar' and `ranlib'
#
diff --git a/settings.in b/settings.in
index 50062af..baf04d5 100644
--- a/settings.in
+++ b/settings.in
@@ -10,6 +10,7 @@
("perl command", "@SettingsPerlCommand@"),
("target os", "@HaskellTargetOs@"),
("target arch", "@HaskellTargetArch@"),
+ ("target word size", "@WordSize@"),
("target has GNU nonexec stack", "@HaskellHaveGnuNonexecStack@"),
("target has .ident directive", "@HaskellHaveIdentDirective@"),
("target has subsections via symbols", "@HaskellHaveSubsectionsViaSymbols@")
More information about the Cvs-ghc
mailing list