summaryrefslogtreecommitdiff
path: root/testsuite/tests/ghci/linking
diff options
context:
space:
mode:
authorTamar Christina <tamar@zhox.com>2017-02-23 18:32:28 -0500
committerBen Gamari <ben@smart-cactus.org>2017-02-26 10:54:07 -0500
commit41e54b4b1a2934364759edcf77ba1f5b03a4098f (patch)
tree691ddb192054537715ea62367e1d00d74189be92 /testsuite/tests/ghci/linking
parentcae1a71255221d5eec27c0c47c4aaf94293f8d59 (diff)
downloadhaskell-41e54b4b1a2934364759edcf77ba1f5b03a4098f.tar.gz
Load dependent dlls.
When the `GCC` driver envokes the pipeline a `SPEC` is used to determine how to configure the compiler and which libraries to pass along. For Windows/mingw, this specfile is https://github.com/gcc-mirror/gcc/blob/master/gcc/config/i386/mingw32.h This has a lot of interesting things that we need to emulate in order to be able to link as many things out of the box as GCC. In particular this is why you never need to specify `-lgcc_s` when compiling, but you do when using `GHCi`. Unfortunately due to time constraints I can't set up the framework required in `GHC` to do this before the feature freeze. So I suggest this alternate implementation: When we load a dll, also bring it's dependencies into scope of the interpeter. This has pros and cons. Pro is, we'll fix many packages on hackage which specify just `-lstdc++`. Since this points to `libstdc++-6.dll` which will bring `libgcc` into scope. The downside is, we'll be more lenient than GCC, in that the interpreter will link much easier since it has implicit dependencies in scope. Whereas for compilation to work you will have to specify it as an argument to GHC. This will make the Windows runtime linker more consistent with the unix ones. The difference in semantics came about because of the differences between `dlsym` and `GetProcAddress`. The former seems to search the given library and all it's dependencies, while the latter only searches the export table of the library. So we need some extra manual work to search the dependencies which this patch provides. Test Plan: ``` ./validate ``` ``` $ echo :q | inplace/bin/ghc-stage2.exe --interactive +RTS -Dl -RTS -lstdc++ 2>&1 | grep "Loading dependency" ``` ``` $ echo :q | ../inplace/bin/ghc-stage2.exe --interactive -lstdc++ +RTS -Dl -RTS 2>&1 | grep "Loading dependency" Loading dependency *.exe -> GDI32.dll. Loading dependency GDI32.dll -> ntdll.dll. Loading dependency *.exe -> KERNEL32.dll. Loading dependency KERNEL32.dll -> KERNELBASE.dll. Loading dependency *.exe -> msvcrt.dll. Loading dependency *.exe -> SHELL32.dll. Loading dependency SHELL32.dll -> USER32.dll. Loading dependency USER32.dll -> win32u.dll. Loading dependency *.exe -> WINMM.dll. Loading dependency WINMM.dll -> WINMMBASE.dll. Loading dependency *.exe -> WSOCK32.dll. Loading dependency WSOCK32.dll -> WS2_32.dll. Loading dependency WS2_32.dll -> RPCRT4.dll. Loading dependency libstdc++-6.dll -> libwinpthread-1.dll. Loading dependency libstdc++-6.dll -> libgcc_s_seh-1.dll. ``` Trac tickets: #13093, #13189 Reviewers: simonmar, rwbarton, austin, bgamari, erikd Reviewed By: bgamari Subscribers: rwbarton, RyanGlScott, thomie, #ghc_windows_task_force Differential Revision: https://phabricator.haskell.org/D3028
Diffstat (limited to 'testsuite/tests/ghci/linking')
-rw-r--r--testsuite/tests/ghci/linking/Makefile4
1 files changed, 0 insertions, 4 deletions
diff --git a/testsuite/tests/ghci/linking/Makefile b/testsuite/tests/ghci/linking/Makefile
index f8c5e19ce8..793152d68e 100644
--- a/testsuite/tests/ghci/linking/Makefile
+++ b/testsuite/tests/ghci/linking/Makefile
@@ -38,11 +38,7 @@ ghcilink002 :
.PHONY: ghcilink003
ghcilink003 :
-ifeq "$(WINDOWS)" "YES"
- echo ":q" | "$(TEST_HC)" $(TEST_HC_OPTS_INTERACTIVE) -lstdc++-6
-else
echo ":q" | "$(TEST_HC)" $(TEST_HC_OPTS_INTERACTIVE) -lstdc++
-endif
# Test 4:
# package P