Build system: use stage0 to build dll-split
authorThomas Miedema <thomasmiedema@gmail.com>
Sat, 7 Nov 2015 23:19:55 +0000 (00:19 +0100)
committerBen Gamari <ben@smart-cactus.org>
Sat, 7 Nov 2015 23:54:05 +0000 (00:54 +0100)
When cross-compiling ghc itself, this prevents:

  "dll-split: cannot execute binary file: Exec format error"

Test Plan:
   * ./configure --target=arm-linux-gnueabihf
   * DYNAMIC_GHC_PROGRAMS=YES
   * Stage1Only=NO

Reviewers: rwbarton, bgamari, austin

Reviewed By: austin

Differential Revision: https://phabricator.haskell.org/D1430

ghc.mk
utils/dll-split/ghc.mk

diff --git a/ghc.mk b/ghc.mk
index aaf7d00..5e74b7b 100644 (file)
--- a/ghc.mk
+++ b/ghc.mk
@@ -524,7 +524,6 @@ $(foreach pkg,$(PACKAGES_STAGE1),$(eval $(call fixed_pkg_dep,$(pkg),dist-install
 # eachother, so we can configure them in parallel.
 utils/ghc-pwd/dist-install/package-data.mk: $(fixed_pkg_prev)
 utils/ghc-cabal/dist-install/package-data.mk: $(fixed_pkg_prev)
-utils/dll-split/dist-install/package-data.mk: $(fixed_pkg_prev)
 utils/hpc/dist-install/package-data.mk: $(fixed_pkg_prev)
 utils/ghc-pkg/dist-install/package-data.mk: $(fixed_pkg_prev)
 utils/hsc2hs/dist-install/package-data.mk: $(fixed_pkg_prev)
index 3d3e9da..27e11bd 100644 (file)
@@ -15,4 +15,9 @@ utils/dll-split_PACKAGE                      = dll-split
 utils/dll-split_dist-install_PROGNAME        = dll-split
 utils/dll-split_dist-install_INSTALL         = NO
 utils/dll-split_dist-install_INSTALL_INPLACE = YES
-$(eval $(call build-prog,utils/dll-split,dist-install,1))
+# Use the stage0 instead of the stage1 compiler to build dll-split, to
+# prevent: "dll-split: cannot execute binary file: Exec format error".
+# Programs built with the stage1 compiler can only run on TARGET
+# architecture, whereas dll-split is used during the GHC build process (see
+# rules/build-package-way.mk) on the BUILD (=HOST) architectue.
+$(eval $(call build-prog,utils/dll-split,dist-install,0))