Commit 8387f019 authored by Simon Marlow's avatar Simon Marlow
Browse files

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.
parent d7d56f58
...@@ -192,6 +192,7 @@ initSysTools mbMinusB ...@@ -192,6 +192,7 @@ initSysTools mbMinusB
Nothing -> pgmError ("No entry for " ++ show key ++ " in " ++ show settingsFile) Nothing -> pgmError ("No entry for " ++ show key ++ " in " ++ show settingsFile)
; targetArch <- readSetting "target arch" ; targetArch <- readSetting "target arch"
; targetOS <- readSetting "target os" ; targetOS <- readSetting "target os"
; targetWordSize <- readSetting "target word size"
; targetHasGnuNonexecStack <- readSetting "target has GNU nonexec stack" ; targetHasGnuNonexecStack <- readSetting "target has GNU nonexec stack"
; targetHasIdentDirective <- readSetting "target has .ident directive" ; targetHasIdentDirective <- readSetting "target has .ident directive"
; targetHasSubsectionsViaSymbols <- readSetting "target has subsections via symbols" ; targetHasSubsectionsViaSymbols <- readSetting "target has subsections via symbols"
...@@ -257,6 +258,7 @@ initSysTools mbMinusB ...@@ -257,6 +258,7 @@ initSysTools mbMinusB
sTargetPlatform = Platform { sTargetPlatform = Platform {
platformArch = targetArch, platformArch = targetArch,
platformOS = targetOS, platformOS = targetOS,
platformWordSize = targetWordSize,
platformHasGnuNonexecStack = targetHasGnuNonexecStack, platformHasGnuNonexecStack = targetHasGnuNonexecStack,
platformHasIdentDirective = targetHasIdentDirective, platformHasIdentDirective = targetHasIdentDirective,
platformHasSubsectionsViaSymbols = targetHasSubsectionsViaSymbols platformHasSubsectionsViaSymbols = targetHasSubsectionsViaSymbols
......
...@@ -22,6 +22,7 @@ data Platform ...@@ -22,6 +22,7 @@ data Platform
= Platform { = Platform {
platformArch :: Arch, platformArch :: Arch,
platformOS :: OS, platformOS :: OS,
platformWordSize :: {-# UNPACK #-} !Int,
platformHasGnuNonexecStack :: Bool, platformHasGnuNonexecStack :: Bool,
platformHasIdentDirective :: Bool, platformHasIdentDirective :: Bool,
platformHasSubsectionsViaSymbols :: Bool platformHasSubsectionsViaSymbols :: Bool
...@@ -77,15 +78,7 @@ data ArmISAExt ...@@ -77,15 +78,7 @@ data ArmISAExt
target32Bit :: Platform -> Bool target32Bit :: Platform -> Bool
target32Bit p = case platformArch p of target32Bit p = platformWordSize p == 4
ArchUnknown -> panic "Don't know if ArchUnknown is 32bit"
ArchX86 -> True
ArchX86_64 -> False
ArchPPC -> True
ArchPPC_64 -> False
ArchSPARC -> True
ArchARM _ _ -> True
-- | This predicates tells us whether the OS supports ELF-like shared libraries. -- | This predicates tells us whether the OS supports ELF-like shared libraries.
osElfTarget :: OS -> Bool osElfTarget :: OS -> Bool
......
...@@ -574,6 +574,10 @@ fi ...@@ -574,6 +574,10 @@ fi
AC_CHECK_SIZEOF(unsigned short, 2) AC_CHECK_SIZEOF(unsigned short, 2)
AC_CHECK_SIZEOF(void *, 4) 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 dnl ** what are alignment constraints on various types
FP_CHECK_ALIGNMENT(char) FP_CHECK_ALIGNMENT(char)
FP_CHECK_ALIGNMENT(double) FP_CHECK_ALIGNMENT(double)
......
...@@ -90,6 +90,11 @@ FPTOOLS_SET_HASKELL_PLATFORM_VARS ...@@ -90,6 +90,11 @@ FPTOOLS_SET_HASKELL_PLATFORM_VARS
FP_SETTINGS 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' dnl ** how to invoke `ar' and `ranlib'
# #
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
("perl command", "@SettingsPerlCommand@"), ("perl command", "@SettingsPerlCommand@"),
("target os", "@HaskellTargetOs@"), ("target os", "@HaskellTargetOs@"),
("target arch", "@HaskellTargetArch@"), ("target arch", "@HaskellTargetArch@"),
("target word size", "@WordSize@"),
("target has GNU nonexec stack", "@HaskellHaveGnuNonexecStack@"), ("target has GNU nonexec stack", "@HaskellHaveGnuNonexecStack@"),
("target has .ident directive", "@HaskellHaveIdentDirective@"), ("target has .ident directive", "@HaskellHaveIdentDirective@"),
("target has subsections via symbols", "@HaskellHaveSubsectionsViaSymbols@") ("target has subsections via symbols", "@HaskellHaveSubsectionsViaSymbols@")
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment