diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,10 @@
 # Revision history for byteslice
 
-## 0.2.5.1 -- 2021-02-22
+## 0.2.5.2 -- 2021-02-23
+
+* Correct compatibility shims.
+
+## 0.2.5.1 -- 2021-02-22 (deprecated)
 
 * Compatibility with GHC 9.0.
 
diff --git a/byteslice.cabal b/byteslice.cabal
--- a/byteslice.cabal
+++ b/byteslice.cabal
@@ -1,6 +1,6 @@
-cabal-version: 2.2
+cabal-version: 2.4
 name: byteslice
-version: 0.2.5.1
+version: 0.2.5.2
 synopsis: Slicing managed and unmanaged memory
 description:
   This library provides types that allow the user to talk about a slice of
@@ -32,6 +32,7 @@
     Data.Bytes.Pure
     Data.Bytes.IO
     UnliftedBytes
+    Cstrlen
   build-depends:
     , base >=4.11.1 && <5
     , bytestring >=0.10.8 && <0.11
@@ -48,6 +49,10 @@
   else
     hs-source-dirs: src-no-unlifted-newtypes
     ghc-options: -fno-warn-dodgy-imports -fno-warn-dodgy-exports
+  if impl(ghc>=9.0)
+    hs-source-dirs: src-ghc-cstrlen
+  else
+    hs-source-dirs: src-no-ghc-cstrlen
   default-language: Haskell2010
   include-dirs: include
   includes: bs_custom.h
diff --git a/src-ghc-cstrlen/Cstrlen.hs b/src-ghc-cstrlen/Cstrlen.hs
new file mode 100644
--- /dev/null
+++ b/src-ghc-cstrlen/Cstrlen.hs
@@ -0,0 +1,7 @@
+{-# language MagicHash #-}
+
+module Cstrlen
+  ( cstringLength#
+  ) where
+
+import GHC.Exts (cstringLength#)
diff --git a/src-no-ghc-cstrlen/Cstrlen.hs b/src-no-ghc-cstrlen/Cstrlen.hs
new file mode 100644
--- /dev/null
+++ b/src-no-ghc-cstrlen/Cstrlen.hs
@@ -0,0 +1,14 @@
+{-# language MagicHash #-}
+{-# language TypeFamilies #-}
+{-# language UnliftedFFITypes #-}
+
+module Cstrlen
+  ( cstringLength#
+  ) where
+
+import GHC.Exts (Addr#,Int#)
+
+foreign import ccall unsafe "strlen" c_strlen :: Addr# -> Int#
+
+cstringLength# :: Addr# -> Int#
+cstringLength# = c_strlen
diff --git a/src-no-unlifted-newtypes/UnliftedBytes.hs b/src-no-unlifted-newtypes/UnliftedBytes.hs
--- a/src-no-unlifted-newtypes/UnliftedBytes.hs
+++ b/src-no-unlifted-newtypes/UnliftedBytes.hs
@@ -2,20 +2,13 @@
 {-# language TypeFamilies #-}
 {-# language TypeInType #-}
 {-# language UndecidableInstances #-}
-{-# language UnliftedFFITypes #-}
 
 module UnliftedBytes
   ( Bytes#
-  , cstringLength#
   ) where
 
 import GHC.TypeLits
-import GHC.Exts (Addr#,Int#,RuntimeRep(..),TYPE)
+import GHC.Exts (RuntimeRep(..),TYPE)
 
 type family Bytes# :: TYPE ('TupleRep '[ 'UnliftedRep,'IntRep,'IntRep]) where
   Bytes# = TypeError ('Text "Bytes# not available before GHC 8.10")
-
-foreign import ccall unsafe "strlen" c_strlen :: Addr# -> Int#
-
-cstringLength# :: Addr# -> Int#
-cstringLength# = c_strlen
diff --git a/src-unlifted-newtypes/UnliftedBytes.hs b/src-unlifted-newtypes/UnliftedBytes.hs
--- a/src-unlifted-newtypes/UnliftedBytes.hs
+++ b/src-unlifted-newtypes/UnliftedBytes.hs
@@ -7,11 +7,9 @@
 
 module UnliftedBytes
   ( Bytes#(..)
-  , cstringLength#
   ) where
 
 import GHC.Exts (ByteArray#,Int#,RuntimeRep(..),TYPE)
-import GHC.Exts (cstringLength#)
 
 newtype Bytes# :: TYPE ('TupleRep '[ 'UnliftedRep,'IntRep,'IntRep]) where
   Bytes# :: (# ByteArray#, Int#, Int# #) -> Bytes#
diff --git a/src/Data/Bytes.hs b/src/Data/Bytes.hs
--- a/src/Data/Bytes.hs
+++ b/src/Data/Bytes.hs
@@ -151,7 +151,7 @@
 import GHC.Exts (Addr#,Word#,Int#)
 import GHC.IO (unsafeIOToST)
 import GHC.Word (Word8(W8#))
-import UnliftedBytes (cstringLength#)
+import Cstrlen (cstringLength#)
 
 import qualified Data.ByteString as ByteString
 import qualified Data.ByteString.Unsafe as ByteString
