diff options
author | Simon Marlow <marlowsd@gmail.com> | 2012-01-04 11:37:47 +0000 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2012-01-04 12:47:28 +0000 |
commit | 8387f0198e7a925d9d0754b2befb021ffa1307d7 (patch) | |
tree | 2814bbf353bd5f8a8e781d847392430f40fcab15 | |
parent | d7d56f5852b975c865535495b45a8aba9a397c86 (diff) | |
download | haskell-8387f0198e7a925d9d0754b2befb021ffa1307d7.tar.gz |
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.
-rw-r--r-- | compiler/main/SysTools.lhs | 2 | ||||
-rw-r--r-- | compiler/utils/Platform.hs | 11 | ||||
-rw-r--r-- | configure.ac | 4 | ||||
-rw-r--r-- | distrib/configure.ac.in | 5 | ||||
-rw-r--r-- | settings.in | 1 |
5 files changed, 14 insertions, 9 deletions
diff --git a/compiler/main/SysTools.lhs b/compiler/main/SysTools.lhs index 23906c69bc..75b4d542a5 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 7253af1274..68f46e74c5 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 8d747075b0..eda926b97f 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 a9fc134021..458f5f433f 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 50062af013..baf04d5a23 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@") |