On Wed, 11 Jun 2014 21:35:57 +0300 Sergei Trofimovich <sly...@gentoo.org> wrote:
> On Wed, 11 Jun 2014 08:18:30 +0000 > Simon Peyton Jones <simo...@microsoft.com> wrote: > > > Stefan, Guys > > This commit breaks the Windows build (ie my laptop) > > > > commit 9fd507e5758f4141ac2619f0db57136bcab035c6 > > > > Author: Sergei Trofimovich <sly...@gentoo.org> > > > > Date: Fri May 23 23:58:06 2014 +0300 > > > > > > > > Raise exceptions when blocked in bad FDs (fixes Trac #4934) > > The breakage is this: > > > > C:/code/HEAD/rts/dist/build/libHSrts.a(RtsStartup.o):RtsStartup.c:(.text+0x2aa): > > undefined reference to `base_GHCziEventziThread_blockedOnBadFD_closure' > > The reason is, I think that that this line in RtsStartup.c should be inside > > the guard #ifndef mingw32_HOST_OS > > > > getStablePtr((StgPtr)blockedOnBadFD_closure); > > I'd do that myself but I am not confident that the fix is correct; and I > > would like to add a comment to explain why the getStablePtr is > > non-windows-only. > > Can someone do this, please? > > Oh, I've missed the fact GHC.Event.Thread in a non-windows thing. > The whole patch was for posix-only platform, but i tried to export > that exception for all platforms. > > CCed Simon M. > > There is 2 routes: > a) move an exception a common module to all platforms. > For example to Foreign.C.Error (I've started to prepare a patch) To avoid import loops and make things clear I've moved it to GHC.Exception.RTS (other from-rts exceptions can be pushded there as well) Patch is in attach. Please review. Thank you! -- Sergei
From 9fd22821be997c5b75b84c3528351e8dc678882f Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich <sly...@gentoo.org> Date: Wed, 11 Jun 2014 22:18:41 +0300 Subject: [PATCH] rts: fix linkage on windows (missing blockedOnBadFD_closure) commit 9fd507e5758f4141ac2619f0db57136bcab035c6 declared to RTS exception object, but defined it in UNIX-specific module GHC.Event.Thread. It led to linkage error: C:/code/HEAD/rts/dist/build/libHSrts.a(RtsStartup.o):RtsStartup.c:(.text+0x2aa): undefined reference to `base_GHCziEventziThread_blockedOnBadFD_closure' Fixed by moving exception object to separate module GHC.Exception.RTS. Reported-by: Simon Peyton Jones <simo...@microsoft.com> Signed-off-by: Sergei Trofimovich <sly...@gentoo.org> --- libraries/base/GHC/Event/Thread.hs | 7 +------ libraries/base/GHC/Exception/RTS.hs | 25 +++++++++++++++++++++++++ libraries/base/base.cabal | 1 + rts/Prelude.h | 4 ++-- rts/package.conf.in | 4 ++-- rts/win32/libHSbase.def | 2 +- 6 files changed, 32 insertions(+), 11 deletions(-) create mode 100644 libraries/base/GHC/Exception/RTS.hs diff --git a/libraries/base/GHC/Event/Thread.hs b/libraries/base/GHC/Event/Thread.hs index 6e991bf..eb6b6c7 100644 --- a/libraries/base/GHC/Event/Thread.hs +++ b/libraries/base/GHC/Event/Thread.hs @@ -12,10 +12,9 @@ module GHC.Event.Thread , closeFdWith , threadDelay , registerDelay - , blockedOnBadFD -- used by RTS ) where -import Control.Exception (finally, SomeException, toException) +import Control.Exception (finally) import Control.Monad (forM, forM_, sequence_, zipWithM, when) import Data.IORef (IORef, newIORef, readIORef, writeIORef) import Data.List (zipWith3) @@ -116,10 +115,6 @@ threadWait evt fd = mask_ $ do then ioError $ errnoToIOError "threadWait" eBADF Nothing Nothing else return () --- used at least by RTS in 'select()' IO manager backend -blockedOnBadFD :: SomeException -blockedOnBadFD = toException $ errnoToIOError "awaitEvent" eBADF Nothing Nothing - threadWaitSTM :: Event -> Fd -> IO (STM (), IO ()) threadWaitSTM evt fd = mask_ $ do m <- newTVarIO Nothing diff --git a/libraries/base/GHC/Exception/RTS.hs b/libraries/base/GHC/Exception/RTS.hs new file mode 100644 index 0000000..9892e6e --- /dev/null +++ b/libraries/base/GHC/Exception/RTS.hs @@ -0,0 +1,25 @@ +----------------------------------------------------------------------------- +-- | +-- Module : GHC.Exception +-- Copyright : (c) The University of Glasgow, 1998-2002 +-- License : see libraries/base/LICENSE +-- +-- Maintainer : cvs-...@haskell.org +-- Stability : internal +-- Portability : non-portable (GHC extensions) +-- +-- Exceptions thrown by C RTS code. +-- +----------------------------------------------------------------------------- + +module GHC.Exception.RTS + ( + blockedOnBadFD + ) where + +import Control.Exception +import Foreign.C.Error + +-- used at least by RTS in 'select()' IO manager backend +blockedOnBadFD :: SomeException +blockedOnBadFD = toException $ errnoToIOError "awaitEvent" eBADF Nothing Nothing diff --git a/libraries/base/base.cabal b/libraries/base/base.cabal index e56724c..8537843 100644 --- a/libraries/base/base.cabal +++ b/libraries/base/base.cabal @@ -276,6 +276,7 @@ Library Control.Monad.ST.Imp Control.Monad.ST.Lazy.Imp Foreign.ForeignPtr.Imp + GHC.Exception.RTS System.Environment.ExecutablePath c-sources: diff --git a/rts/Prelude.h b/rts/Prelude.h index 0c54148..c0e15ae 100644 --- a/rts/Prelude.h +++ b/rts/Prelude.h @@ -42,7 +42,7 @@ PRELUDE_CLOSURE(base_GHCziIOziException_blockedIndefinitelyOnMVar_closure); PRELUDE_CLOSURE(base_GHCziIOziException_blockedIndefinitelyOnSTM_closure); PRELUDE_CLOSURE(base_ControlziExceptionziBase_nonTermination_closure); PRELUDE_CLOSURE(base_ControlziExceptionziBase_nestedAtomically_closure); -PRELUDE_CLOSURE(base_GHCziEventziThread_blockedOnBadFD_closure); +PRELUDE_CLOSURE(base_GHCziExceptionziRTS_blockedOnBadFD_closure); PRELUDE_CLOSURE(base_GHCziConcziSync_runSparks_closure); PRELUDE_CLOSURE(base_GHCziConcziIO_ensureIOManagerIsRunning_closure); @@ -105,7 +105,7 @@ PRELUDE_INFO(base_GHCziStable_StablePtr_con_info); #define blockedIndefinitelyOnSTM_closure DLL_IMPORT_DATA_REF(base_GHCziIOziException_blockedIndefinitelyOnSTM_closure) #define nonTermination_closure DLL_IMPORT_DATA_REF(base_ControlziExceptionziBase_nonTermination_closure) #define nestedAtomically_closure DLL_IMPORT_DATA_REF(base_ControlziExceptionziBase_nestedAtomically_closure) -#define blockedOnBadFD_closure DLL_IMPORT_DATA_REF(base_GHCziEventziThread_blockedOnBadFD_closure) +#define blockedOnBadFD_closure DLL_IMPORT_DATA_REF(base_GHCziExceptionziRTS_blockedOnBadFD_closure) #define Czh_static_info DLL_IMPORT_DATA_REF(ghczmprim_GHCziTypes_Czh_static_info) #define Fzh_static_info DLL_IMPORT_DATA_REF(ghczmprim_GHCziTypes_Fzh_static_info) diff --git a/rts/package.conf.in b/rts/package.conf.in index 8250bc2..5acf8a5 100644 --- a/rts/package.conf.in +++ b/rts/package.conf.in @@ -99,7 +99,7 @@ ld-options: , "-Wl,-u,_base_GHCziIOziException_blockedIndefinitelyOnMVar_closure" , "-Wl,-u,_base_GHCziIOziException_blockedIndefinitelyOnSTM_closure" , "-Wl,-u,_base_ControlziExceptionziBase_nestedAtomically_closure" - , "-Wl,-u,_base_GHCziEventziThread_blockedOnBadFD_closure" + , "-Wl,-u,_base_GHCziExceptionziRTS_blockedOnBadFD_closure" , "-Wl,-u,_base_GHCziWeak_runFinalizzerBatch_closure" , "-Wl,-u,_base_GHCziTopHandler_flushStdHandles_closure" , "-Wl,-u,_base_GHCziTopHandler_runIO_closure" @@ -140,7 +140,7 @@ ld-options: , "-Wl,-u,base_GHCziIOziException_blockedIndefinitelyOnMVar_closure" , "-Wl,-u,base_GHCziIOziException_blockedIndefinitelyOnSTM_closure" , "-Wl,-u,base_ControlziExceptionziBase_nestedAtomically_closure" - , "-Wl,-u,base_GHCziEventziThread_blockedOnBadFD_closure" + , "-Wl,-u,base_GHCziExceptionziRTS_blockedOnBadFD_closure" , "-Wl,-u,base_GHCziWeak_runFinalizzerBatch_closure" , "-Wl,-u,base_GHCziTopHandler_flushStdHandles_closure" , "-Wl,-u,base_GHCziTopHandler_runIO_closure" diff --git a/rts/win32/libHSbase.def b/rts/win32/libHSbase.def index 8140528..b9f14e3 100644 --- a/rts/win32/libHSbase.def +++ b/rts/win32/libHSbase.def @@ -40,4 +40,4 @@ EXPORTS base_ControlziExceptionziBase_nonTermination_closure base_ControlziExceptionziBase_nestedAtomically_closure - base_GHCziEventziThread_blockedOnBadFD_closure + base_GHCziExceptionziRTS_blockedOnBadFD_closure -- 2.0.0
signature.asc
Description: PGP signature
_______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://www.haskell.org/mailman/listinfo/ghc-devs