Matthew Pickering pushed to branch wip/bytecode-library at Glasgow Haskell Compiler / GHC

Commits:

7 changed files:

Changes:

  • compiler/GHC/Linker/Loader.hs
    ... ... @@ -931,7 +931,8 @@ dynLoadObjs interp hsc_env pls@LoaderState{..} objs = do
    931 931
         -- Loading bytecode for mypkg
    
    932 932
         --- -l mypkg
    
    933 933
         -- This thinks we are creating shared library for main but we actually are for mypkg
    
    934
    -    linkDynLib LinkingForInterpreter logger tmpfs dflags2 unit_env objs (pprTraceIt "test" (map loaded_pkg_uid $ eltsUDFM pkgs_loaded))
    
    934
    +    -- MP: LinkingForInterpreter is broken here for tests, recompPluginPackage
    
    935
    +    linkDynLib LinkingHomePackage logger tmpfs dflags2 unit_env objs (map loaded_pkg_uid $ eltsUDFM pkgs_loaded)
    
    935 936
     
    
    936 937
         -- if we got this far, extend the lifetime of the library file
    
    937 938
         changeTempFilesLifetime tmpfs TFL_GhcSession [soFile]
    

  • testsuite/tests/cabal/all.T
    ... ... @@ -35,9 +35,13 @@ test('ghcpkg06', [extra_files(['test.pkg', 'testdup.pkg'])], makefile_test, [])
    35 35
     
    
    36 36
     test('ghcpkg07', [extra_files(['test.pkg', 'test7a.pkg', 'test7b.pkg'])], makefile_test, [])
    
    37 37
     
    
    38
    -test('pkg_bytecode', [extra_files(['bytecode.pkg', 'Bytecode.hs', "bytecode.script"]), copy_files], makefile_test, [])
    
    38
    +test('pkg_bytecode', [extra_files(['bytecode.pkg', 'Bytecode.hs', "bytecode.script"])
    
    39
    +                     , normalise_errmsg_fun(normaliseDynlibNames, ignore_warnings)
    
    40
    +                     , copy_files], makefile_test, [])
    
    39 41
     
    
    40
    -test('pkg_bytecode_foreign', [extra_files(['bytecode_foreign.pkg', "BytecodeForeign.hs", "BytecodeForeign.c", "bytecode_foreign.script"]), copy_files], makefile_test, [])
    
    42
    +test('pkg_bytecode_foreign', [extra_files(['bytecode_foreign.pkg', "BytecodeForeign.hs", "BytecodeForeign.c", "bytecode_foreign.script"])
    
    43
    +                             , normalise_errmsg_fun(normaliseDynlibNames, ignore_warnings)
    
    44
    +                             , copy_files], makefile_test, [])
    
    41 45
     
    
    42 46
     # Test that we *can* compile a module that also belongs to a package
    
    43 47
     # (this was disallowed in GHC 6.4 and earlier)
    

  • testsuite/tests/cabal/pkg_bytecode.stderr
    1
    -testpkg-1.2.3.4: cannot find any of ["libtestpkg-1.2.3.4-XXX.a","libtestpkg-1.2.3.4-XXX_p.a","libtestpkg-1.2.3.4-XXX-ghc9.15.20250811.so","libtestpkg-1.2.3.4-XXX_p-ghc9.15.20250811.so","libtestpkg-1.2.3.4-XXX-ghc9.15.20250811.dylib","libtestpkg-1.2.3.4-XXX_p-ghc9.15.20250811.dylib","testpkg-1.2.3.4-XXX-ghc9.15.20250811.dll","testpkg-1.2.3.4-XXX_p-ghc9.15.20250811.dll"] on library path (ignoring)
    
    2
    -hs_classifieds
    
    3
    -  [BytecodeLibrary ./outdir/testpkg-1.2.3.4-XXX.bytecode]
    
    4
    -hs_classifieds
    
    5
    -  [DLLPath /home/matt/ghc-bytecode/_build/stage1/lib/../lib/x86_64-linux-ghc-9.15.20250811/libHSghc-internal-9.1500.0-inplace-ghc9.15.20250811.so]
    
    6
    -hs_classifieds
    
    7
    -  [DLLPath /home/matt/ghc-bytecode/_build/stage1/lib/../lib/x86_64-linux-ghc-9.15.20250811/libHSghc-prim-0.13.1-inplace-ghc9.15.20250811.so]
    
    8
    -hs_classifieds
    
    9
    -  [DLLPath /home/matt/ghc-bytecode/_build/stage1/lib/../lib/x86_64-linux-ghc-9.15.20250811/libHSbase-4.22.0.0-inplace-ghc9.15.20250811.so]
    1
    +testpkg-1.2.3.4: cannot find any of ["libtestpkg-1.2.3.4-XXX.a","libtestpkg-1.2.3.4-XXX_p.a","libtestpkg-1.2.3.4-XXX-ghc9.15.20251003.so","libtestpkg-1.2.3.4-XXX_p-ghc9.15.20251003.so","libtestpkg-1.2.3.4-XXX-ghc9.15.20251003.dylib","libtestpkg-1.2.3.4-XXX_p-ghc9.15.20251003.dylib","testpkg-1.2.3.4-XXX-ghc9.15.20251003.dll","testpkg-1.2.3.4-XXX_p-ghc9.15.20251003.dll"] on library path (ignoring)

  • testsuite/tests/cabal/pkg_bytecode.stdout
    1
    -[1 of 2] Compiling Bytecode         ( Bytecode.hs, interpreted )
    
    1
    +[1 of 2] Compiling Bytecode         ( Bytecode.hs, Bytecode.gbc )
    
    2 2
     [2 of 2] Linking testpkg-1.2.3.4-XXX.bytecode
    
    3 3
     Reading package info from "bytecode.pkg" ... done.
    
    4
    -GHCi, version 9.15.20250811: https://www.haskell.org/ghc/  :? for help
    
    5
    -ghci> ghci> "bytecode from a package"
    
    6
    -ghci> Leaving GHCi.
    4
    +"bytecode from a package"

  • testsuite/tests/cabal/pkg_bytecode_foreign.stderr
    1
    -hs_classifieds
    
    2
    -  [DLLPath /home/matt/ghc-bytecode/_build/stage1/lib/../lib/x86_64-linux-ghc-9.15.20250811/libHSghc-internal-9.1500.0-inplace-ghc9.15.20250811.so]
    
    3
    -hs_classifieds
    
    4
    -  [DLLPath /home/matt/ghc-bytecode/_build/stage1/lib/../lib/x86_64-linux-ghc-9.15.20250811/libHSghc-prim-0.13.1-inplace-ghc9.15.20250811.so]
    
    5
    -hs_classifieds
    
    6
    -  [DLLPath /home/matt/ghc-bytecode/_build/stage1/lib/../lib/x86_64-linux-ghc-9.15.20250811/libHSbase-4.22.0.0-inplace-ghc9.15.20250811.so]
    
    7
    -testpkg-1.2.3.4: cannot find any of ["libtestpkg-1.2.3.4-XXX.a","libtestpkg-1.2.3.4-XXX_p.a","libtestpkg-1.2.3.4-XXX-ghc9.15.20250811.so","libtestpkg-1.2.3.4-XXX_p-ghc9.15.20250811.so","libtestpkg-1.2.3.4-XXX-ghc9.15.20250811.dylib","libtestpkg-1.2.3.4-XXX_p-ghc9.15.20250811.dylib","testpkg-1.2.3.4-XXX-ghc9.15.20250811.dll","testpkg-1.2.3.4-XXX_p-ghc9.15.20250811.dll"] on library path (ignoring)
    
    8
    -hs_classifieds
    
    9
    -  [BytecodeLibrary ./outdir/testpkg-1.2.3.4-XXX.bytecode]
    
    10
    -hs_classifieds
    
    11
    -  [DLLPath /home/matt/ghc-bytecode/_build/stage1/lib/../lib/x86_64-linux-ghc-9.15.20250811/libHSghc-internal-9.1500.0-inplace-ghc9.15.20250811.so]
    
    12
    -hs_classifieds
    
    13
    -  [DLLPath /home/matt/ghc-bytecode/_build/stage1/lib/../lib/x86_64-linux-ghc-9.15.20250811/libHSghc-prim-0.13.1-inplace-ghc9.15.20250811.so]
    
    14
    -hs_classifieds
    
    15
    -  [DLLPath /home/matt/ghc-bytecode/_build/stage1/lib/../lib/x86_64-linux-ghc-9.15.20250811/libHSbase-4.22.0.0-inplace-ghc9.15.20250811.so]
    1
    +testpkg-1.2.3.4: cannot find any of ["libtestpkg-1.2.3.4-XXX.a","libtestpkg-1.2.3.4-XXX_p.a","libtestpkg-1.2.3.4-XXX-ghc9.15.20251003.so","libtestpkg-1.2.3.4-XXX_p-ghc9.15.20251003.so","libtestpkg-1.2.3.4-XXX-ghc9.15.20251003.dylib","libtestpkg-1.2.3.4-XXX_p-ghc9.15.20251003.dylib","testpkg-1.2.3.4-XXX-ghc9.15.20251003.dll","testpkg-1.2.3.4-XXX_p-ghc9.15.20251003.dll"] on library path (ignoring)

  • testsuite/tests/cabal/pkg_bytecode_foreign.stdout
    1
    -[1 of 2] Compiling BytecodeForeign  ( BytecodeForeign.hs, interpreted )
    
    1
    +[1 of 2] Compiling BytecodeForeign  ( BytecodeForeign.hs, BytecodeForeign.gbc )
    
    2 2
     [2 of 2] Linking testpkg-1.2.3.4-XXX.bytecode
    
    3 3
     Reading package info from "bytecode_foreign.pkg" ... done.
    
    4
    -GHCi, version 9.15.20250811: https://www.haskell.org/ghc/  :? for help
    
    5
    -ghci> ghci> 8
    
    4
    +8
    
    6 5
     42
    7
    -ghci> Leaving GHCi.

  • testsuite/tests/ghc-e/should_fail/T9930fail.stderr
    1
    -ghc: Uncaught exception ghc-9.13-inplace:GHC.Utils.Panic.GhcException:
    
    2
    -
    
    3
    -default output name would overwrite the input file; must specify -o explicitly
    
    1
    +<no location info>: error:
    
    2
    +    default output name would overwrite the input file; must specify -o explicitly
    
    4 3
     Usage: For basic information, try the `--help' option.
    
    5 4
     
    6
    -While handling default output name would overwrite the input file; must specify -o explicitly
    
    7
    -  | Usage: For basic information, try the `--help' option.
    
    8
    -
    
    9
    -HasCallStack backtrace:
    
    10
    -  bracket, called at compiler/GHC/Driver/MakeAction.hs:2955:3 in ghc-9.13-inplace:GHC.Driver.MakeAction
    
    11
    -