[Git][ghc/ghc][wip/toolchain-selection] Read deleted keys from host and target's target
Rodrigo Mesquita (@alt-romes)
gitlab at gitlab.haskell.org
Fri May 12 15:39:51 UTC 2023
Rodrigo Mesquita pushed to branch wip/toolchain-selection at Glasgow Haskell Compiler / GHC
Commits:
4c6d4b60 by Rodrigo Mesquita at 2023-05-12T16:39:45+01:00
Read deleted keys from host and target's target
- - - - -
3 changed files:
- hadrian/hadrian.cabal
- hadrian/src/Oracles/Setting.hs
- hadrian/src/Rules/Generate.hs
Changes:
=====================================
hadrian/hadrian.cabal
=====================================
@@ -167,6 +167,7 @@ executable hadrian
, cryptohash-sha256 >= 0.11 && < 0.12
, base16-bytestring >= 0.1.1 && < 1.1.0.0
, ghc-toolchain
+ , ghc-boot
ghc-options: -Wall
-Wincomplete-record-updates
-Wredundant-constraints
=====================================
hadrian/src/Oracles/Setting.hs
=====================================
@@ -25,6 +25,7 @@ import Base
import GHC.Toolchain
import GHC.Toolchain.Program
+import GHC.Platform.ArchOS
-- | Each 'Setting' comes from the file @hadrian/cfg/system.config@, generated
-- by the @configure@ script from the input file @hadrian/cfg/system.config.in at .
@@ -135,55 +136,62 @@ data ToolchainSetting
-- | Look up the value of a 'Setting' in @cfg/system.config@, tracking the
-- result.
setting :: Setting -> Action String
-setting key = lookupSystemConfig $ case key of
- BuildArch -> "build-arch"
- BuildOs -> "build-os"
- BuildPlatform -> "build-platform"
- BuildVendor -> "build-vendor"
- CursesIncludeDir -> "curses-include-dir"
- CursesLibDir -> "curses-lib-dir"
- DynamicExtension -> "dynamic-extension"
- FfiIncludeDir -> "ffi-include-dir"
- FfiLibDir -> "ffi-lib-dir"
- GhcMajorVersion -> "ghc-major-version"
- GhcMinorVersion -> "ghc-minor-version"
- GhcPatchLevel -> "ghc-patch-level"
- GhcVersion -> "ghc-version"
- GhcSourcePath -> "ghc-source-path"
- GmpIncludeDir -> "gmp-include-dir"
- GmpLibDir -> "gmp-lib-dir"
- HostArch -> "host-arch"
- HostOs -> "host-os"
- HostPlatform -> "host-platform"
- HostVendor -> "host-vendor"
- HostArchHaskell -> "host-arch-haskell"
- HostOsHaskell -> "host-os-haskell"
- IconvIncludeDir -> "iconv-include-dir"
- IconvLibDir -> "iconv-lib-dir"
- LibdwIncludeDir -> "libdw-include-dir"
- LibdwLibDir -> "libdw-lib-dir"
- LibnumaIncludeDir -> "libnuma-include-dir"
- LibnumaLibDir -> "libnuma-lib-dir"
- LlvmTarget -> "llvm-target"
- ProjectGitCommitId -> "project-git-commit-id"
- ProjectName -> "project-name"
- ProjectVersion -> "project-version"
- ProjectVersionMunged -> "project-version-munged"
- ProjectVersionInt -> "project-version-int"
- ProjectPatchLevel -> "project-patch-level"
- ProjectPatchLevel1 -> "project-patch-level1"
- ProjectPatchLevel2 -> "project-patch-level2"
- SystemGhc -> "system-ghc"
- TargetArch -> "target-arch"
- TargetArmVersion -> "target-arm-version"
- TargetOs -> "target-os"
- TargetPlatform -> "target-platform"
- TargetPlatformFull -> "target-platform-full"
- TargetVendor -> "target-vendor"
- TargetArchHaskell -> "target-arch-haskell"
- TargetOsHaskell -> "target-os-haskell"
- TargetWordSize -> "target-word-size"
- BourneShell -> "bourne-shell"
+setting key = case key of
+ BuildArch -> systemConf "build-arch"
+ BuildOs -> systemConf "build-os"
+ BuildPlatform -> systemConf "build-platform"
+ BuildVendor -> systemConf "build-vendor"
+ CursesIncludeDir -> systemConf "curses-include-dir"
+ CursesLibDir -> systemConf "curses-lib-dir"
+ DynamicExtension -> systemConf "dynamic-extension"
+ FfiIncludeDir -> systemConf "ffi-include-dir"
+ FfiLibDir -> systemConf "ffi-lib-dir"
+ GhcMajorVersion -> systemConf "ghc-major-version"
+ GhcMinorVersion -> systemConf "ghc-minor-version"
+ GhcPatchLevel -> systemConf "ghc-patch-level"
+ GhcVersion -> systemConf "ghc-version"
+ GhcSourcePath -> systemConf "ghc-source-path"
+ GmpIncludeDir -> systemConf "gmp-include-dir"
+ GmpLibDir -> systemConf "gmp-lib-dir"
+ -- ROMES:TODO: What's the difference between hostArch and hostArchHaskell?
+ HostArch -> systemConf "host-arch"
+ HostOs -> systemConf "host-os"
+ HostPlatform -> systemConf "host-platform"
+ HostVendor -> systemConf "host-vendor"
+ HostArchHaskell -> hostConf archStr
+ HostOsHaskell -> hostConf osStr
+ IconvIncludeDir -> systemConf "iconv-include-dir"
+ IconvLibDir -> systemConf "iconv-lib-dir"
+ LibdwIncludeDir -> systemConf "libdw-include-dir"
+ LibdwLibDir -> systemConf "libdw-lib-dir"
+ LibnumaIncludeDir -> systemConf "libnuma-include-dir"
+ LibnumaLibDir -> systemConf "libnuma-lib-dir"
+ LlvmTarget -> systemConf "llvm-target"
+ ProjectGitCommitId -> systemConf "project-git-commit-id"
+ ProjectName -> systemConf "project-name"
+ ProjectVersion -> systemConf "project-version"
+ ProjectVersionMunged -> systemConf "project-version-munged"
+ ProjectVersionInt -> systemConf "project-version-int"
+ ProjectPatchLevel -> systemConf "project-patch-level"
+ ProjectPatchLevel1 -> systemConf "project-patch-level1"
+ ProjectPatchLevel2 -> systemConf "project-patch-level2"
+ SystemGhc -> systemConf "system-ghc"
+ TargetArch -> systemConf "target-arch"
+ TargetArmVersion -> systemConf "target-arm-version"
+ TargetOs -> systemConf "target-os"
+ TargetPlatform -> systemConf "target-platform"
+ TargetPlatformFull -> systemConf "target-platform-full"
+ TargetVendor -> systemConf "target-vendor"
+ TargetArchHaskell -> targetConf archStr
+ TargetOsHaskell -> targetConf osStr
+ TargetWordSize -> systemConf "target-word-size" -- targetConf tgtWordSize
+ BourneShell -> systemConf "bourne-shell"
+ where
+ systemConf = lookupSystemConfig
+ targetConf = queryTargetTargetConfig
+ hostConf = queryHostTargetConfig
+ archStr = stringEncodeArch . archOS_arch . tgtArchOs
+ osStr = stringEncodeOS . archOS_OS . tgtArchOs
bootIsStage0 :: Stage -> Stage
bootIsStage0 (Stage0 {}) = Stage0 InTreeLibs
@@ -213,7 +221,7 @@ settingsFileSetting key = case key of
ToolchainSetting_CxxCompilerFlags -> queryHostTargetConfig (flags . cxxProgram . tgtCxxCompiler)
ToolchainSetting_CCompilerLinkFlags -> queryHostTargetConfig (flags . ccLinkProgram . tgtCCompilerLink)
ToolchainSetting_CCompilerSupportsNoPie -> queryHostTargetConfig (yesNo . ccLinkSupportsNoPie . tgtCCompilerLink)
- -- ROMES:TODO: What's the difference between the Ld and CCLink?
+ -- ROMES:TODO: Rename LdCommand to CCLink
ToolchainSetting_LdCommand -> lookupSystemConfig "settings-ld-command"
ToolchainSetting_LdFlags -> lookupSystemConfig "settings-ld-flags"
ToolchainSetting_MergeObjectsCommand -> queryHostTargetConfig (maybe "" (cmd . mergeObjsProgram) . tgtMergeObjs)
=====================================
hadrian/src/Rules/Generate.hs
=====================================
@@ -448,9 +448,9 @@ generateSettings = do
, ("target arch", getSetting TargetArchHaskell)
, ("target word size", expr $ lookupSystemConfig "target-word-size")
, ("target word big endian", expr $ lookupSystemConfig "target-word-big-endian")
- , ("target has GNU nonexec stack", expr $ lookupSystemConfig "target-has-gnu-nonexec-stack")
- , ("target has .ident directive", expr $ lookupSystemConfig "target-has-ident-directive")
- , ("target has subsections via symbols", expr $ lookupSystemConfig "target-has-subsections-via-symbols")
+ , ("target has GNU nonexec stack", expr $ queryTargetTargetConfig (yesNo . Toolchain.tgtSupportsGnuNonexecStack))
+ , ("target has .ident directive", expr $ queryTargetTargetConfig (yesNo . Toolchain.tgtSupportsIdentDirective))
+ , ("target has subsections via symbols", expr $ queryTargetTargetConfig (yesNo . Toolchain.tgtSupportsSubsectionsViaSymbols))
, ("target has libm", expr $ lookupSystemConfig "target-has-libm")
, ("Unregisterised", expr $ yesNo <$> flag GhcUnregisterised)
, ("LLVM target", getSetting LlvmTarget)
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/4c6d4b60af69d90f627c9525fd8a7a95ce5cbf0d
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/4c6d4b60af69d90f627c9525fd8a7a95ce5cbf0d
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/20230512/7915fb4c/attachment-0001.html>
More information about the ghc-commits
mailing list