Skip to content
Snippets Groups Projects
Commit c247f2ee authored by Cheng Shao's avatar Cheng Shao
Browse files

hadrian: fix CFLAGS for gmp shared objs on wasm

This commit adds -fvisibility=default to CFLAGS of gmp when building
for wasm. This is required to generate the ghc-bignum shared library
without linking errors. Clang defaults to -fvisibility=hidden for wasm
targets, which will cause issues when a symbol is expected to be
exported in a shared library but without explicit visibility attribute
annotation.
parent 577c1819
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment