diff options
-rw-r--r-- | compiler/main/DynFlags.hs | 2 | ||||
-rw-r--r-- | testsuite/tests/rts/all.T | 1 | ||||
-rw-r--r-- | testsuite/tests/rts/rdynamic.hs | 10 |
3 files changed, 9 insertions, 4 deletions
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index 5fa62b4541..0423e78bb6 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -2292,7 +2292,7 @@ dynamic_flags = [ #ifdef linux_HOST_OS addOptl "-rdynamic" #elif defined (mingw32_HOST_OS) - addOptl "-export-all-symbols" + addOptl "-Wl,--export-all-symbols" #else -- ignored for compat w/ gcc: id diff --git a/testsuite/tests/rts/all.T b/testsuite/tests/rts/all.T index 72566d1fd0..c9ad12bf5d 100644 --- a/testsuite/tests/rts/all.T +++ b/testsuite/tests/rts/all.T @@ -261,7 +261,6 @@ test('T10017', [ when(opsys('mingw32'), skip) , only_ways(threaded_ways), extra_run_opts('+RTS -N2 -RTS') ], compile_and_run, ['']) test('rdynamic', [ unless(opsys('linux') or opsys('mingw32'), skip) - , when(opsys('mingw32'), expect_broken(9381)) # this needs runtime infrastructure to do in ghci: # '-rdynamic' ghc, load modules only via dlopen(RTLD_BLOBAL) and more. , omit_ways(['ghci']) diff --git a/testsuite/tests/rts/rdynamic.hs b/testsuite/tests/rts/rdynamic.hs index 17f8df76cd..bbbe9e898d 100644 --- a/testsuite/tests/rts/rdynamic.hs +++ b/testsuite/tests/rts/rdynamic.hs @@ -11,7 +11,7 @@ module Main(main, f) where import Foreign.C.String ( withCString, CString ) import GHC.Exts ( addrToAny# ) import GHC.Ptr ( Ptr(..), nullPtr ) -import System.Info ( os ) +import System.Info ( os, arch ) import Encoding main = (loadFunction Nothing "Main" "f" :: IO (Maybe String)) >>= print @@ -37,7 +37,13 @@ loadFunction mpkg m valsym = do else case addrToAny# addr of (# hval #) -> return ( Just hval ) where - prefixUnderscore = if elem os ["darwin","mingw32","cygwin"] then "_" else "" + prefixUnderscore = case (os, arch) of + ("mingw32", "x86_64") -> "" + ("cygwin" , "x86_64") -> "" + ("mingw32", _ ) -> "_" + ("darwin" , _ ) -> "_" + ("cygwin" , _ ) -> "_" + _ -> "" foreign import ccall safe "lookupSymbol" c_lookupSymbol :: CString -> IO (Ptr a) foreign import ccall safe "initLinker" c_initLinker :: IO () |