Peter Trommler pushed to branch wip/T26819 at Glasgow Haskell Compiler / GHC
Commits:
-
414b9593
by Cheng Shao at 2026-01-24T07:11:51-05:00
-
e5cb5491
by Cheng Shao at 2026-01-24T07:12:34-05:00
-
2d160222
by Simon Hengel at 2026-01-24T07:13:17-05:00
-
811f56e5
by Peter Trommler at 2026-01-24T17:41:50+01:00
8 changed files:
- .gitlab-ci.yml
- docs/users_guide/exts/roles.rst
- hadrian/src/Builder.hs
- hadrian/src/Context.hs
- hadrian/src/Rules/Compile.hs
- hadrian/src/Settings/Builders/Cc.hs
- hadrian/src/Settings/Builders/Configure.hs
- hadrian/src/Settings/Builders/Make.hs
Changes:
| ... | ... | @@ -1050,10 +1050,6 @@ abi-test: |
| 1050 | 1050 | optional: true
|
| 1051 | 1051 | dependencies: null
|
| 1052 | 1052 | image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-fedora43:$DOCKER_REV"
|
| 1053 | - rules:
|
|
| 1054 | - - if: $CI_MERGE_REQUEST_ID
|
|
| 1055 | - - if: '$CI_COMMIT_BRANCH == "master"'
|
|
| 1056 | - - if: '$CI_COMMIT_BRANCH =~ /ghc-[0.9]+\.[0-9]+/'
|
|
| 1057 | 1053 | tags:
|
| 1058 | 1054 | - x86_64-linux
|
| 1059 | 1055 | script:
|
| ... | ... | @@ -38,7 +38,7 @@ trouble. |
| 38 | 38 | The way to identify such situations is to have *roles* assigned to type
|
| 39 | 39 | variables of datatypes, classes, and type synonyms.
|
| 40 | 40 | |
| 41 | -Roles as implemented in GHC are a from a simplified version of the work
|
|
| 41 | +Roles as implemented in GHC are based on a simplified version of the work
|
|
| 42 | 42 | described in `Generative type abstraction and type-level
|
| 43 | 43 | computation <https://www.seas.upenn.edu/~sweirich/papers/popl163af-weirich.pdf>`__,
|
| 44 | 44 | published at POPL 2011.
|
| ... | ... | @@ -49,7 +49,7 @@ import GHC.Toolchain.Program |
| 49 | 49 | -- * Compile or preprocess a source file.
|
| 50 | 50 | -- * Extract source dependencies by passing @-MM@ command line argument.
|
| 51 | 51 | data CcMode = CompileC | FindCDependencies DependencyType deriving (Eq, Generic, Show)
|
| 52 | -data DependencyType = CDep | CxxDep deriving (Eq, Generic, Show)
|
|
| 52 | +data DependencyType = CDep | CxxDep | AsmDep deriving (Eq, Generic, Show)
|
|
| 53 | 53 | |
| 54 | 54 | instance Binary CcMode
|
| 55 | 55 | instance Hashable CcMode
|
| ... | ... | @@ -11,7 +11,7 @@ module Context ( |
| 11 | 11 | pkgLibraryFile,
|
| 12 | 12 | pkgConfFile, pkgStampFile, resourcePath, objectPath, contextPath, getContextPath, libPath, distDir,
|
| 13 | 13 | distDynDir,
|
| 14 | - haddockStatsFilesDir, ensureConfigured, autogenPath, rtsContext, rtsBuildPath, libffiBuildPath
|
|
| 14 | + haddockStatsFilesDir, ensureConfigured, autogenPath, rtsContext, rtsBuildPath
|
|
| 15 | 15 | ) where
|
| 16 | 16 | |
| 17 | 17 | import Base
|
| ... | ... | @@ -93,14 +93,6 @@ rtsContext stage = vanillaContext stage rts |
| 93 | 93 | rtsBuildPath :: Stage -> Action FilePath
|
| 94 | 94 | rtsBuildPath stage = buildPath (rtsContext stage)
|
| 95 | 95 | |
| 96 | --- | Build directory for in-tree 'libffi' library.
|
|
| 97 | -libffiBuildPath :: Stage -> Action FilePath
|
|
| 98 | -libffiBuildPath stage = buildPath $ Context
|
|
| 99 | - stage
|
|
| 100 | - libffi
|
|
| 101 | - (error "libffiBuildPath: way not set.")
|
|
| 102 | - (error "libffiBuildPath: inplace not set.")
|
|
| 103 | - |
|
| 104 | 96 | pkgFileName :: Context -> Package -> String -> String -> Action FilePath
|
| 105 | 97 | pkgFileName context package prefix suffix = do
|
| 106 | 98 | pid <- pkgUnitId (stage context) package
|
| ... | ... | @@ -282,8 +282,11 @@ needDependencies lang context@Context {..} src depFile = do |
| 282 | 282 | discover -- Continue the discovery process
|
| 283 | 283 | |
| 284 | 284 | -- We need to pass different flags to cc depending on whether the
|
| 285 | - -- file to compile is a .c or a .cpp file
|
|
| 286 | - depType = if lang == Cxx then CxxDep else CDep
|
|
| 285 | + -- file to compile is a .c or a .cpp or a .S file
|
|
| 286 | + depType = case lang of
|
|
| 287 | + Cxx -> CxxDep
|
|
| 288 | + Asm -> AsmDep
|
|
| 289 | + _ -> CDep
|
|
| 287 | 290 | |
| 288 | 291 | parseFile :: FilePath -> Action [String]
|
| 289 | 292 | parseFile file = do
|
| ... | ... | @@ -18,6 +18,7 @@ ccBuilderArgs = do |
| 18 | 18 | , arg "-o", arg =<< getOutput ]
|
| 19 | 19 | , builder (Cc (FindCDependencies CDep)) ? findCDepExpr CDep
|
| 20 | 20 | , builder (Cc (FindCDependencies CxxDep)) ? findCDepExpr CxxDep
|
| 21 | + , builder (Cc (FindCDependencies AsmDep)) ? findCDepExpr AsmDep
|
|
| 21 | 22 | ]
|
| 22 | 23 | where
|
| 23 | 24 | findCDepExpr depType = do
|
| ... | ... | @@ -26,10 +27,10 @@ ccBuilderArgs = do |
| 26 | 27 | , arg "-MM", arg "-MG"
|
| 27 | 28 | , arg "-MF", arg output
|
| 28 | 29 | , arg "-MT", arg $ dropExtension output -<.> "o"
|
| 29 | - , case depType of CDep -> mempty; CxxDep -> arg "-std=c++11"
|
|
| 30 | + , case depType of CDep -> mempty; CxxDep -> arg "-std=c++11"; AsmDep -> mempty
|
|
| 30 | 31 | , cIncludeArgs
|
| 31 | - , arg "-x", arg (case depType of CDep -> "c"; CxxDep -> "c++")
|
|
| 32 | - , case depType of CDep -> mempty; CxxDep -> getContextData cxxOpts
|
|
| 32 | + , arg "-x", arg (case depType of CDep -> "c"; CxxDep -> "c++"; AsmDep -> "assembler-with-cpp")
|
|
| 33 | + , case depType of CDep -> mempty; CxxDep -> getContextData cxxOpts; AsmDep -> mempty
|
|
| 33 | 34 | -- Pass 'ghcversion.h' to give sources access to the
|
| 34 | 35 | -- `MIN_VERSION_GLASGOW_HASKELL` macro.
|
| 35 | 36 | , notStage0 ? arg "-include" <> arg "rts/include/ghcversion.h"
|
| ... | ... | @@ -8,8 +8,7 @@ configureBuilderArgs :: Args |
| 8 | 8 | configureBuilderArgs = do
|
| 9 | 9 | stage <- getStage
|
| 10 | 10 | gmpPath <- expr (gmpBuildPath stage)
|
| 11 | - libffiPath <- expr (libffiBuildPath stage)
|
|
| 12 | - mconcat [ builder (Configure gmpPath) ? do
|
|
| 11 | + builder (Configure gmpPath) ? do
|
|
| 13 | 12 | targetArch <- queryTarget queryArch
|
| 14 | 13 | targetPlatform <- queryTarget targetPlatformTriple
|
| 15 | 14 | buildPlatform <- queryBuild targetPlatformTriple
|
| ... | ... | @@ -28,16 +27,3 @@ configureBuilderArgs = do |
| 28 | 27 | -- option.
|
| 29 | 28 | <> [ "--enable-alloca=malloc-notreentrant" | targetArch == "wasm32" ]
|
| 30 | 29 | <> [ "--with-pic=yes" ] |
| 31 | - |
|
| 32 | - , builder (Configure libffiPath) ? do
|
|
| 33 | - top <- expr topDirectory
|
|
| 34 | - targetPlatform <- queryTarget targetPlatformTriple
|
|
| 35 | - way <- getWay
|
|
| 36 | - pure [ "--prefix=" ++ top -/- libffiPath -/- "inst"
|
|
| 37 | - , "--libdir=" ++ top -/- libffiPath -/- "inst/lib"
|
|
| 38 | - , "--enable-static=yes"
|
|
| 39 | - , "--enable-shared="
|
|
| 40 | - ++ (if wayUnit Dynamic way
|
|
| 41 | - then "yes"
|
|
| 42 | - else "no")
|
|
| 43 | - , "--host=" ++ targetPlatform ] ] |
| ... | ... | @@ -12,12 +12,8 @@ makeBuilderArgs = do |
| 12 | 12 | threads <- shakeThreads <$> expr getShakeOptions
|
| 13 | 13 | stage <- getStage
|
| 14 | 14 | gmpPath <- expr (gmpBuildPath stage)
|
| 15 | - libffiPaths <- forM [Stage1, Stage2, Stage3 ] $ \s -> expr (libffiBuildPath s)
|
|
| 16 | 15 | let t = show $ max 4 (threads - 2) -- Don't use all Shake's threads
|
| 17 | - mconcat $
|
|
| 18 | - (builder (Make gmpPath ) ? pure ["MAKEFLAGS=-j" ++ t]) :
|
|
| 19 | - [ builder (Make libffiPath) ? pure ["MAKEFLAGS=-j" ++ t, "install"]
|
|
| 20 | - | libffiPath <- libffiPaths ]
|
|
| 16 | + builder (Make gmpPath) ? pure ["MAKEFLAGS=-j" ++ t]
|
|
| 21 | 17 | |
| 22 | 18 | validateBuilderArgs :: Args
|
| 23 | 19 | validateBuilderArgs = builder (Make "testsuite/tests") ? do
|