[Git][ghc/ghc][wip/ghc-toolchain-fixes] add some javascript special cases
Matthew Pickering (@mpickering)
gitlab at gitlab.haskell.org
Thu Jul 27 14:40:03 UTC 2023
Matthew Pickering pushed to branch wip/ghc-toolchain-fixes at Glasgow Haskell Compiler / GHC
Commits:
a2a694ca by Matthew Pickering at 2023-07-27T15:39:41+01:00
add some javascript special cases
- - - - -
1 changed file:
- utils/ghc-toolchain/src/GHC/Toolchain/Tools/Link.hs
Changes:
=====================================
utils/ghc-toolchain/src/GHC/Toolchain/Tools/Link.hs
=====================================
@@ -55,11 +55,11 @@ findCcLink target progOpt ldOverride archOs cc readelf = checking "for C compile
Nothing -> do
-- If not then try to find decent linker flags
findLinkFlags ldOverride cc rawCcLink <|> pure rawCcLink
- ccLinkProgram <- linkSupportsTarget cc target ccLinkProgram
- ccLinkSupportsNoPie <- checkSupportsNoPie ccLinkProgram
+ ccLinkProgram <- linkSupportsTarget archOs cc target ccLinkProgram
+ ccLinkSupportsNoPie <- checkSupportsNoPie ccLinkProgram
ccLinkSupportsCompactUnwind <- checkSupportsCompactUnwind archOs cc ccLinkProgram
- ccLinkSupportsFilelist <- checkSupportsFilelist cc ccLinkProgram
- ccLinkIsGnu <- checkLinkIsGnu ccLinkProgram
+ ccLinkSupportsFilelist <- checkSupportsFilelist cc ccLinkProgram
+ ccLinkIsGnu <- checkLinkIsGnu archOs ccLinkProgram
checkBfdCopyBug archOs cc readelf ccLinkProgram
ccLinkProgram <- addPlatformDepLinkFlags archOs cc ccLinkProgram
let ccLink = CcLink {ccLinkProgram, ccLinkSupportsNoPie,
@@ -87,8 +87,13 @@ findLinkFlags enableOverride cc ccLink
| otherwise =
return ccLink
-linkSupportsTarget :: Cc -> String -> Program -> M Program
-linkSupportsTarget cc target link
+linkSupportsTarget :: ArchOS -> Cc -> String -> Program -> M Program
+-- Javascript toolchain provided by emsdk just ignores --target flag so
+-- we have this special case to match with ./configure (#23744)
+linkSupportsTarget archOS _ _ c
+ | ArchJavaScript <- archOS_arch archOS
+ = return c
+linkSupportsTarget _ cc target link
= checking "whether cc linker supports --target" $
supportsTarget (Lens id const) (checkLinkWorks cc) target link
@@ -170,8 +175,11 @@ checkLinkWorks cc ccLink = withTempDir $ \dir -> do
-- Linking in windows might produce an executable with an ".exe" extension
<|> expectFileExists (out <.> "exe") err
-checkLinkIsGnu :: Program -> M Bool
-checkLinkIsGnu ccLink = do
+checkLinkIsGnu :: ArchOS -> Program -> M Bool
+checkLinkIsGnu archOs _
+ -- emsdk is never going to provide gnu ld (See #23744)
+ | ArchJavaScript <- archOS_arch archOs = return False
+checkLinkIsGnu _ ccLink = do
out <- readProgramStdout ccLink ["-Wl,--version"]
return ("GNU" `isInfixOf` out)
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/a2a694ca7dda92d5ccf02dccf5984b64b51533ca
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/a2a694ca7dda92d5ccf02dccf5984b64b51533ca
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/20230727/959e349a/attachment-0001.html>
More information about the ghc-commits
mailing list