summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTamar Christina <tamar@zhox.com>2015-08-18 17:59:04 +0200
committerBen Gamari <bgamari.foss@gmail.com>2015-08-18 12:32:28 -0400
commitb17ec5674f26b0b65dda4ec446e0b9b5336b7562 (patch)
tree0fbecb3f597d489b7c797c734f59d32c5c5370c8
parentab9403d5e6eb4f0a2e917d7edcd5821262432b26 (diff)
downloadhaskell-b17ec5674f26b0b65dda4ec446e0b9b5336b7562.tar.gz
Fix rdynamic flag and test on Windows
The rdynamic tests and feature are marked broken on windows. This is because the flag used doesn't exist and the symbol lookup in the test did not account for platform differences in name mangling. This commit fixes the flag and tests for rdynamic on windows. Test Plan: make TEST="rdynamic" on both x86 and x86_64 Reviewers: austin, thomie, bgamari Reviewed By: thomie, bgamari Subscribers: #ghc_windows_task_force Differential Revision: https://phabricator.haskell.org/D1149 GHC Trac Issues: #9381
-rw-r--r--compiler/main/DynFlags.hs2
-rw-r--r--testsuite/tests/rts/all.T1
-rw-r--r--testsuite/tests/rts/rdynamic.hs10
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 ()