diff --git a/GHC/Data/ShortText.hs b/GHC/Data/ShortText.hs
--- a/GHC/Data/ShortText.hs
+++ b/GHC/Data/ShortText.hs
@@ -24,6 +24,10 @@
 
 -- Very similar to FastString, but not hash-consed and with some extra instances and
 -- functions for serialisation and I/O. Should be imported qualified.
+--
+-- /Note:/ This string is stored in Modified UTF8 format,
+-- thus it's not byte-compatible with @ShortText@ type in @text-short@
+-- package.
 
 module GHC.Data.ShortText (
         -- * ShortText
diff --git a/GHC/Data/SizedSeq.hs b/GHC/Data/SizedSeq.hs
--- a/GHC/Data/SizedSeq.hs
+++ b/GHC/Data/SizedSeq.hs
@@ -1,4 +1,4 @@
-{-# LANGUAGE StandaloneDeriving, DeriveGeneric, CPP #-}
+{-# LANGUAGE StandaloneDeriving, DeriveGeneric #-}
 module GHC.Data.SizedSeq
   ( SizedSeq(..)
   , emptySS
@@ -11,12 +11,9 @@
 import Prelude -- See note [Why do we import Prelude here?]
 import Control.DeepSeq
 import Data.Binary
+import Data.List (genericLength)
 import GHC.Generics
 
-#if ! MIN_VERSION_base(4,20,0)
-import Data.List (foldl')
-#endif
-
 data SizedSeq a = SizedSeq {-# UNPACK #-} !Word [a]
   deriving (Generic, Show)
 
@@ -40,9 +37,9 @@
 addToSS :: SizedSeq a -> a -> SizedSeq a
 addToSS (SizedSeq n r_xs) x = SizedSeq (n+1) (x:r_xs)
 
--- NB, important this is eta-expand so that foldl' is inlined.
 addListToSS :: SizedSeq a -> [a] -> SizedSeq a
-addListToSS s xs = foldl' addToSS s xs
+addListToSS (SizedSeq n r_xs) xs
+  = SizedSeq (n + genericLength xs) (reverse xs ++ r_xs)
 
 ssElts :: SizedSeq a -> [a]
 ssElts (SizedSeq _ r_xs) = reverse r_xs
diff --git a/GHC/Settings/Utils.hs b/GHC/Settings/Utils.hs
--- a/GHC/Settings/Utils.hs
+++ b/GHC/Settings/Utils.hs
@@ -8,6 +8,7 @@
 
 import GHC.BaseDir
 import GHC.Platform.ArchOS
+import System.FilePath
 
 maybeRead :: Read a => String -> Maybe a
 maybeRead str = case reads str of
@@ -41,6 +42,12 @@
 getTargetArchOS settingsFile settings =
   ArchOS <$> readRawSetting settingsFile settings "target arch"
          <*> readRawSetting settingsFile settings "target os"
+
+getGlobalPackageDb :: FilePath -> RawSettings -> Either String FilePath
+getGlobalPackageDb settingsFile settings = do
+  rel_db <- getRawSetting settingsFile settings "Relative Global Package DB"
+  return (dropFileName settingsFile </> rel_db)
+
 
 
 getRawSetting
diff --git a/GHC/Utils/Encoding.hs b/GHC/Utils/Encoding.hs
--- a/GHC/Utils/Encoding.hs
+++ b/GHC/Utils/Encoding.hs
@@ -79,7 +79,7 @@
         :+              ZCzp
         ()              Z0T     0-tuple
         (,,,,)          Z5T     5-tuple
-        (# #)           Z1H     unboxed 1-tuple (note the space)
+        (##)            Z0H     unboxed 0-tuple
         (#,,,,#)        Z5H     unboxed 5-tuple
 -}
 
@@ -212,7 +212,6 @@
     go n (c : rest) | isDigit c = go (10*n + digitToInt c) rest
     go 0 ('T':rest)     = "()" ++ zDecodeString rest
     go n ('T':rest)     = '(' : replicate (n-1) ',' ++ ")" ++ zDecodeString rest
-    go 1 ('H':rest)     = "(# #)" ++ zDecodeString rest
     go n ('H':rest)     = '(' : '#' : replicate (n-1) ',' ++ "#)" ++ zDecodeString rest
     go n other = error ("decode_tuple: " ++ show n ++ ' ':other)
 
@@ -223,15 +222,13 @@
         Z<digit>
 
 * "(##)" is the tycon for an unboxed 0-tuple
-* "(# #)" is the tycon for an unboxed 1-tuple
 
-* "()" is the tycon for a boxed 0-tuple.
+* "()" is the tycon for a boxed 0-tuple
 -}
 
 maybe_tuple :: UserString -> Maybe EncodedString
 
 maybe_tuple "(##)" = Just("Z0H")
-maybe_tuple "(# #)" = Just("Z1H")
 maybe_tuple ('(' : '#' : cs) = case count_commas (0::Int) cs of
                                  (n, '#' : ')' : _) -> Just ('Z' : shows (n+1) "H")
                                  _                  -> Nothing
diff --git a/GHC/Utils/Encoding/UTF8.hs b/GHC/Utils/Encoding/UTF8.hs
--- a/GHC/Utils/Encoding/UTF8.hs
+++ b/GHC/Utils/Encoding/UTF8.hs
@@ -7,7 +7,7 @@
 -- of the package database (needed in both ghc and in ghc-pkg) lives in
 -- `ghc-boot` and uses ShortText, which in turn depends on this module.
 
--- | Simple, non-streaming UTF-8 codecs.
+-- | Simple, non-streaming Modified UTF-8 codecs.
 --
 -- This is one of several UTF-8 implementations provided by GHC; see Note
 -- [GHC's many UTF-8 implementations] in "GHC.Encoding.UTF8" for an
diff --git a/ghc-boot.cabal b/ghc-boot.cabal
--- a/ghc-boot.cabal
+++ b/ghc-boot.cabal
@@ -5,7 +5,7 @@
 -- ghc-boot.cabal.
 
 name:           ghc-boot
-version:        9.10.3
+version:        9.12.1
 license:        BSD-3-Clause
 license-file:   LICENSE
 category:       GHC
@@ -28,13 +28,22 @@
 extra-source-files: changelog.md
 
 custom-setup
-    setup-depends: base >= 3 && < 5, Cabal >= 1.6 && <3.10, directory, filepath
+    setup-depends: base >= 3 && < 5, Cabal >= 1.6 && <3.14, directory, filepath
 
 source-repository head
     type:     git
     location: https://gitlab.haskell.org/ghc/ghc.git
     subdir:   libraries/ghc-boot
 
+Flag bootstrap
+        Description:
+          Enabled when building the stage1 compiler in order to vendor the in-tree
+          `template-haskell` library (including its dependency `ghc-boot-th`), while
+          allowing dependencies to depend on the boot `template-haskell` library.
+          See Note [Bootstrapping Template Haskell]
+        Default: False
+        Manual: True
+
 Library
     default-language: Haskell2010
     other-extensions: DeriveGeneric, RankNTypes, ScopedTypeVariables
@@ -56,13 +65,6 @@
             GHC.UniqueSubdir
             GHC.Version
 
-    -- reexport modules from ghc-boot-th so that packages don't have to import
-    -- both ghc-boot and ghc-boot-th. It makes the dependency graph easier to
-    -- understand and to refactor.
-    reexported-modules:
-              GHC.LanguageExtensions.Type
-            , GHC.ForeignSrcLang.Type
-            , GHC.Lexeme
 
     -- reexport platform modules from ghc-platform
     reexported-modules:
@@ -73,7 +75,7 @@
             GHC.Version
             GHC.Platform.Host
 
-    build-depends: base       >= 4.7 && < 4.21,
+    build-depends: base       >= 4.7 && < 4.22,
                    binary     == 0.8.*,
                    bytestring >= 0.10 && < 0.13,
                    containers >= 0.5 && < 0.8,
@@ -81,7 +83,22 @@
                    filepath   >= 1.3 && < 1.6,
                    deepseq    >= 1.4 && < 1.6,
                    ghc-platform >= 0.1,
-                   ghc-boot-th == 9.10.3
+
+    -- reexport modules from ghc-boot-th so that packages
+    -- don't have to import all of ghc-boot and ghc-boot-th.
+    -- It makes the dependency graph easier to understand.
+    reexported-modules:
+            GHC.LanguageExtensions.Type
+          , GHC.ForeignSrcLang.Type
+          , GHC.Lexeme
+
+    if flag(bootstrap)
+      build-depends:
+              ghc-boot-th-next    == 9.12.1
+    else
+      build-depends:
+              ghc-boot-th         == 9.12.1
+
     if !os(windows)
         build-depends:
                    unix       >= 2.7 && < 2.9
