From 418a8c926703ac284f7b1a39900722efa02d0834 Mon Sep 17 00:00:00 2001
From: Ian Lynagh <igloo@earth.li>
Date: Sun, 2 Dec 2012 14:48:20 +0000
Subject: [PATCH] On Win64, mark executables as not supporting bigaddr; fixes
 #7134

This is a kludge, and means that ghc/haddock won't be able to use
more than 2G of RAM. But it'll make sure that ghci works in the short
term while we work on a proper fix.
---
 rules/build-prog.mk | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/rules/build-prog.mk b/rules/build-prog.mk
index 6e4bf5c18af1..052df988d7b0 100644
--- a/rules/build-prog.mk
+++ b/rules/build-prog.mk
@@ -157,9 +157,15 @@ $1/$2/build/tmp/$$($1_$2_PROG) : \
 ifeq "$$($1_$2_LINK_WITH_GCC)" "NO"
 $1/$2/build/tmp/$$($1_$2_PROG) : $$($1_$2_v_HS_OBJS) $$($1_$2_v_C_OBJS) $$($1_$2_v_S_OBJS) $$($1_$2_OTHER_OBJS) | $$$$(dir $$$$@)/.
 	$$(call cmd,$1_$2_HC) -o $$@ $$($1_$2_v_ALL_HC_OPTS) $$(LD_OPTS) $$($1_$2_GHC_LD_OPTS) $$($1_$2_v_HS_OBJS) $$($1_$2_v_C_OBJS) $$($1_$2_v_S_OBJS) $$($1_$2_OTHER_OBJS) $$(addprefix -l,$$($1_$2_EXTRA_LIBRARIES))
+ifeq "$$(TARGETPLATFORM)" "x86_64-unknown-mingw32"
+	peflags --bigaddr=0 $$@
+endif
 else
 $1/$2/build/tmp/$$($1_$2_PROG) : $$($1_$2_v_HS_OBJS) $$($1_$2_v_C_OBJS) $$($1_$2_v_S_OBJS) $$($1_$2_OTHER_OBJS) | $$$$(dir $$$$@)/.
 	$$(call cmd,$1_$2_CC)" -o $$@ $$($1_$2_v_ALL_CC_OPTS) $$(LD_OPTS) $$($1_$2_v_HS_OBJS) $$($1_$2_v_C_OBJS) $$($1_$2_v_S_OBJS) $$($1_$2_OTHER_OBJS) $$($1_$2_v_EXTRA_CC_OPTS) $$(addprefix -l,$$($1_$2_EXTRA_LIBRARIES))
+ifeq "$$(TARGETPLATFORM)" "x86_64-unknown-mingw32"
+	peflags --bigaddr=0 $$@
+endif
 endif
 
 # Note [lib-depends] if this program is built with stage1 or greater, we
-- 
GitLab