diff --git a/CHANGES.markdown b/CHANGES.markdown
--- a/CHANGES.markdown
+++ b/CHANGES.markdown
@@ -1,3 +1,8 @@
+# 0.3.1
+ * Add support for GHC 9.8
+ * Drop support for GHC 8.2
+ * Add `--ghc-arg` as a command line argument, allowing users to pass additional arguments to GHC used to parse Haddock.
+
 # 0.3.0.1
  * Add support for GHC 9.6
 
diff --git a/README.markdown b/README.markdown
--- a/README.markdown
+++ b/README.markdown
@@ -34,6 +34,42 @@
 
 `doctest-parallel` will fail on comments that `haddock` also doesn't like. Sometimes (e.g., [#251](https://github.com/sol/doctest/issues/251)), this means that `doctest-parallel` will fail on input that GHC accepts.
 
+## Command line
+```
+Usage:
+  doctest [ options ]... [<module>]...
+  doctest --help
+  doctest --version
+  doctest --info
+
+Options:
+   -jN                      number of threads to use
+   --log-level=LEVEL        one of: debug, verbose, info, warning, error. Default: info.
+   --ghc-arg=ARG            pass argument to GHC when parsing, pass multiple times for multiple flags
+†  --implicit-module-import import module before testing it (default)
+†  --randomize-order        randomize order in which tests are run
+†  --seed=N                 use a specific seed to randomize test order
+†  --preserve-it            preserve the `it` variable between examples
+   --nix                    account for Nix build environments (default)
+   --quiet                  set log level to `Error`, shorthand for `--log-level=error`
+   --verbose                set log level to `Verbose`, shorthand for `--log-level=verbose`
+   --debug                  set log level to `Debug`, shorthand for `--log-level=debug`
+   --help                   display this help and exit
+   --version                output version information and exit
+   --info                   output machine-readable version information and exit
+
+Supported inverted options:
+   --no-nix
+†  --no-implicit-module-import
+†  --no-randomize-order (default)
+†  --no-preserve-it (default)
+
+Options marked with a dagger (†) can also be used to set module level options, using
+an ANN pragma like this:
+
+  {-# ANN module "doctest-parallel: --no-randomize-order" #-}
+```
+
 ## Example groups
 
 Examples from a single Haddock comment are grouped together and share the same
diff --git a/doctest-parallel.cabal b/doctest-parallel.cabal
--- a/doctest-parallel.cabal
+++ b/doctest-parallel.cabal
@@ -1,7 +1,7 @@
 cabal-version: 2.0
 
 name:           doctest-parallel
-version:        0.3.0.1
+version:        0.3.1
 synopsis:       Test interactive Haskell examples
 description:    The doctest program checks examples in source code comments.  It is modeled
                 after doctest for Python (<https://docs.python.org/3/library/doctest.html>).
@@ -17,15 +17,16 @@
 maintainer:     Martijn Bastiaan <martijn@hmbastiaan.nl>
 build-type:     Simple
 tested-with:
-    GHC == 8.2.2
-  , GHC == 8.4.4
+    GHC == 8.4.4
   , GHC == 8.6.5
   , GHC == 8.8.4
   , GHC == 8.10.7
   , GHC == 9.0.2
-  , GHC == 9.2.5
-  , GHC == 9.4.3
-  , GHC == 9.6.1
+  , GHC == 9.2.8
+  , GHC == 9.4.7
+  , GHC == 9.6.3
+  , GHC == 9.8.1
+
 extra-source-files:
     example/example.cabal
     example/src/Example.hs
@@ -91,7 +92,7 @@
       Data.List.Extra
       Paths_doctest_parallel
   build-depends:
-      Cabal >= 2.4 && < 3.10
+      Cabal >= 2.4 && < 3.11
     , Glob
     , base >=4.10 && <5
     , base-compat >=0.7.0
@@ -101,7 +102,7 @@
     , directory
     , exceptions
     , filepath
-    , ghc >=8.2 && <9.7
+    , ghc >=8.2 && <9.9
     , ghc-paths >=0.1.0.9
     , process
     , random >= 1.2
@@ -140,6 +141,7 @@
     DosLineEndings.Fib
     Failing.Foo
     FailingMultiple.Foo
+    GhcArg.Fib
     It.Foo
     It.Setup
     LocalStderrBinding.A
@@ -196,9 +198,9 @@
   build-depends:
       HUnit
     , QuickCheck >=2.13.1
-    , base >=4.5 && <5
-    , base-compat >=0.7.0
-    , code-page >=0.1
+    , base
+    , base-compat
+    , code-page
     , containers
     , doctest-parallel
     , deepseq
@@ -206,7 +208,7 @@
     , exceptions
     , filepath
     , ghc
-    , ghc-paths >=0.1.0.9
+    , ghc-paths
     , hspec >=2.3.0
     , hspec-core >=2.3.0
     , mockery
@@ -215,6 +217,6 @@
     , silently >=1.2.4
     , stringbuilder >=0.4
     , spectests-modules
-    , syb >=0.3
+    , syb
     , transformers
   default-language: Haskell2010
diff --git a/src/Test/DocTest.hs b/src/Test/DocTest.hs
--- a/src/Test/DocTest.hs
+++ b/src/Test/DocTest.hs
@@ -139,7 +139,7 @@
     implicitPrelude = DisableExtension ImplicitPrelude `notElem` libDefaultExtensions lib
     (includeArgs, moduleArgs, otherGhciArgs) = libraryToGhciArgs lib
     evalGhciArgs = otherGhciArgs ++ ["-XNoImplicitPrelude"] ++ nixGhciArgs
-    parseGhciArgs = includeArgs ++ moduleArgs ++ otherGhciArgs ++ nixGhciArgs
+    parseGhcArgs = includeArgs ++ moduleArgs ++ otherGhciArgs ++ nixGhciArgs ++ cfgGhcArgs
 
   let
     ?verbosity = cfgLogLevel
@@ -148,8 +148,8 @@
 
   -- Get examples from Haddock comments
   Logging.log Verbose "Parsing comments.."
-  Logging.log Debug ("Calling GHC API with: " <> unwords parseGhciArgs)
-  allModules <- getDocTests parseGhciArgs
+  Logging.log Debug ("Calling GHC API with: " <> unwords parseGhcArgs)
+  allModules <- getDocTests parseGhcArgs
 
   -- Run tests
   Logging.log Verbose "Running examples.."
diff --git a/src/Test/DocTest/Internal/Options.hs b/src/Test/DocTest/Internal/Options.hs
--- a/src/Test/DocTest/Internal/Options.hs
+++ b/src/Test/DocTest/Internal/Options.hs
@@ -2,6 +2,7 @@
 {-# LANGUAGE DeriveAnyClass #-}
 {-# LANGUAGE DeriveFunctor #-}
 {-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE RecordWildCards #-}
 
 module Test.DocTest.Internal.Options where
 
@@ -38,6 +39,7 @@
   , "Options:"
   , "   -jN                      number of threads to use"
   , "   --log-level=LEVEL        one of: debug, verbose, info, warning, error. Default: info."
+  , "   --ghc-arg=ARG            pass argument to GHC when parsing, pass multiple times for multiple flags"
   , "†  --implicit-module-import import module before testing it (default)"
   , "†  --randomize-order        randomize order in which tests are run"
   , "†  --seed=N                 use a specific seed to randomize test order"
@@ -105,6 +107,8 @@
   , cfgNix :: Bool
   -- ^ Detect Nix build environment and try to make GHC aware of the local package
   -- being tested.
+  , cfgGhcArgs :: [String]
+  -- ^ Extra arguments passed to GHC when parsing
   } deriving (Show, Eq, Generic, NFData)
 
 data ModuleConfig = ModuleConfig
@@ -136,6 +140,7 @@
   , cfgLogLevel = Info
   , cfgModuleConfig = defaultModuleConfig
   , cfgNix = True
+  , cfgGhcArgs = []
   }
 
 parseLocatedModuleOptions ::
@@ -164,7 +169,7 @@
     _ -> Nothing
 
 parseOptions :: [String] -> Result Config
-parseOptions = go defaultConfig
+parseOptions = fmap revGhcArgs . go defaultConfig
  where
   go config [] = Result config
   go config (arg:args) =
@@ -179,12 +184,30 @@
       "--no-nix" -> go config{cfgNix=False} args
       ('-':_) | Just n <- parseThreads arg -> go config{cfgThreads=Just n} args
       ('-':_) | Just l <- parseLogLevel arg -> go config{cfgLogLevel=l} args
+      ('-':_) | Just a <- parseGhcArg arg -> go (addGhcArg a config) args
       ('-':_)
         -- Module specific configuration options
         | Just modCfg <- parseModuleOption (cfgModuleConfig config) arg
        -> go config{cfgModuleConfig=modCfg} args
       ('-':_) -> ResultStderr ("Unknown command line argument: " <> arg)
       mod_ -> go config{cfgModules=mod_ : cfgModules config} args
+
+  addGhcArg :: String -> Config -> Config
+  addGhcArg arg Config{..} = Config{cfgGhcArgs=arg:cfgGhcArgs, ..}
+
+  revGhcArgs :: Config -> Config
+  revGhcArgs Config{..} = Config{cfgGhcArgs=reverse cfgGhcArgs, ..}
+
+-- | Parse ghc-arg argument
+--
+-- >>> parseGhcArg "--ghc-arg=foobar"
+-- Just "foobar"
+
+-- >>> parseGhcArg "--ghc-arg=-DFOO=3"
+-- Just "-DFOO=3"
+--
+parseGhcArg :: String -> Maybe String
+parseGhcArg arg = parseSpecificFlag arg "ghc-arg"
 
 -- | Parse seed argument
 --
diff --git a/test/MainSpec.hs b/test/MainSpec.hs
--- a/test/MainSpec.hs
+++ b/test/MainSpec.hs
@@ -74,6 +74,10 @@
       doctest ["FailingMultiple.Foo"]
         (cases 4) {sTried = 2, sFailures = 1}
 
+    it "use -DFIB=fib to set CPP flag" $
+      doctestWithOpts defaultConfig{cfgGhcArgs=["-DFIB=fib"]} ["GhcArg.Fib"]
+        (cases 1)
+
     it "testImport" $ do
       doctest ["TestImport.ModuleA"]
         (cases 2)
diff --git a/test/integration/GhcArg/Fib.hs b/test/integration/GhcArg/Fib.hs
new file mode 100644
--- /dev/null
+++ b/test/integration/GhcArg/Fib.hs
@@ -0,0 +1,12 @@
+{-# LANGUAGE CPP #-}
+
+module GhcArg.Fib where
+
+-- | Calculate Fibonacci numbers.
+--
+-- >>> FIB 10
+-- 55
+fib :: Integer -> Integer
+fib 0 = 0
+fib 1 = 1
+fib n = fib (n - 1) + fib (n - 2)
