Add regression test for #10110.
authorPeter Trommler <ptrommler@acm.org>
Tue, 19 May 2015 06:21:09 +0000 (01:21 -0500)
committerAustin Seipp <austin@well-typed.com>
Tue, 19 May 2015 06:24:57 +0000 (01:24 -0500)
Module C imports a from Module A and b from module B. B does not
import anything from A. So if ld is configured to drop DT_NEEDED
tags for libraries it does not depend on no DT_NEEDED tag for the
temporary shared object containing module A is recorded in the temp
SO containing module B. This leads to an undefined symbol when
linking the temp SO for module C.

Fixes #10110.

Reviewed By: austin

Differential Revision: https://phabricator.haskell.org/D895

GHC Trac Issues: #10110

testsuite/tests/ghci/scripts/T10110.script [new file with mode: 0644]
testsuite/tests/ghci/scripts/T10110.stdout [new file with mode: 0644]
testsuite/tests/ghci/scripts/T10110A.hs [new file with mode: 0644]
testsuite/tests/ghci/scripts/T10110B.hs [new file with mode: 0644]
testsuite/tests/ghci/scripts/T10110C.hs [new file with mode: 0644]
testsuite/tests/ghci/scripts/all.T

diff --git a/testsuite/tests/ghci/scripts/T10110.script b/testsuite/tests/ghci/scripts/T10110.script
new file mode 100644 (file)
index 0000000..df67c30
--- /dev/null
@@ -0,0 +1,5 @@
+:set -fobject-code
+:load T10110A T10110B T10110C
+T10110A.a
+T10110B.b
+T10110C.c
diff --git a/testsuite/tests/ghci/scripts/T10110.stdout b/testsuite/tests/ghci/scripts/T10110.stdout
new file mode 100644 (file)
index 0000000..21cc9a8
--- /dev/null
@@ -0,0 +1,3 @@
+3
+5
+8
diff --git a/testsuite/tests/ghci/scripts/T10110A.hs b/testsuite/tests/ghci/scripts/T10110A.hs
new file mode 100644 (file)
index 0000000..8482e7f
--- /dev/null
@@ -0,0 +1,4 @@
+module T10110A (a) where
+{-# NOINLINE a #-}
+a :: Int
+a = 3
diff --git a/testsuite/tests/ghci/scripts/T10110B.hs b/testsuite/tests/ghci/scripts/T10110B.hs
new file mode 100644 (file)
index 0000000..65cfc7e
--- /dev/null
@@ -0,0 +1,3 @@
+module T10110B (b) where
+b :: Int
+b = 5
diff --git a/testsuite/tests/ghci/scripts/T10110C.hs b/testsuite/tests/ghci/scripts/T10110C.hs
new file mode 100644 (file)
index 0000000..7069207
--- /dev/null
@@ -0,0 +1,5 @@
+module T10110C (c) where
+import T10110A (a)
+import T10110B (b)
+c :: Int
+c = a+b
index 85ba5af..e0f2301 100755 (executable)
@@ -217,3 +217,4 @@ test('T10408A', normal, run_command,
 test('T10408B', normal, run_command,
     ['$MAKE -s --no-print-directory T10408B'])
 test('T10248', normal, ghci_script, ['T10248.script'])
+test('T10110', normal, ghci_script, ['T10110.script'])