[Git][ghc/ghc][wip/toolchain-selection] The dreadful note I'll silently squash

Rodrigo Mesquita (@alt-romes) gitlab at gitlab.haskell.org
Mon Jul 17 20:30:48 UTC 2023



Rodrigo Mesquita pushed to branch wip/toolchain-selection at Glasgow Haskell Compiler / GHC


Commits:
72c5977c by Rodrigo Mesquita at 2023-07-17T21:30:39+01:00
The dreadful note I'll silently squash

- - - - -


2 changed files:

- hadrian/src/Settings.hs
- m4/ghc_toolchain.m4


Changes:

=====================================
hadrian/src/Settings.hs
=====================================
@@ -111,6 +111,10 @@ unsafeFindPackageByPath path = err $ find (\pkg -> pkgPath pkg == path) knownPac
     err = fromMaybe $ error ("findPackageByPath: No package for path " ++ path)
 
 -- * Combinators for querying configuration defined in the toolchain
+--
+-- Be careful querying values from the HOST and BUILD targets until the targets
+-- are only generated by ghc-toolchain:
+-- See Note [The dummy values in the HOST target description]
 queryBuild, queryHost, queryTarget :: (Target -> a) -> Expr a
 queryBuild  f = expr $ queryBuildTarget f
 queryHost   f = expr $ queryHostTarget f


=====================================
m4/ghc_toolchain.m4
=====================================
@@ -57,8 +57,7 @@ AC_DEFUN([FIND_GHC_TOOLCHAIN],
     echo "--cc-link=$CC_STAGE0" >> acargs
     echo "--ar=$AR_STAGE0" >> acargs
     dnl The remaining tools we don't configure for the host.
-
-    echo "ACARGS-HOST"
+    dnl See Note [The dummy values in the HOST target description]
 
     INVOKE_GHC_TOOLCHAIN()
 
@@ -95,22 +94,10 @@ AC_DEFUN([FIND_GHC_TOOLCHAIN],
     ENABLE_GHC_TOOLCHAIN_ARG([unregisterised], [$Unregisterised])
     ENABLE_GHC_TOOLCHAIN_ARG([tables-next-to-code], [$TablesNextToCode])
 
-    echo "ACARGS-TARGET"
-
     INVOKE_GHC_TOOLCHAIN()
 
     rm -Rf acargs acghc-toolchain actmp-ghc-toolchain
 
-    dnl ADD_GHC_TOOLCHAIN_ARG([hs-cpp-opt], [$HaskellCPPArgs])
-    dnl ADD_GHC_TOOLCHAIN_ARG([cpp-opt], [$CONF_CPP_OPTS_STAGE1])
-    dnl ADD_GHC_TOOLCHAIN_ARG([cc-link-opt], [$CONF_GCC_LINK_OPTS_STAGE1])
-    dnl ADD_GHC_TOOLCHAIN_ARG([cxx-opt], [$CONF_CXX_OPTS_STAGE1])
-    dnl ADD_GHC_TOOLCHAIN_ARG([ar-opt], [$ARFLAGS])
-    dnl ADD_GHC_TOOLCHAIN_ARG([ranlib-opt], [$RANLIBFLAGS])
-    dnl ADD_GHC_TOOLCHAIN_ARG([nm-opt], [$NMFLAGS])
-    dnl ADD_GHC_TOOLCHAIN_ARG([readelf-opt], [$READELFFLAGS])
-    dnl ADD_GHC_TOOLCHAIN_ARG([cc-opt], [$CONF_CC_OPTS_STAGE1])
-
     dnl Note: if we weren't passing the paths to the programs explicitly, to make
     dnl ghc-toolchain use the bundled windows toolchain, simply add it to the search PATH
 ])
@@ -149,3 +136,22 @@ AC_DEFUN([VALIDATE_GHC_TOOLCHAIN],[
       ])
     fi
 ])
+
+dnl Note [The dummy values in the HOST target description]
+dnl ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+dnl In configure, we don't configure nearly as much tools for
+dnl the HOST toolchain as we do for the TARGET toolchain. This is because
+dnl Hadrian only depends on certain properties and tools of the HOST toolchain,
+dnl and, ultimately, the shipped GHC has in `settings` the TARGET toolchain and
+dnl properties. (In constrast, ghc-toolchain can as easily configure 1
+dnl toolchain as it can 100)
+dnl
+dnl Unfortunately, we need to produce a valid Target value to write to default.host.target.
+dnl Since we don't configure the values required to substitute into the
+dnl toolchain, we simply use /dummy/ values, as conservatively as possible.
+dnl Regardless of the conservative values, we assume that hadrian will never
+dnl look at these settings, as they previously didn't exist.
+dnl
+dnl In practice, Hadrian should only access the *_STAGE0 settings that were
+dnl available before the ghc-toolchain: Toolchain Selection commit.
+



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/72c5977cb53a2abc3f3440e78e6dc53daa98ca57

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/72c5977cb53a2abc3f3440e78e6dc53daa98ca57
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/20230717/1950907c/attachment-0001.html>


More information about the ghc-commits mailing list