Ben Gamari pushed to branch wip/T26166 at Glasgow Haskell Compiler / GHC

Commits:

2 changed files:

Changes:

  • testsuite/tests/ghci/linking/dyn/Makefile
    ... ... @@ -50,7 +50,7 @@ MY_TEST_HC_OPTS = $(TEST_HC_OPTS) $(CFLAGS)
    50 50
     load_short_name:
    
    51 51
     	rm -rf bin_short
    
    52 52
     	mkdir bin_short
    
    53
    -	'$(TEST_HC)' $(MY_TEST_HC_OPTS) -odir "bin_short" -shared A.c -o "bin_short/$(call DLL,A)"
    
    53
    +	'$(TEST_HC)' $(MY_TEST_HC_OPTS) -odir "bin_short" -dynamic -shared A.c -o "bin_short/$(call DLL,A)"
    
    54 54
     	rm -f bin_short/*.a
    
    55 55
     	echo ":q" | "$(TEST_HC)" $(TEST_HC_OPTS_INTERACTIVE) -L"./bin_short" -lA
    
    56 56
     
    
    ... ... @@ -58,14 +58,14 @@ load_short_name:
    58 58
     compile_libT1407:
    
    59 59
     	rm -rf T1407dir
    
    60 60
     	mkdir T1407dir
    
    61
    -	'$(TEST_HC)' $(MY_TEST_HC_OPTS) -odir "T1407dir" -shared A.c -o "T1407dir/$(call DLL,AS)"
    
    61
    +	'$(TEST_HC)' $(MY_TEST_HC_OPTS) -odir "T1407dir" -dynamic -shared A.c -o "T1407dir/$(call DLL,AS)"
    
    62 62
     	rm -f T1407dir/libAS*.a
    
    63 63
     
    
    64 64
     .PHONY: compile_libT10458
    
    65 65
     compile_libT10458:
    
    66 66
     	rm -rf T10458dir
    
    67 67
     	mkdir T10458dir
    
    68
    -	'$(TEST_HC)' $(MY_TEST_HC_OPTS) -odir "T10458dir" -shared A.c -o "T10458dir/$(call DLL,AS)"
    
    68
    +	'$(TEST_HC)' $(MY_TEST_HC_OPTS) -odir "T10458dir" -dynamic -shared A.c -o "T10458dir/$(call DLL,AS)"
    
    69 69
     	rm -f T10458dir/libAS*.a
    
    70 70
     
    
    71 71
     .PHONY: compile_libAB_dep
    
    ... ... @@ -80,8 +80,8 @@ compile_libAB_dep:
    80 80
     compile_libAB_dyn:
    
    81 81
     	rm -rf bin_dyn
    
    82 82
     	mkdir bin_dyn
    
    83
    -	'$(TEST_HC)' $(MY_TEST_HC_OPTS) -odir "bin_dyn" -shared A.c -o "bin_dyn/$(call DLL,A)" $(call DEF,A)
    
    84
    -	'$(TEST_HC)' $(MY_TEST_HC_OPTS) -odir "bin_dyn" -shared B.c -o "bin_dyn/$(call DLL,B)" $(call DEF,B) -lA -L"./bin_dyn"
    
    83
    +	'$(TEST_HC)' $(MY_TEST_HC_OPTS) -odir "bin_dyn" -dynamic -shared A.c -o "bin_dyn/$(call DLL,A)" $(call DEF,A)
    
    84
    +	'$(TEST_HC)' $(MY_TEST_HC_OPTS) -odir "bin_dyn" -dynamic -shared B.c -o "bin_dyn/$(call DLL,B)" $(call DEF,B) -lA -L"./bin_dyn"
    
    85 85
     	rm -f bin_dyn/*.a
    
    86 86
     	'$(TEST_HC)' $(TEST_HC_OPTS) -ignore-dot-ghci -v0 -o "bin_dyn/$(call EXE,T10955dyn)" -L./bin_dyn -lB -lA T10955dyn.hs -v0
    
    87 87
     	DYLD_LIBRARY_PATH=./bin_dyn LD_LIBRARY_PATH=./bin_dyn ./bin_dyn/$(call EXE,T10955dyn)
    

  • testsuite/tests/ghci/linking/dyn/T10955dyn.hs
    ... ... @@ -2,6 +2,12 @@ module Main where
    2 2
     
    
    3 3
     import Foreign
    
    4 4
     import Foreign.C.Types
    
    5
    +import System.IO
    
    6
    +
    
    5 7
     foreign import ccall "bar" dle :: IO CInt
    
    6 8
     
    
    7
    -main = dle >>= print
    9
    +main = do
    
    10
    +  dle >>= print
    
    11
    +  -- This shouldn't be necessary but it appears that the finalizer is
    
    12
    +  -- not executed reliably, especially in the dynamic way.
    
    13
    +  hFlush stdout