diff --git a/hadrian/src/Rules/Gmp.hs b/hadrian/src/Rules/Gmp.hs
index ebca995bfe38b098d60a84a7e2f79661b62466d8..7e31ae72f99bb371a77a6811cc2b59f57c17d7a9 100644
--- a/hadrian/src/Rules/Gmp.hs
+++ b/hadrian/src/Rules/Gmp.hs
@@ -12,6 +12,7 @@ import Utilities
 import Hadrian.BuildPath
 import Hadrian.Expression
 import Settings.Builders.Common (cArgs, getStagedCCFlags)
+import GHC.Platform.ArchOS
 
 -- | Build in-tree GMP library objects (if GmpInTree flag is set) and return
 -- their paths.
@@ -122,7 +123,13 @@ gmpRules = do
             let gmpBuildP = takeDirectory mk
                 gmpP      = takeDirectory gmpBuildP
             ctx <- makeGmpPathContext gmpP
-            cFlags <- interpretInContext ctx $ mconcat [ cArgs, getStagedCCFlags ]
+            cFlags <-
+                interpretInContext ctx $
+                mconcat
+                    [ cArgs
+                    , getStagedCCFlags
+                    , anyTargetArch [ArchWasm32] ? arg "-fvisibility=default"
+                    ]
             env <- sequence
                      [ builderEnvironment "CC" $ Cc CompileC (stage ctx)
                      , return . AddEnv "CFLAGS" $ unwords cFlags