From 06277d56de91c8d21cbf71e8bc4096925b863acc 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.
---
 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 fadeed02331a..f60eebef37b8 100644
--- a/hadrian/src/Settings/Builders/Configure.hs
+++ b/hadrian/src/Settings/Builders/Configure.hs
@@ -27,7 +27,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