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

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
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
......
......@@ -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
......
......@@ -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)
......
......@@ -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'
#
......
......@@ -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@")
......
Markdown is supported
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