Sven Tennie pushed to branch wip/romes/hadrian-cross-stage2-rebase_SVEN_FIXED at Glasgow Haskell Compiler / GHC Commits: d65222e8 by Sven Tennie at 2025-10-04T16:35:28+02:00 WIP: libffi: LD, OBJDUMP, STRIP staged Removing the env variables implies using the programs from $PATH. This kind-of works, but these values should be correctly auto-configured. - - - - - 4 changed files: - hadrian/src/Builder.hs - hadrian/src/Hadrian/Builder.hs - hadrian/src/Rules/Libffi.hs - hadrian/src/Settings/Builders/Cabal.hs Changes: ===================================== hadrian/src/Builder.hs ===================================== @@ -8,7 +8,7 @@ module Builder ( -- * Builder properties builderProvenance, systemBuilderPath, builderPath, isSpecified, needBuilders, runBuilder, runBuilderWith, runBuilderWithCmdOptions, getBuilderPath, - builderEnvironment + builderEnvironment, remBuilderEnvironment ) where import Control.Exception.Extra (Partial) ===================================== hadrian/src/Hadrian/Builder.hs ===================================== @@ -14,7 +14,7 @@ module Hadrian.Builder ( Builder (..), BuildInfo (..), needBuilders, runBuilder, runBuilderWithCmdOptions, build, buildWithResources, buildWithCmdOptions, - getBuilderPath, builderEnvironment, askWithResources + getBuilderPath, builderEnvironment, remBuilderEnvironment, askWithResources ) where import Data.List @@ -162,3 +162,7 @@ builderEnvironment variable builder = do needBuilders [builder] path <- builderPath builder return $ AddEnv variable path + +remBuilderEnvironment :: String -> Action CmdOption +remBuilderEnvironment variable = do + return $ RemEnv variable ===================================== hadrian/src/Rules/Libffi.hs ===================================== @@ -129,6 +129,25 @@ fixLibffiMakefile top = -- TODO: check code duplication w.r.t. ConfCcArgs configureEnvironment :: Stage -> Action [CmdOption] +configureEnvironment stage@Stage1 = do + -- TODO: This case should not exist: Strip and Objdump should be staged! + context <- libffiContext stage + cFlags <- interpretInContext context $ mconcat + [ cArgs + , getStagedCCFlags ] + ldFlags <- interpretInContext context ldArgs + sequence [ builderEnvironment "CC" $ Cc CompileC stage + , builderEnvironment "CXX" $ Cc CompileC stage + , builderEnvironment "AR" (Ar Unpack stage) + -- , builderEnvironment "LD" (Ld stage) + , builderEnvironment "NM" (Nm stage) + , builderEnvironment "RANLIB" (Ranlib stage) + , remBuilderEnvironment "OBJDUMP" + , remBuilderEnvironment "STRIP" + , remBuilderEnvironment "LD" + , return . AddEnv "CFLAGS" $ unwords cFlags ++ " -w" + , return . AddEnv "LDFLAGS" $ unwords ldFlags ++ " -w" ] + configureEnvironment stage = do context <- libffiContext stage cFlags <- interpretInContext context $ mconcat @@ -140,6 +159,7 @@ configureEnvironment stage = do , builderEnvironment "AR" (Ar Unpack stage) , builderEnvironment "NM" (Nm stage) , builderEnvironment "RANLIB" (Ranlib stage) + , builderEnvironment "LD" (Ld stage) , return . AddEnv "CFLAGS" $ unwords cFlags ++ " -w" , return . AddEnv "LDFLAGS" $ unwords ldFlags ++ " -w" ] ===================================== hadrian/src/Settings/Builders/Cabal.hs ===================================== @@ -208,6 +208,7 @@ configureArgs cFlags' ldFlags' = do , conf "--with-gmp-libraries" $ arg =<< staged (buildSetting GmpLibDir) , conf "--with-curses-libraries" $ arg =<< staged (buildSetting CursesLibDir) , conf "--host" $ arg =<< flip queryTarget targetPlatformTriple . predStage' =<< getStage + , conf "--target" $ arg =<< flip queryTarget targetPlatformTriple =<< getStage , conf "--with-cc" $ arg =<< getBuilderPath . (Cc CompileC) =<< getStage , ghcVersionH ] View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/d65222e8f7f475130529fa5162fce070... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/d65222e8f7f475130529fa5162fce070... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Sven Tennie (@supersven)