Commit b17ec567 authored by Tamar Christina's avatar Tamar Christina Committed by Ben Gamari

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
parent ab9403d5
......@@ -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
......
......@@ -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'])
......
......@@ -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 ()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment