Skip to content
Snippets Groups Projects
Commit 677d77f3 authored by Cheng Shao's avatar Cheng Shao :beach:
Browse files

ghc-internal: add missing CPPs for wasm

This patch adds some missing CPP guards to ghc-internal, given those
functions are non existent on wasm and would cause linking issues.

(cherry picked from commit a998f69d)
parent 4b0c1637
No related branches found
No related tags found
No related merge requests found
...@@ -112,13 +112,21 @@ forkOS_entry stableAction = do ...@@ -112,13 +112,21 @@ forkOS_entry stableAction = do
action <- deRefStablePtr stableAction action <- deRefStablePtr stableAction
action action
foreign import ccall forkOS_createThread
:: StablePtr (IO ()) -> IO CInt
failNonThreaded :: IO a failNonThreaded :: IO a
failNonThreaded = fail $ "RTS doesn't support multiple OS threads " failNonThreaded = fail $ "RTS doesn't support multiple OS threads "
++"(use ghc -threaded when linking)" ++"(use ghc -threaded when linking)"
#if defined(wasm32_HOST_ARCH)
forkOS _ = failNonThreaded
#else
foreign import ccall forkOS_createThread
:: StablePtr (IO ()) -> IO CInt
forkOS action0 forkOS action0
| rtsSupportsBoundThreads = do | rtsSupportsBoundThreads = do
mv <- newEmptyMVar mv <- newEmptyMVar
...@@ -141,6 +149,7 @@ forkOS action0 ...@@ -141,6 +149,7 @@ forkOS action0
freeStablePtr entry freeStablePtr entry
return tid return tid
| otherwise = failNonThreaded | otherwise = failNonThreaded
#endif
-- | Like 'forkIOWithUnmask', but the child thread is a bound thread, -- | Like 'forkIOWithUnmask', but the child thread is a bound thread,
-- as with 'forkOS'. -- as with 'forkOS'.
......
...@@ -732,8 +732,13 @@ foreign import capi unsafe "HsBase.h read" ...@@ -732,8 +732,13 @@ foreign import capi unsafe "HsBase.h read"
foreign import capi safe "HsBase.h read" foreign import capi safe "HsBase.h read"
c_safe_read :: CInt -> Ptr Word8 -> CSize -> IO CSsize c_safe_read :: CInt -> Ptr Word8 -> CSize -> IO CSsize
#if !defined(HAVE_UMASK)
c_umask :: CMode -> IO CMode
c_umask _ = ioError (ioeSetLocation unsupportedOperation "umask")
#else
foreign import ccall unsafe "HsBase.h umask" foreign import ccall unsafe "HsBase.h umask"
c_umask :: CMode -> IO CMode c_umask :: CMode -> IO CMode
#endif
-- See Note [Windows types] -- See Note [Windows types]
foreign import capi unsafe "HsBase.h write" foreign import capi unsafe "HsBase.h write"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment