Commit b95b6380 authored by John Ericson's avatar John Ericson Committed by Marge Bot

Make stage 1 GHC target independent

Now that the target macros are not being used, we remove them. This
prevents target hardcoding regressions.
parent 3dbcc368
Pipeline #8730 failed with stages
in 422 minutes and 19 seconds
...@@ -101,28 +101,21 @@ compiler/stage1/$(PLATFORM_H) : mk/config.mk mk/project.mk | $$(dir $$@)/. ...@@ -101,28 +101,21 @@ compiler/stage1/$(PLATFORM_H) : mk/config.mk mk/project.mk | $$(dir $$@)/.
@echo >> $@ @echo >> $@
@echo "#define $(BuildPlatform_CPP)_BUILD 1" >> $@ @echo "#define $(BuildPlatform_CPP)_BUILD 1" >> $@
@echo "#define $(HostPlatform_CPP)_HOST 1" >> $@ @echo "#define $(HostPlatform_CPP)_HOST 1" >> $@
@echo "#define $(TargetPlatform_CPP)_TARGET 1" >> $@
@echo >> $@ @echo >> $@
@echo "#define $(BuildArch_CPP)_BUILD_ARCH 1" >> $@ @echo "#define $(BuildArch_CPP)_BUILD_ARCH 1" >> $@
@echo "#define $(HostArch_CPP)_HOST_ARCH 1" >> $@ @echo "#define $(HostArch_CPP)_HOST_ARCH 1" >> $@
@echo "#define $(TargetArch_CPP)_TARGET_ARCH 1" >> $@
@echo "#define BUILD_ARCH \"$(BuildArch_CPP)\"" >> $@ @echo "#define BUILD_ARCH \"$(BuildArch_CPP)\"" >> $@
@echo "#define HOST_ARCH \"$(HostArch_CPP)\"" >> $@ @echo "#define HOST_ARCH \"$(HostArch_CPP)\"" >> $@
@echo "#define TARGET_ARCH \"$(TargetArch_CPP)\"" >> $@
@echo >> $@ @echo >> $@
@echo "#define $(BuildOS_CPP)_BUILD_OS 1" >> $@ @echo "#define $(BuildOS_CPP)_BUILD_OS 1" >> $@
@echo "#define $(HostOS_CPP)_HOST_OS 1" >> $@ @echo "#define $(HostOS_CPP)_HOST_OS 1" >> $@
@echo "#define $(TargetOS_CPP)_TARGET_OS 1" >> $@
@echo "#define BUILD_OS \"$(BuildOS_CPP)\"" >> $@ @echo "#define BUILD_OS \"$(BuildOS_CPP)\"" >> $@
@echo "#define HOST_OS \"$(HostOS_CPP)\"" >> $@ @echo "#define HOST_OS \"$(HostOS_CPP)\"" >> $@
@echo "#define TARGET_OS \"$(TargetOS_CPP)\"" >> $@
@echo >> $@ @echo >> $@
@echo "#define $(BuildVendor_CPP)_BUILD_VENDOR 1" >> $@ @echo "#define $(BuildVendor_CPP)_BUILD_VENDOR 1" >> $@
@echo "#define $(HostVendor_CPP)_HOST_VENDOR 1" >> $@ @echo "#define $(HostVendor_CPP)_HOST_VENDOR 1" >> $@
@echo "#define $(TargetVendor_CPP)_TARGET_VENDOR 1" >> $@
@echo "#define BUILD_VENDOR \"$(BuildVendor_CPP)\"" >> $@ @echo "#define BUILD_VENDOR \"$(BuildVendor_CPP)\"" >> $@
@echo "#define HOST_VENDOR \"$(HostVendor_CPP)\"" >> $@ @echo "#define HOST_VENDOR \"$(HostVendor_CPP)\"" >> $@
@echo "#define TARGET_VENDOR \"$(TargetVendor_CPP)\"" >> $@
@echo >> $@ @echo >> $@
@echo "#endif /* __PLATFORM_H__ */" >> $@ @echo "#endif /* __PLATFORM_H__ */" >> $@
@echo "Done." @echo "Done."
...@@ -141,28 +134,21 @@ compiler/stage2/$(PLATFORM_H) : mk/config.mk mk/project.mk | $$(dir $$@)/. ...@@ -141,28 +134,21 @@ compiler/stage2/$(PLATFORM_H) : mk/config.mk mk/project.mk | $$(dir $$@)/.
@echo >> $@ @echo >> $@
@echo "#define $(HostPlatform_CPP)_BUILD 1" >> $@ @echo "#define $(HostPlatform_CPP)_BUILD 1" >> $@
@echo "#define $(TargetPlatform_CPP)_HOST 1" >> $@ @echo "#define $(TargetPlatform_CPP)_HOST 1" >> $@
@echo "#define $(TargetPlatform_CPP)_TARGET 1" >> $@
@echo >> $@ @echo >> $@
@echo "#define $(HostArch_CPP)_BUILD_ARCH 1" >> $@ @echo "#define $(HostArch_CPP)_BUILD_ARCH 1" >> $@
@echo "#define $(TargetArch_CPP)_HOST_ARCH 1" >> $@ @echo "#define $(TargetArch_CPP)_HOST_ARCH 1" >> $@
@echo "#define $(TargetArch_CPP)_TARGET_ARCH 1" >> $@
@echo "#define BUILD_ARCH \"$(HostArch_CPP)\"" >> $@ @echo "#define BUILD_ARCH \"$(HostArch_CPP)\"" >> $@
@echo "#define HOST_ARCH \"$(TargetArch_CPP)\"" >> $@ @echo "#define HOST_ARCH \"$(TargetArch_CPP)\"" >> $@
@echo "#define TARGET_ARCH \"$(TargetArch_CPP)\"" >> $@
@echo >> $@ @echo >> $@
@echo "#define $(HostOS_CPP)_BUILD_OS 1" >> $@ @echo "#define $(HostOS_CPP)_BUILD_OS 1" >> $@
@echo "#define $(TargetOS_CPP)_HOST_OS 1" >> $@ @echo "#define $(TargetOS_CPP)_HOST_OS 1" >> $@
@echo "#define $(TargetOS_CPP)_TARGET_OS 1" >> $@
@echo "#define BUILD_OS \"$(HostOS_CPP)\"" >> $@ @echo "#define BUILD_OS \"$(HostOS_CPP)\"" >> $@
@echo "#define HOST_OS \"$(TargetOS_CPP)\"" >> $@ @echo "#define HOST_OS \"$(TargetOS_CPP)\"" >> $@
@echo "#define TARGET_OS \"$(TargetOS_CPP)\"" >> $@
@echo >> $@ @echo >> $@
@echo "#define $(HostVendor_CPP)_BUILD_VENDOR 1" >> $@ @echo "#define $(HostVendor_CPP)_BUILD_VENDOR 1" >> $@
@echo "#define $(TargetVendor_CPP)_HOST_VENDOR 1" >> $@ @echo "#define $(TargetVendor_CPP)_HOST_VENDOR 1" >> $@
@echo "#define $(TargetVendor_CPP)_TARGET_VENDOR 1" >> $@
@echo "#define BUILD_VENDOR \"$(HostVendor_CPP)\"" >> $@ @echo "#define BUILD_VENDOR \"$(HostVendor_CPP)\"" >> $@
@echo "#define HOST_VENDOR \"$(TargetVendor_CPP)\"" >> $@ @echo "#define HOST_VENDOR \"$(TargetVendor_CPP)\"" >> $@
@echo "#define TARGET_VENDOR \"$(TargetVendor_CPP)\"" >> $@
@echo >> $@ @echo >> $@
@echo "#endif /* __PLATFORM_H__ */" >> $@ @echo "#endif /* __PLATFORM_H__ */" >> $@
@echo "Done." @echo "Done."
...@@ -204,7 +190,7 @@ compiler_HC_OPTS += $(addprefix -I,$(GHC_INCLUDE_DIRS)) ...@@ -204,7 +190,7 @@ compiler_HC_OPTS += $(addprefix -I,$(GHC_INCLUDE_DIRS))
define preprocessCompilerFiles define preprocessCompilerFiles
# $0 = stage # $0 = stage
compiler/stage$1/build/primops.txt: compiler/prelude/primops.txt.pp compiler/stage$1/$$(PLATFORM_H) compiler/stage$1/build/primops.txt: compiler/prelude/primops.txt.pp
$$(HS_CPP) -P $$(compiler_CPP_OPTS) -Icompiler/stage$1 -x c $$< | grep -v '^#pragma GCC' > $$@ $$(HS_CPP) -P $$(compiler_CPP_OPTS) -Icompiler/stage$1 -x c $$< | grep -v '^#pragma GCC' > $$@
compiler/stage$1/build/primop-data-decl.hs-incl: compiler/stage$1/build/primops.txt $$$$(genprimopcode_INPLACE) compiler/stage$1/build/primop-data-decl.hs-incl: compiler/stage$1/build/primops.txt $$$$(genprimopcode_INPLACE)
......
...@@ -258,18 +258,13 @@ generateGhcPlatformH = do ...@@ -258,18 +258,13 @@ generateGhcPlatformH = do
, "#define BUILD_VENDOR " ++ show hostVendor , "#define BUILD_VENDOR " ++ show hostVendor
, "#define HOST_VENDOR " ++ show targetVendor , "#define HOST_VENDOR " ++ show targetVendor
, "" , ""
, "/* These TARGET macros are for backwards compatibility... DO NOT USE! */" ]
, "#define TargetPlatform_TYPE " ++ cppify targetPlatform
, "#define " ++ cppify targetPlatform ++ "_TARGET 1"
, "#define " ++ targetArch ++ "_TARGET_ARCH 1"
, "#define TARGET_ARCH " ++ show targetArch
, "#define " ++ targetOs ++ "_TARGET_OS 1"
, "#define TARGET_OS " ++ show targetOs
, "#define " ++ targetVendor ++ "_TARGET_VENDOR 1" ]
++ ++
[ "#define UnregisterisedCompiler 1" | ghcUnreg ] [ "#define UnregisterisedCompiler 1" | ghcUnreg ]
++ ++
[ "\n#endif /* __GHCPLATFORM_H__ */" ] [ ""
, "#endif /* __GHCPLATFORM_H__ */"
]
generateSettings :: Expr String generateSettings :: Expr String
generateSettings = do generateSettings = do
...@@ -413,10 +408,6 @@ generateGhcBootPlatformH = do ...@@ -413,10 +408,6 @@ generateGhcBootPlatformH = do
hostArch <- chooseSetting HostArch TargetArch hostArch <- chooseSetting HostArch TargetArch
hostOs <- chooseSetting HostOs TargetOs hostOs <- chooseSetting HostOs TargetOs
hostVendor <- chooseSetting HostVendor TargetVendor hostVendor <- chooseSetting HostVendor TargetVendor
targetPlatform <- getSetting TargetPlatform
targetArch <- getSetting TargetArch
targetOs <- getSetting TargetOs
targetVendor <- getSetting TargetVendor
return $ unlines return $ unlines
[ "#if !defined(__PLATFORM_H__)" [ "#if !defined(__PLATFORM_H__)"
, "#define __PLATFORM_H__" , "#define __PLATFORM_H__"
...@@ -426,28 +417,21 @@ generateGhcBootPlatformH = do ...@@ -426,28 +417,21 @@ generateGhcBootPlatformH = do
, "" , ""
, "#define " ++ cppify buildPlatform ++ "_BUILD 1" , "#define " ++ cppify buildPlatform ++ "_BUILD 1"
, "#define " ++ cppify hostPlatform ++ "_HOST 1" , "#define " ++ cppify hostPlatform ++ "_HOST 1"
, "#define " ++ cppify targetPlatform ++ "_TARGET 1"
, "" , ""
, "#define " ++ buildArch ++ "_BUILD_ARCH 1" , "#define " ++ buildArch ++ "_BUILD_ARCH 1"
, "#define " ++ hostArch ++ "_HOST_ARCH 1" , "#define " ++ hostArch ++ "_HOST_ARCH 1"
, "#define " ++ targetArch ++ "_TARGET_ARCH 1"
, "#define BUILD_ARCH " ++ show buildArch , "#define BUILD_ARCH " ++ show buildArch
, "#define HOST_ARCH " ++ show hostArch , "#define HOST_ARCH " ++ show hostArch
, "#define TARGET_ARCH " ++ show targetArch
, "" , ""
, "#define " ++ buildOs ++ "_BUILD_OS 1" , "#define " ++ buildOs ++ "_BUILD_OS 1"
, "#define " ++ hostOs ++ "_HOST_OS 1" , "#define " ++ hostOs ++ "_HOST_OS 1"
, "#define " ++ targetOs ++ "_TARGET_OS 1"
, "#define BUILD_OS " ++ show buildOs , "#define BUILD_OS " ++ show buildOs
, "#define HOST_OS " ++ show hostOs , "#define HOST_OS " ++ show hostOs
, "#define TARGET_OS " ++ show targetOs
, "" , ""
, "#define " ++ buildVendor ++ "_BUILD_VENDOR 1" , "#define " ++ buildVendor ++ "_BUILD_VENDOR 1"
, "#define " ++ hostVendor ++ "_HOST_VENDOR 1" , "#define " ++ hostVendor ++ "_HOST_VENDOR 1"
, "#define " ++ targetVendor ++ "_TARGET_VENDOR 1"
, "#define BUILD_VENDOR " ++ show buildVendor , "#define BUILD_VENDOR " ++ show buildVendor
, "#define HOST_VENDOR " ++ show hostVendor , "#define HOST_VENDOR " ++ show hostVendor
, "#define TARGET_VENDOR " ++ show targetVendor
, "" , ""
, "#endif /* __PLATFORM_H__ */" ] , "#endif /* __PLATFORM_H__ */" ]
......
...@@ -149,14 +149,6 @@ $(includes_H_PLATFORM) : includes/Makefile | $$(dir $$@)/. ...@@ -149,14 +149,6 @@ $(includes_H_PLATFORM) : includes/Makefile | $$(dir $$@)/.
@echo "#define BUILD_VENDOR \"$(HostVendor_CPP)\"" >> $@ @echo "#define BUILD_VENDOR \"$(HostVendor_CPP)\"" >> $@
@echo "#define HOST_VENDOR \"$(TargetVendor_CPP)\"" >> $@ @echo "#define HOST_VENDOR \"$(TargetVendor_CPP)\"" >> $@
@echo >> $@ @echo >> $@
@echo "/* These TARGET macros are for backwards compatibility... DO NOT USE! */" >> $@
@echo "#define TargetPlatform_TYPE $(TargetPlatform_CPP)" >> $@
@echo "#define $(TargetPlatform_CPP)_TARGET 1" >> $@
@echo "#define $(TargetArch_CPP)_TARGET_ARCH 1" >> $@
@echo "#define TARGET_ARCH \"$(TargetArch_CPP)\"" >> $@
@echo "#define $(TargetOS_CPP)_TARGET_OS 1" >> $@
@echo "#define TARGET_OS \"$(TargetOS_CPP)\"" >> $@
@echo "#define $(TargetVendor_CPP)_TARGET_VENDOR 1" >> $@
ifeq "$(GhcUnregisterised)" "YES" ifeq "$(GhcUnregisterised)" "YES"
@echo "#define UnregisterisedCompiler 1" >> $@ @echo "#define UnregisterisedCompiler 1" >> $@
endif endif
......
...@@ -30,7 +30,7 @@ module GHC.Prim.Ext ...@@ -30,7 +30,7 @@ module GHC.Prim.Ext
INT64 INT64
, WORD64 , WORD64
-- * Delay\/wait operations -- * Delay\/wait operations
#if defined(mingw32_TARGET_OS) #if defined(mingw32_HOST_OS)
, asyncRead# , asyncRead#
, asyncWrite# , asyncWrite#
, asyncDoProc# , asyncDoProc#
...@@ -66,7 +66,7 @@ type WORD64 = ...@@ -66,7 +66,7 @@ type WORD64 =
-- Delay/wait operations -- Delay/wait operations
------------------------------------------------------------------------ ------------------------------------------------------------------------
#if defined(mingw32_TARGET_OS) #if defined(mingw32_HOST_OS)
-- | Asynchronously read bytes from specified file descriptor. -- | Asynchronously read bytes from specified file descriptor.
foreign import prim "stg_asyncReadzh" asyncRead# foreign import prim "stg_asyncReadzh" asyncRead#
......
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