From 92f72872ef372918588c72e74164dfb7375bf96c Mon Sep 17 00:00:00 2001 From: Cheng Shao <terrorjack@type.dance> Date: Fri, 26 Jan 2024 03:29:40 +0000 Subject: [PATCH] compiler: explicitly disable PIC in wasm32 NCG This commit explicitly disables the ncgPIC flag for the wasm32 target. The wasm backend doesn't support PIC for the time being. (cherry picked from commit 87e34888bca31b8fe5c860e2c52ef1e622a501de) (cherry picked from commit f46220a91f1c44194c5f537d2285b3284d1403cb) --- compiler/GHC/Driver/Config/CmmToAsm.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/GHC/Driver/Config/CmmToAsm.hs b/compiler/GHC/Driver/Config/CmmToAsm.hs index 65f548aa0d5..aa4b41d0e87 100644 --- a/compiler/GHC/Driver/Config/CmmToAsm.hs +++ b/compiler/GHC/Driver/Config/CmmToAsm.hs @@ -21,7 +21,8 @@ initNCGConfig dflags this_mod = NCGConfig , ncgAsmContext = initSDocContext dflags PprCode , ncgProcAlignment = cmmProcAlignment dflags , ncgExternalDynamicRefs = gopt Opt_ExternalDynamicRefs dflags - , ncgPIC = positionIndependent dflags + -- no PIC on wasm32 for now + , ncgPIC = positionIndependent dflags && not (platformArch (targetPlatform dflags) == ArchWasm32) , ncgInlineThresholdMemcpy = fromIntegral $ maxInlineMemcpyInsns dflags , ncgInlineThresholdMemset = fromIntegral $ maxInlineMemsetInsns dflags , ncgSplitSections = gopt Opt_SplitSections dflags -- GitLab