summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compiler/HsVersions.h2
-rw-r--r--compiler/main/DriverPipeline.hs6
-rw-r--r--compiler/main/DynFlags.hs12
-rw-r--r--hadrian/src/Rules/Generate.hs7
-rw-r--r--includes/rts/storage/InfoTables.h8
-rw-r--r--includes/stg/HaskellMachRegs.h16
-rw-r--r--rts/PrimOps.cmm4
-rw-r--r--utils/genapply/Main.hs4
-rw-r--r--utils/ghc-pkg/ghc.mk4
9 files changed, 33 insertions, 30 deletions
diff --git a/compiler/HsVersions.h b/compiler/HsVersions.h
index a4ec3e4c40..992c4377cd 100644
--- a/compiler/HsVersions.h
+++ b/compiler/HsVersions.h
@@ -12,7 +12,7 @@ you will screw up the layout where they are used in case expressions!
/* Useful in the headers that we share with the RTS */
#define COMPILING_GHC 1
-/* Pull in all the platform defines for this build (foo_TARGET_ARCH etc.) */
+/* Pull in all the platform defines for this build (foo_HOST_ARCH etc.) */
#include "ghc_boot_platform.h"
/* Pull in the autoconf defines (HAVE_FOO), but don't include
diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs
index 74bc64ede3..17c8f480d9 100644
--- a/compiler/main/DriverPipeline.hs
+++ b/compiler/main/DriverPipeline.hs
@@ -1962,11 +1962,13 @@ doCpp dflags raw input_fn output_fn = do
let cpp_prog args | raw = SysTools.runCpp dflags args
| otherwise = SysTools.runCc Nothing dflags (SysTools.Option "-E" : args)
+ let targetArch = stringEncodeArch $ platformArch $ targetPlatform dflags
+ targetOS = stringEncodeOS $ platformOS $ targetPlatform dflags
let target_defs =
[ "-D" ++ HOST_OS ++ "_BUILD_OS",
"-D" ++ HOST_ARCH ++ "_BUILD_ARCH",
- "-D" ++ TARGET_OS ++ "_HOST_OS",
- "-D" ++ TARGET_ARCH ++ "_HOST_ARCH" ]
+ "-D" ++ targetOS ++ "_HOST_OS",
+ "-D" ++ targetArch ++ "_HOST_ARCH" ]
-- remember, in code we *compile*, the HOST is the same our TARGET,
-- and BUILD is the same as our HOST.
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs
index fcc5cfb1a0..2379f484e9 100644
--- a/compiler/main/DynFlags.hs
+++ b/compiler/main/DynFlags.hs
@@ -1503,9 +1503,11 @@ versionedAppDir dflags = do
-- constructing platform-version-dependent files that need to co-exist.
--
versionedFilePath :: DynFlags -> FilePath
-versionedFilePath dflags = TARGET_ARCH
- ++ '-':TARGET_OS
- ++ '-':projectVersion dflags
+versionedFilePath dflags = intercalate "-"
+ [ stringEncodeArch $ platformArch $ targetPlatform dflags
+ , stringEncodeOS $ platformOS $ targetPlatform dflags
+ , projectVersion dflags
+ ]
-- NB: This functionality is reimplemented in Cabal, so if you
-- change it, be sure to update Cabal.
@@ -5503,7 +5505,7 @@ addIncludePath p =
addFrameworkPath p =
upd (\s -> s{frameworkPaths = frameworkPaths s ++ splitPathList p})
-#if !defined(mingw32_TARGET_OS)
+#if !defined(mingw32_HOST_OS)
split_marker :: Char
split_marker = ':' -- not configurable (ToDo)
#endif
@@ -5515,7 +5517,7 @@ splitPathList s = filter notNull (splitUp s)
-- cause confusion when they are translated into -I options
-- for passing to gcc.
where
-#if !defined(mingw32_TARGET_OS)
+#if !defined(mingw32_HOST_OS)
splitUp xs = split split_marker xs
#else
-- Windows: 'hybrid' support for DOS-style paths in directory lists.
diff --git a/hadrian/src/Rules/Generate.hs b/hadrian/src/Rules/Generate.hs
index e1e64d1a1a..edf6783055 100644
--- a/hadrian/src/Rules/Generate.hs
+++ b/hadrian/src/Rules/Generate.hs
@@ -493,11 +493,8 @@ generateVersionHs :: Expr String
generateVersionHs = do
trackGenerateHs
projectVersion <- getSetting ProjectVersion
- targetOs <- getSetting TargetOs
- targetArch <- getSetting TargetArch
return $ unlines
[ "module Version where"
- , "version, targetOS, targetARCH :: String"
+ , "version :: String"
, "version = " ++ show projectVersion
- , "targetOS = " ++ show targetOs
- , "targetARCH = " ++ show targetArch ]
+ ]
diff --git a/includes/rts/storage/InfoTables.h b/includes/rts/storage/InfoTables.h
index 5c8296a351..4de5207b4d 100644
--- a/includes/rts/storage/InfoTables.h
+++ b/includes/rts/storage/InfoTables.h
@@ -27,7 +27,7 @@
hackery can go away sometime.
------------------------------------------------------------------------- */
-#if defined(x86_64_TARGET_ARCH)
+#if defined(x86_64_HOST_ARCH)
#define OFFSET_FIELD(n) StgHalfInt n; StgHalfWord __pad_##n
#else
#define OFFSET_FIELD(n) StgInt n
@@ -153,7 +153,7 @@ typedef union {
} StgClosureInfo;
-#if defined(x86_64_TARGET_ARCH) && defined(TABLES_NEXT_TO_CODE)
+#if defined(x86_64_HOST_ARCH) && defined(TABLES_NEXT_TO_CODE)
// On x86_64 we can fit a pointer offset in half a word, so put the SRT offset
// in the info->srt field directly.
//
@@ -338,7 +338,7 @@ typedef struct StgConInfoTable_ {
* info must be a Stg[Ret|Thunk]InfoTable* (an info table that has a SRT)
*/
#if defined(TABLES_NEXT_TO_CODE)
-#if defined(x86_64_TARGET_ARCH)
+#if defined(x86_64_HOST_ARCH)
#define GET_SRT(info) \
((StgClosure*) (((StgWord) ((info)+1)) + (info)->i.srt))
#else
@@ -365,7 +365,7 @@ typedef struct StgConInfoTable_ {
* info must be a StgFunInfoTable*
*/
#if defined(TABLES_NEXT_TO_CODE)
-#if defined(x86_64_TARGET_ARCH)
+#if defined(x86_64_HOST_ARCH)
#define GET_FUN_SRT(info) \
((StgClosure*) (((StgWord) ((info)+1)) + (info)->i.srt))
#else
diff --git a/includes/stg/HaskellMachRegs.h b/includes/stg/HaskellMachRegs.h
index 7b12d12814..917365778b 100644
--- a/includes/stg/HaskellMachRegs.h
+++ b/includes/stg/HaskellMachRegs.h
@@ -32,32 +32,32 @@
#define MACHREGS_NO_REGS 0
-#if defined(i386_TARGET_ARCH)
+#if defined(i386_HOST_ARCH)
#define MACHREGS_i386 1
#endif
-#if defined(x86_64_TARGET_ARCH)
+#if defined(x86_64_HOST_ARCH)
#define MACHREGS_x86_64 1
#endif
-#if defined(powerpc_TARGET_ARCH) || defined(powerpc64_TARGET_ARCH) \
- || defined(powerpc64le_TARGET_ARCH) || defined(rs6000_TARGET_ARCH)
+#if defined(powerpc_HOST_ARCH) || defined(powerpc64_HOST_ARCH) \
+ || defined(powerpc64le_HOST_ARCH) || defined(rs6000_HOST_ARCH)
#define MACHREGS_powerpc 1
#endif
-#if defined(sparc_TARGET_ARCH)
+#if defined(sparc_HOST_ARCH)
#define MACHREGS_sparc 1
#endif
-#if defined(arm_TARGET_ARCH)
+#if defined(arm_HOST_ARCH)
#define MACHREGS_arm 1
#endif
-#if defined(aarch64_TARGET_ARCH)
+#if defined(aarch64_HOST_ARCH)
#define MACHREGS_aarch64 1
#endif
-#if defined(darwin_TARGET_OS)
+#if defined(darwin_HOST_OS)
#define MACHREGS_darwin 1
#endif
diff --git a/rts/PrimOps.cmm b/rts/PrimOps.cmm
index afb990dda5..d9a28d7396 100644
--- a/rts/PrimOps.cmm
+++ b/rts/PrimOps.cmm
@@ -2440,7 +2440,7 @@ stg_traceEventzh ( W_ msg )
// We should go through the macro HASKELLEVENT_USER_MSG_ENABLED from
// RtsProbes.h, but that header file includes unistd.h, which doesn't
// work in Cmm
-#if !defined(solaris2_TARGET_OS)
+#if !defined(solaris2_HOST_OS)
(enabled) = ccall __dtrace_isenabled$HaskellEvent$user__msg$v1();
#else
// Solaris' DTrace can't handle the
@@ -2482,7 +2482,7 @@ stg_traceMarkerzh ( W_ msg )
W_ enabled;
-#if !defined(solaris2_TARGET_OS)
+#if !defined(solaris2_HOST_OS)
(enabled) = ccall __dtrace_isenabled$HaskellEvent$user__marker$v1();
#else
enabled = 1;
diff --git a/utils/genapply/Main.hs b/utils/genapply/Main.hs
index f35897ba9d..270bc61615 100644
--- a/utils/genapply/Main.hs
+++ b/utils/genapply/Main.hs
@@ -12,8 +12,12 @@
-- for details
module Main(main) where
+-- We improperly include *HOST* macros for our target...
#include "../../includes/ghcconfig.h"
+
+-- .. so that this header defines the right stuff.
#include "../../includes/stg/HaskellMachRegs.h"
+
#include "../../includes/rts/Constants.h"
-- Needed for TAG_BITS
diff --git a/utils/ghc-pkg/ghc.mk b/utils/ghc-pkg/ghc.mk
index 37ce0a7c5b..32e18f490d 100644
--- a/utils/ghc-pkg/ghc.mk
+++ b/utils/ghc-pkg/ghc.mk
@@ -17,10 +17,8 @@ utils/ghc-pkg/dist/build/Version.hs \
utils/ghc-pkg/dist-install/build/Version.hs: mk/project.mk | $$(dir $$@)/.
$(call removeFiles,$@)
echo "module Version where" >> $@
- echo "version, targetOS, targetARCH :: String" >> $@
+ echo "version :: String" >> $@
echo "version = \"$(ProjectVersion)\"" >> $@
- echo "targetOS = \"$(TargetOS_CPP)\"" >> $@
- echo "targetARCH = \"$(TargetArch_CPP)\"" >> $@
utils/ghc-pkg_PACKAGE = ghc-pkg