diff --git a/libraries/base/GHC/ByteOrder.hs b/libraries/base/GHC/ByteOrder.hs
index 8a42e8df71eeca3e4cfa6518f8b02529dbfad228..7ec80d976dffad64d87d0067ed1d6d4e6a6b5ce8 100644
--- a/libraries/base/GHC/ByteOrder.hs
+++ b/libraries/base/GHC/ByteOrder.hs
@@ -17,6 +17,9 @@
 
 module GHC.ByteOrder where
 
+-- Required for WORDS_BIGENDIAN
+#include <ghcautoconf.h>
+
 -- | Byte ordering.
 data ByteOrder
     = BigEndian    -- ^ most-significant-byte occurs in lowest address.
diff --git a/libraries/base/GHC/IO/Encoding/CodePage/API.hs b/libraries/base/GHC/IO/Encoding/CodePage/API.hs
index b31ebe96f5d840b5b8b62d1a77a1abddf64edbb2..65a1b377db25429e16f7b7ac2c38c4c780e711f9 100644
--- a/libraries/base/GHC/IO/Encoding/CodePage/API.hs
+++ b/libraries/base/GHC/IO/Encoding/CodePage/API.hs
@@ -7,6 +7,9 @@ module GHC.IO.Encoding.CodePage.API (
     mkCodePageEncoding
   ) where
 
+-- Required for WORDS_BIGENDIAN
+#include <ghcautoconf.h>
+
 import Foreign.C
 import Foreign.Ptr
 import Foreign.Marshal
diff --git a/testsuite/tests/codeGen/should_run/T7600.hs b/testsuite/tests/codeGen/should_run/T7600.hs
index 4193fdc33f169b205b36bc9625c931be1067584e..18986c285019e7450a7ed237295249326435af44 100644
--- a/testsuite/tests/codeGen/should_run/T7600.hs
+++ b/testsuite/tests/codeGen/should_run/T7600.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP #-}
 -- !!! Bug # 7600.
 -- The LLVM backend can be tricky to get right with floating point constants
 -- and GHC. See Note [LLVM Float Types] in compiler/llvmGen/Llvm/Types.hs for
@@ -16,6 +17,9 @@
 -- Also worth looking at ticket # 3676 about issues with 'realToFrac'.
 module Main (main) where
 
+-- Required for WORDS_BIGENDIAN
+#include <ghcautoconf.h>
+
 import T7600_A
 
 -- a fp constant that requires double precision, but we only use a single