[Git][ghc/ghc][wip/libffi-dep-hadrian] hadrian: Make sure ffi headers are built before using a compiler
Matthew Pickering (@mpickering)
gitlab at gitlab.haskell.org
Tue Aug 13 12:01:27 UTC 2024
Matthew Pickering pushed to branch wip/libffi-dep-hadrian at Glasgow Haskell Compiler / GHC
Commits:
97d33100 by Matthew Pickering at 2024-08-13T13:00:48+01:00
hadrian: Make sure ffi headers are built before using a compiler
When we are using ffi adjustors then we rely on `ffi.h` and
`ffitarget.h` files during code generation when compiling stubs.
Therefore we need to add this dependency to the build system (which this
patch does).
Reproducer, configure with `--enable-libffi-adjustors` and then build
"_build/stage1/libraries/ghc-prim/build/GHC/Types.p_o".
Observe that this fails before this patch and works afterwards.
Fixes #24864
- - - - -
1 changed file:
- hadrian/src/Builder.hs
Changes:
=====================================
hadrian/src/Builder.hs
=====================================
@@ -26,7 +26,7 @@ import Hadrian.Builder.Tar
import Hadrian.Oracles.Path
import Hadrian.Oracles.TextFile
import Hadrian.Utilities
-import Oracles.Setting (bashPath, targetStage)
+import Oracles.Setting (bashPath, targetStage, isJsTarget)
import System.Exit
import System.IO (stderr)
@@ -237,16 +237,26 @@ instance H.Builder Builder where
-- changes (#18001).
_bootGhcVersion <- setting GhcVersion
pure []
- Ghc {} -> do
+ Ghc _ st -> do
root <- buildRoot
unlitPath <- builderPath Unlit
distro_mingw <- settingsFileSetting ToolchainSetting_DistroMinGW
+ libffi_adjustors <- useLibffiForAdjustors
+ jsTarget <- isJsTarget
return $ [ unlitPath ]
++ [ root -/- mingwStamp | windowsHost, distro_mingw == "NO" ]
-- proxy for the entire mingw toolchain that
-- we have in inplace/mingw initially, and then at
-- root -/- mingw.
+ -- ffi.h needed by the compiler when using libffi_adjustors (#24864)
+ -- It would be nicer to not duplicate this logic between here
+ -- and needRtsLibffiTargets and libffiHeaderFiles but this doesn't change
+ -- very often.
+ ++ [ root -/- buildDir (rtsContext st) -/- "include" -/- header
+ | header <- ["ffi.h", "ffitarget.h"]
+ , libffi_adjustors
+ , not jsTarget ]
Hsc2Hs stage -> (\p -> [p]) <$> templateHscPath stage
Make dir -> return [dir -/- "Makefile"]
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/97d33100091dd10b81b63bd278cf23ac9dc95f49
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/97d33100091dd10b81b63bd278cf23ac9dc95f49
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/20240813/0d5bda16/attachment-0001.html>
More information about the ghc-commits
mailing list