[Git][ghc/ghc][master] 3 commits: hadrian: disable PIC for in-tree GMP on wasm32

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Sun Jun 2 18:02:22 UTC 2024



Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
f9c1ae12 by Cheng Shao at 2024-06-02T14:01:55-04:00
hadrian: disable PIC for in-tree GMP on wasm32

This patch disables PIC for in-tree GMP on wasm32 target. Enabling PIC
unconditionally adds undesired code size and runtime overhead for
wasm32.

- - - - -
1a32f828 by Cheng Shao at 2024-06-02T14:01:55-04:00
hadrian: disable in-tree gmp fft code path for wasm32

This patch disables in-tree GMP FFT code paths for wasm32 target in
order to give up some performance of multiplying very large operands
in exchange for reduced code size.

- - - - -
06277d56 by Cheng Shao at 2024-06-02T14:01:55-04:00
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.

- - - - -


1 changed file:

- hadrian/src/Settings/Builders/Configure.hs


Changes:

=====================================
hadrian/src/Settings/Builders/Configure.hs
=====================================
@@ -15,16 +15,23 @@ configureBuilderArgs = do
                 targetPlatform <- queryTarget targetPlatformTriple
                 buildPlatform <- queryBuild targetPlatformTriple
                 pure $ [ "--enable-shared=no"
-                     , "--with-pic=yes"
                      , "--host=" ++ targetPlatform    -- GMP's host is our target
                      , "--build=" ++ buildPlatform ]
+                     -- Disable FFT logic on wasm32, sacrifice
+                     -- performance of multiplying very large operands
+                     -- to save code size
+                     <> [ "--disable-fft" | targetArch == "wasm32" ]
                      -- Disable GMP's alloca usage on wasm32, it may
                      -- cause stack overflow (#22602) due to the
                      -- rather small 64KB default stack size. See
                      -- 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.
+                     <> [ "--with-pic=yes" | targetArch /= "wasm32" ]
 
             , builder (Configure libffiPath) ? do
                 top            <- expr topDirectory



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/cf49fb5f8c20ae97cca08a468f690503b517a4ef...06277d56de91c8d21cbf71e8bc4096925b863acc

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/cf49fb5f8c20ae97cca08a468f690503b517a4ef...06277d56de91c8d21cbf71e8bc4096925b863acc
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20240602/d98c4303/attachment-0001.html>


More information about the ghc-commits mailing list