[Git][ghc/ghc][wip/bytecode-library] Missing file

Matthew Pickering pushed to branch wip/bytecode-library at Glasgow Haskell Compiler / GHC Commits: e98da5a9 by Matthew Pickering at 2025-08-29T10:04:12+01:00 Missing file - - - - - 1 changed file: - + compiler/GHC/Linker/ByteCode.hs Changes: ===================================== compiler/GHC/Linker/ByteCode.hs ===================================== @@ -0,0 +1,29 @@ +-- Utilities for creating bytecode libraries +module GHC.Linker.ByteCode where + +import GHC.Prelude +import GHC.ByteCode.Serialize +import GHC.Driver.Session +import GHC.Utils.Error +import GHC.Driver.Env +import GHC.Utils.Outputable + + +linkBytecodeLib :: HscEnv -> [ByteCodeObject] -> IO () +linkBytecodeLib hsc_env gbcs = do + let dflags = hsc_dflags hsc_env + -- The .gbc files from the command line + let bytecodeObjects = [f | FileOption _ f <- ldInputs dflags] + + -- INSERT_YOUR_CODE + let logger = hsc_logger hsc_env + let allFiles = (map text bytecodeObjects) ++ [ angleBrackets (text "in-memory" <+> ppr (bco_module bco)) | bco <- gbcs ] + debugTraceMsg logger 2 $ + text "linkBytecodeLib: linking the following bytecode objects:" $$ + vcat allFiles + + bytecodeLib <- mkBytecodeLib hsc_env bytecodeObjects gbcs + let output_fn = case outputFile dflags of { Just s -> s; Nothing -> "a.out"; } + writeBytecodeLib bytecodeLib output_fn + return () + View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e98da5a9a171d3c754d996853f9df1c6... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e98da5a9a171d3c754d996853f9df1c6... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Matthew Pickering (@mpickering)