diff --git a/compiler/GHC/Driver/CodeOutput.hs b/compiler/GHC/Driver/CodeOutput.hs
index 5f5f9882c237aa0066bb74994c01b4bcccf597cb..4a969679324d148055865ff8c617eb29989d7249 100644
--- a/compiler/GHC/Driver/CodeOutput.hs
+++ b/compiler/GHC/Driver/CodeOutput.hs
@@ -224,6 +224,15 @@ outputLlvm logger dflags filenm cmm_stream = do
 ************************************************************************
 -}
 
+{-
+Note [Packaging libffi headers]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+The C code emitted by GHC for libffi adjustors must depend upon the ffi_arg type,
+defined in <ffi.h>. For this reason, we must ensure that <ffi.h> is available
+in binary distributions. To do so, we install these headers as part of the
+`rts` package.
+-}
+
 outputForeignStubs
     :: Logger
     -> TmpFs
diff --git a/hadrian/src/Rules/Libffi.hs b/hadrian/src/Rules/Libffi.hs
index e37faee5dc079721740ecb8ad893f826b6415b0f..8e62461202b7de9f4e5bda87e625f9aa34463531 100644
--- a/hadrian/src/Rules/Libffi.hs
+++ b/hadrian/src/Rules/Libffi.hs
@@ -103,6 +103,9 @@ libffiLocalName force_dynamic = do
 libffiLibrary :: FilePath
 libffiLibrary = "inst/lib/libffi.a"
 
+-- | These are the headers that we must package with GHC since foreign export
+-- adjustor code produced by GHC depends upon them.
+-- See Note [Packaging libffi headers] in GHC.Driver.CodeOutput.
 libffiHeaderFiles :: [FilePath]
 libffiHeaderFiles = ["ffi.h", "ffitarget.h"]
 
diff --git a/hadrian/src/Rules/Rts.hs b/hadrian/src/Rules/Rts.hs
index a6cd0f15d2f5d201f7dfc061bf7379c2f502dc0c..59a337801fcedda98eeed9001aae0e2e177e61b4 100644
--- a/hadrian/src/Rules/Rts.hs
+++ b/hadrian/src/Rules/Rts.hs
@@ -28,6 +28,7 @@ rtsRules = priority 3 $ do
         let buildPath = root -/- buildDir (rtsContext stage)
 
         -- Header files
+        -- See Note [Packaging libffi headers] in GHC.Driver.CodeOutput.
         forM_ libffiHeaderFiles $ \header ->
             buildPath -/- "include" -/- header %> copyLibffiHeader stage
 
@@ -46,6 +47,8 @@ withLibffi stage action = needLibffi stage
 
 -- | Copy a header files wither from the system libffi or from the libffi
 -- build dir to the rts build dir.
+--
+-- See Note [Packaging libffi headers] in GHC.Driver.CodeOutput.
 copyLibffiHeader :: Stage -> FilePath -> Action ()
 copyLibffiHeader stage header = do
     useSystemFfi <- flag UseSystemFfi
diff --git a/hadrian/src/Settings/Packages.hs b/hadrian/src/Settings/Packages.hs
index 43141610a7c99941432de647383eaadd492558f7..d4b8810810fb34c96063abe0359fc5a02cd40ccb 100644
--- a/hadrian/src/Settings/Packages.hs
+++ b/hadrian/src/Settings/Packages.hs
@@ -6,7 +6,6 @@ import Oracles.Setting
 import Oracles.Flag
 import Packages
 import Settings
-import Rules.Libffi
 
 -- | Package-specific command-line arguments.
 packageArgs :: Args
@@ -26,6 +25,8 @@ packageArgs = do
 
     cursesIncludeDir <- getSetting CursesIncludeDir
     cursesLibraryDir <- getSetting CursesLibDir
+    ffiIncludeDir  <- getSetting FfiIncludeDir
+    ffiLibraryDir  <- getSetting FfiLibDir
     debugAssertions  <- ghcDebugAssertions <$> expr flavour
 
     mconcat
@@ -139,7 +140,8 @@ packageArgs = do
           -- the Stage1 libraries, as we already know that the bootstrap
           -- compiler comes with the same versions as the one we are building.
           --
-            builder (Cabal Flags) ? ifM stage0
+            builder (Cabal Setup) ? cabalExtraDirs ffiIncludeDir ffiLibraryDir
+          , builder (Cabal Flags) ? ifM stage0
               (andM [cross, bootCross] `cabalFlag` "internal-interpreter")
               (arg "internal-interpreter")
 
@@ -269,7 +271,6 @@ rtsPackageArgs = package rts ? do
     path           <- getBuildPath
     top            <- expr topDirectory
     useSystemFfi   <- expr $ flag UseSystemFfi
-    ffiLibName     <- libffiName
     ffiIncludeDir  <- getSetting FfiIncludeDir
     ffiLibraryDir  <- getSetting FfiLibDir
     libdwIncludeDir   <- getSetting LibdwIncludeDir
@@ -296,8 +297,6 @@ rtsPackageArgs = package rts ? do
 
     let cArgs = mconcat
           [ rtsWarnings
-          , flag UseSystemFfi ? not (null ffiIncludeDir) ? arg ("-I" ++ ffiIncludeDir)
-          , flag WithLibdw ? not (null libdwIncludeDir) ? arg ("-I" ++ libdwIncludeDir)
           , arg "-fomit-frame-pointer"
           -- RTS *must* be compiled with optimisations. The INLINE_HEADER macro
           -- requires that functions are inlined to work as expected. Inlining
@@ -386,6 +385,7 @@ rtsPackageArgs = package rts ? do
         , builder (Cabal Setup) ? mconcat
               [ cabalExtraDirs libdwIncludeDir libdwLibraryDir
               , cabalExtraDirs libnumaIncludeDir libnumaLibraryDir
+              , useSystemFfi ? cabalExtraDirs ffiIncludeDir ffiLibraryDir
               ]
         , builder (Cc (FindCDependencies CDep)) ? cArgs
         , builder (Cc (FindCDependencies  CxxDep)) ? cArgs
@@ -394,11 +394,7 @@ rtsPackageArgs = package rts ? do
         , builder Ghc ? ghcArgs
 
         , builder HsCpp ? pure
-          [ "-DTOP="             ++ show top
-          , "-DFFI_INCLUDE_DIR=" ++ show ffiIncludeDir
-          , "-DFFI_LIB_DIR="     ++ show ffiLibraryDir
-          , "-DFFI_LIB="         ++ show ffiLibName
-          , "-DLIBDW_LIB_DIR="   ++ show libdwLibraryDir ]
+          [ "-DTOP="             ++ show top ]
 
         , builder HsCpp ? flag WithLibdw ? arg "-DUSE_LIBDW"
         , builder HsCpp ? flag HaveLibMingwEx ? arg "-DHAVE_LIBMINGWEX" ]
diff --git a/libraries/ghci/ghci.cabal.in b/libraries/ghci/ghci.cabal.in
index e9922ab24a57d4beffc88dbf461b7adbd21b35b0..06f7eca0c5147edf3053590fadabc570305fd0cd 100644
--- a/libraries/ghci/ghci.cabal.in
+++ b/libraries/ghci/ghci.cabal.in
@@ -58,8 +58,6 @@ library
             GHCi.StaticPtrTable
             GHCi.TH
 
-    include-dirs: @FFIIncludeDir@
-
     exposed-modules:
         GHCi.BreakArray
         GHCi.BinaryArray
diff --git a/rts/rts.cabal.in b/rts/rts.cabal.in
index 5e53b38be22afedc65207b347bc95234b184945a..3602db3b9105a1e3595a8c121720a19eb1e81055 100644
--- a/rts/rts.cabal.in
+++ b/rts/rts.cabal.in
@@ -163,7 +163,10 @@ library
     install-includes: Cmm.h HsFFI.h MachDeps.h Rts.h RtsAPI.h Stg.h
                       ghcautoconf.h ghcconfig.h ghcplatform.h ghcversion.h
                       -- ^ from include
-                      DerivedConstants.h ffi.h ffitarget.h
+                      DerivedConstants.h
+                      ffi.h ffitarget.h
+                      -- ^ see Note [Packaging libffi headers] in
+                      -- GHC.Driver.CodeOutput.
                       rts/EventLogConstants.h
                       rts/EventTypes.h
                       -- ^ generated