diff --git a/ghc/lib/std/System.lhs b/ghc/lib/std/System.lhs
index 0b01d5afde8369156e0f256a32233e9ac7bb5744..f61bf9684152bb50ad3ddd9193c98ed0bdaf8c2e 100644
--- a/ghc/lib/std/System.lhs
+++ b/ghc/lib/std/System.lhs
@@ -5,7 +5,7 @@
 \section[System]{Module @System@}
 
 \begin{code}
-{-# OPTIONS -#include "cbits/stgio.h" #-}
+{-# OPTIONS -#include "cbits/stgio.h" -#include "RtsAPI.h" #-}
 module System 
     ( 
       ExitCode(ExitSuccess,ExitFailure)
@@ -142,7 +142,7 @@ exitWith (ExitFailure n)
     primExit n
     ioError (IOError Nothing OtherError "exitWith" "exit should not return")
 
-foreign import ccall "libHS_cbits.so" "exit" unsafe primExit :: Int -> IO ()
+foreign import ccall "shutdownHaskellAndExit" primExit :: Int -> IO ()
 
 exitFailure :: IO a
 exitFailure = exitWith (ExitFailure 1)