[commit: ghc] master: osElfTarget should default to False (#5733) (a8b8d65)
Simon Marlow
marlowsd at gmail.com
Wed Jan 4 14:06:31 CET 2012
Repository : ssh://darcs.haskell.org//srv/darcs/ghc
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/a8b8d657807ff89fb94aecaefd65b6ab3e3b39e0
>---------------------------------------------------------------
commit a8b8d657807ff89fb94aecaefd65b6ab3e3b39e0
Author: Simon Marlow <marlowsd at gmail.com>
Date: Wed Jan 4 11:39:55 2012 +0000
osElfTarget should default to False (#5733)
Another portabilty regression: before Platform we used to use elf_OBJ_FORMAT:
#if linux_TARGET_OS || freebsd_TARGET_OS || openbsd_TARGET_OS || solaris2_TARGET_OS
#define elf_OBJ_FORMAT 1
#endif
which defaults to undefined on unknown platforms. Defaulting to
non-ELF is correct, it just means that we won't rely on ELF-specific
functionality. I've added a comment to explain that.
>---------------------------------------------------------------
compiler/utils/Platform.hs | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/compiler/utils/Platform.hs b/compiler/utils/Platform.hs
index 68f46e7..10b19fe 100644
--- a/compiler/utils/Platform.hs
+++ b/compiler/utils/Platform.hs
@@ -14,8 +14,6 @@ module Platform (
where
-import Panic
-
-- | Contains enough information for the native code generator to emit
-- code for this platform.
data Platform
@@ -89,5 +87,8 @@ osElfTarget OSNetBSD = True
osElfTarget OSSolaris2 = True
osElfTarget OSDarwin = False
osElfTarget OSMinGW32 = False
-osElfTarget OSUnknown = panic "Don't know if OSUnknown is elf"
-
+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).
More information about the Cvs-ghc
mailing list