[commit: ghc] master: Fix rdynamic flag and test on Windows (b17ec56)

git at git.haskell.org git at git.haskell.org
Tue Aug 18 16:33:24 UTC 2015


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/b17ec5674f26b0b65dda4ec446e0b9b5336b7562/ghc

>---------------------------------------------------------------

commit b17ec5674f26b0b65dda4ec446e0b9b5336b7562
Author: Tamar Christina <tamar at zhox.com>
Date:   Tue Aug 18 17:59:04 2015 +0200

    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


>---------------------------------------------------------------

b17ec5674f26b0b65dda4ec446e0b9b5336b7562
 compiler/main/DynFlags.hs       |  2 +-
 testsuite/tests/rts/all.T       |  1 -
 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 5fa62b4..0423e78 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 72566d1..c9ad12b 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 17f8df7..bbbe9e8 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 ()



More information about the ghc-commits mailing list