summaryrefslogtreecommitdiff
path: root/testsuite/tests/ghci/linking/dyn
diff options
context:
space:
mode:
authorTamar Christina <tamar@zhox.com>2015-11-17 15:35:46 +0100
committerBen Gamari <ben@smart-cactus.org>2015-11-17 16:19:52 +0100
commitacce37f38bc3867f86cf717694915746bb2f278e (patch)
treea78348dc2c599ae66d1620744711d863d59d3eed /testsuite/tests/ghci/linking/dyn
parent8ad9e74f1f88d5c86d2e76f9992f9b2d267421d3 (diff)
downloadhaskell-acce37f38bc3867f86cf717694915746bb2f278e.tar.gz
Fix archive loading on Windows by the runtime loader
The runtime loader is unable to find archive files `.a` shipping with the inplace `GCC`. It seems the issue is caused by `findArchive` being unable to find any archives that are shipped using the in-place `GCC`. - It works on Linux because `findArchive` would search the standard Linux include path. - It works during compilation because `GCC` can find it's own libraries (we explicitly tell it where to look for libraries using the `gcc` wrapper around `realgcc`) So fixing the issue means using `searchForLibUsingGcc` in `findArchive` as well, which will then find the correct file. The reason for the error as it is, is because if we can't locate the library using any of the methods we have, we assume it is a system dll, or something on the system search path. e.g. if trying to load `kernel32.dll`. There is a slight issue in that the `GHCi` code (incorrectly) favors `static archives` over `dynamic` ones ``` findDll `orElse` findArchive `orElse` tryGcc `orElse` tryGccPrefixed `orElse` assumeDll ``` This has the unwanted effect of when `kernel32` is specified as a lib, it will try to load `kernel32.a` instead of `kernel32.dll`. To solve this I have added another search function that is able to search the Windows search paths using `SearchPath` in order to find if it is a dll on the system search path. The new search order is: ``` findDll `orElse` findSysDll `orElse` tryGcc `orElse` findArchive `orElse` assumeDll ``` (`tryGccPrefixed` was rolled into `tryGcc` so it is no longer needed at top level) Test Plan: ./validate added new windows tests T3242 Reviewers: thomie, erikd, hvr, austin, bgamari Reviewed By: thomie, erikd, bgamari Differential Revision: https://phabricator.haskell.org/D1455 GHC Trac Issues: #3242
Diffstat (limited to 'testsuite/tests/ghci/linking/dyn')
-rw-r--r--testsuite/tests/ghci/linking/dyn/Makefile5
-rw-r--r--testsuite/tests/ghci/linking/dyn/all.T5
2 files changed, 9 insertions, 1 deletions
diff --git a/testsuite/tests/ghci/linking/dyn/Makefile b/testsuite/tests/ghci/linking/dyn/Makefile
index 8eb4aade15..bc330484e9 100644
--- a/testsuite/tests/ghci/linking/dyn/Makefile
+++ b/testsuite/tests/ghci/linking/dyn/Makefile
@@ -59,4 +59,7 @@ compile_libAB_dyn:
.PHONY: T1407
T1407:
- cat T1407.script | LD_LIBRARY_PATH=. "$(TEST_HC)" -ignore-dot-ghci -v0 --interactive -L.
+ cat T1407.script | LD_LIBRARY_PATH=. "$(TEST_HC)" $(TEST_HC_OPTS) -ignore-dot-ghci -v0 --interactive -L.
+
+.PHONY: T3242
+ echo ":q" | '$(TEST_HC)' $(TEST_HC_OPTS) --interactive -ignore-dot-ghci -v0 -lm
diff --git a/testsuite/tests/ghci/linking/dyn/all.T b/testsuite/tests/ghci/linking/dyn/all.T
index abbc569a0f..e5b40d4751 100644
--- a/testsuite/tests/ghci/linking/dyn/all.T
+++ b/testsuite/tests/ghci/linking/dyn/all.T
@@ -11,6 +11,11 @@ test('T1407',
extra_hc_opts('-L.')],
run_command, ['$MAKE --no-print-directory -s T1407'])
+test('T3242',
+ [unless(doing_ghci, skip), unless(opsys('mingw32'), skip)],
+ run_command,
+ ['$MAKE -s --no-print-directory T3242'])
+
test('T10955',
[unless(doing_ghci, skip),unless(opsys('mingw32'), skip),
extra_clean(['bin_dep/*', 'bin_dep']),