Cheng Shao pushed to branch wip/ghc-toolchain-js-no-llvm at Glasgow Haskell Compiler / GHC
Commits:
-
59110415
by Cheng Shao at 2025-09-10T16:28:01+02:00
1 changed file:
Changes:
| ... | ... | @@ -419,7 +419,17 @@ ldOverrideWhitelist a = |
| 419 | 419 | OSMinGW32 -> True
|
| 420 | 420 | _ -> False
|
| 421 | 421 | |
| 422 | - |
|
| 422 | +-- | Some targets like wasm32/js are based on LLVM related toolchains
|
|
| 423 | +-- like wasi-sdk/emscripten, but these targets don't really support
|
|
| 424 | +-- the LLVM backend and doesn't invoke llc/opt/llvm-as programs
|
|
| 425 | +-- anyway, so we need to skip these. Otherwise in some build
|
|
| 426 | +-- environments ghc-toolchain may find llc/opt/llvm-as programs for
|
|
| 427 | +-- unsupported targets and configure
|
|
| 428 | +-- --enable-strict-ghc-toolchain-check may fail.
|
|
| 429 | +excludeNoLLVMTarget :: ArchOS -> M (Maybe a) -> M (Maybe a)
|
|
| 430 | +excludeNoLLVMTarget archOS m
|
|
| 431 | + | archOS_arch archOS `elem` [ArchWasm32, ArchJavaScript] = pure Nothing
|
|
| 432 | + | otherwise = m
|
|
| 423 | 433 | |
| 424 | 434 | mkTarget :: Opts -> M Target
|
| 425 | 435 | mkTarget opts = do
|
| ... | ... | @@ -458,9 +468,9 @@ mkTarget opts = do |
| 458 | 468 | throwE "Neither a object-merging tool (e.g. ld -r) nor an ar that supports -L is available"
|
| 459 | 469 | |
| 460 | 470 | -- LLVM toolchain
|
| 461 | - llc <- optional $ findProgram "llc" (optLlc opts) ["llc"]
|
|
| 462 | - opt <- optional $ findProgram "opt" (optOpt opts) ["opt"]
|
|
| 463 | - llvmAs <- optional $ findProgram "llvm assembler" (optLlvmAs opts) ["clang"]
|
|
| 471 | + llc <- excludeNoLLVMTarget archOs $ optional $ findProgram "llc" (optLlc opts) ["llc"]
|
|
| 472 | + opt <- excludeNoLLVMTarget archOs $ optional $ findProgram "opt" (optOpt opts) ["opt"]
|
|
| 473 | + llvmAs <- excludeNoLLVMTarget archOs $ optional $ findProgram "llvm assembler" (optLlvmAs opts) ["clang"]
|
|
| 464 | 474 | |
| 465 | 475 | -- Windows-specific utilities
|
| 466 | 476 | windres <-
|