|
| 1 | +From 168af9c24581bb550e6f352ebb3dd86c8784cea9 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Sylvain Henry < [email protected]> |
| 3 | +Date: Thu, 6 Jul 2023 15:59:38 +0200 |
| 4 | +Subject: [PATCH] JS: support -this-unit-id for programs in the linker (#23613) |
| 5 | + |
| 6 | +--- |
| 7 | + compiler/GHC/StgToJS/Linker/Linker.hs | 2 +- |
| 8 | + testsuite/tests/driver/T23613.hs | 4 ++++ |
| 9 | + testsuite/tests/driver/all.T | 7 ++++--- |
| 10 | + 3 files changed, 9 insertions(+), 4 deletions(-) |
| 11 | + create mode 100644 testsuite/tests/driver/T23613.hs |
| 12 | + |
| 13 | +diff --git a/compiler/GHC/StgToJS/Linker/Linker.hs b/compiler/GHC/StgToJS/Linker/Linker.hs |
| 14 | +index 58bcdf2de90..530f8730c6b 100644 |
| 15 | +--- a/compiler/GHC/StgToJS/Linker/Linker.hs |
| 16 | ++++ b/compiler/GHC/StgToJS/Linker/Linker.hs |
| 17 | +@@ -327,7 +327,7 @@ computeLinkDependencies cfg unit_env link_spec finder_opts finder_cache = do |
| 18 | + let (rts_wired_units, rts_wired_functions) = rtsDeps units |
| 19 | + |
| 20 | + -- all the units we want to link together, without their dependencies |
| 21 | +- let root_units = filter (/= mainUnitId) |
| 22 | ++ let root_units = filter (/= ue_currentUnit unit_env) |
| 23 | + $ filter (/= interactiveUnitId) |
| 24 | + $ nub |
| 25 | + $ rts_wired_units ++ reverse obj_units ++ reverse units |
| 26 | +diff --git a/testsuite/tests/driver/T23613.hs b/testsuite/tests/driver/T23613.hs |
| 27 | +new file mode 100644 |
| 28 | +index 00000000000..d82a4bd93b7 |
| 29 | +--- /dev/null |
| 30 | ++++ b/testsuite/tests/driver/T23613.hs |
| 31 | +@@ -0,0 +1,4 @@ |
| 32 | ++module Main where |
| 33 | ++ |
| 34 | ++main :: IO () |
| 35 | ++main = return () |
| 36 | + |
0 commit comments