diff --git a/asterius/src/Asterius/Passes/GCSections.hs b/asterius/src/Asterius/Passes/GCSections.hs index 05528a1558..06409a4de4 100644 --- a/asterius/src/Asterius/Passes/GCSections.hs +++ b/asterius/src/Asterius/Passes/GCSections.hs @@ -47,7 +47,7 @@ gcSections :: [EntitySymbol] -> IO AsteriusModule gcSections verbose_err module_rep root_syms export_funcs = do - let (mod_syms, err_syms) = resolveSyms verbose_err all_root_syms module_rep + let (mod_syms, err_syms) = resolveSyms verbose_err all_root_syms (dependencyMap module_rep) buildGCModule mod_syms err_syms module_rep ffi_exports where ffi_exports = @@ -61,8 +61,8 @@ gcSections verbose_err module_rep root_syms export_funcs = do -- includes 2 categories: symbols that refer to statics and functions, and -- symbols that refer to statics originating from barf messages (when -- @verbose_err@ is set to @True@). -resolveSyms :: Bool -> SS.SymbolSet -> AsteriusRepModule -> (SS.SymbolSet, SS.SymbolSet) -resolveSyms verbose_err root_syms module_rep = go (root_syms, SS.empty, mempty, mempty) +resolveSyms :: Bool -> SS.SymbolSet -> DM.DependencyMap -> (SS.SymbolSet, SS.SymbolSet) +resolveSyms verbose_err root_syms dep_map = go (root_syms, SS.empty, mempty, mempty) where go (i_staging_syms, i_acc_syms, i_m_syms, i_err_syms) | SS.null i_staging_syms = (i_m_syms, i_err_syms) @@ -73,7 +73,7 @@ resolveSyms verbose_err root_syms module_rep = go (root_syms, SS.empty, mempty, in go (o_staging_syms, o_acc_syms, o_m_syms, o_err_syms) where step i_staging_sym (i_child_syms_acc, o_m_acc_syms, err_syms) - | Just es <- i_staging_sym `DM.lookup` dependencyMap module_rep = + | Just es <- i_staging_sym `DM.lookup` dep_map = (es <> i_child_syms_acc, o_m_acc_syms <> SS.singleton i_staging_sym, err_syms) | verbose_err = (i_child_syms_acc, o_m_acc_syms, err_syms <> SS.singleton i_staging_sym)