From 1f9c4465ff664e46c6f13ace2099804ef2b7989d Mon Sep 17 00:00:00 2001
From: Cheng Shao <terrorjack@type.dance>
Date: Tue, 7 May 2024 20:48:35 +0000
Subject: [PATCH] hadrian: build in-tree GMP with malloc-notreentrant on wasm32

This patch makes hadrian build in-tree GMP with the
--enable-alloca=malloc-notreentrant configure option. We will only
need malloc-reentrant when we have threaded RTS and SMP support on
wasm32, which will take some time to happen, before which we should
use malloc-notreentrant to avoid undesired runtime overhead.

(cherry picked from commit 06277d56de91c8d21cbf71e8bc4096925b863acc)
(cherry picked from commit 0f9a8aaf5553c87416cdeadb7116c96bcc61011d)
---
 hadrian/src/Settings/Builders/Configure.hs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hadrian/src/Settings/Builders/Configure.hs b/hadrian/src/Settings/Builders/Configure.hs
index 6eb1233f1eb..bd6230efc47 100644
--- a/hadrian/src/Settings/Builders/Configure.hs
+++ b/hadrian/src/Settings/Builders/Configure.hs
@@ -26,7 +26,7 @@ configureBuilderArgs = do
                      -- https://gmplib.org/manual/Build-Options for
                      -- more detailed explanation of this configure
                      -- option.
-                     <> [ "--enable-alloca=malloc-reentrant" | targetArch == "wasm32" ]
+                     <> [ "--enable-alloca=malloc-notreentrant" | targetArch == "wasm32" ]
                      -- Enable PIC unless target is wasm32, in which
                      -- case we don't want libgmp.a to be bloated due
                      -- to PIC overhead.
-- 
GitLab