Matthew Pickering pushed to branch wip/fix-link-node-errors at Glasgow Haskell Compiler / GHC

Commits:

2 changed files:

Changes:

  • compiler/GHC/Driver/Make.hs
    ... ... @@ -1847,24 +1847,20 @@ Also closely related are
    1847 1847
     -}
    
    1848 1848
     
    
    1849 1849
     executeLinkNode :: HomeUnitGraph -> (Int, Int) -> UnitId -> [NodeKey] -> RunMakeM ()
    
    1850
    -executeLinkNode hug kn uid deps = do
    
    1850
    +executeLinkNode hug kn@(k, _) uid deps = do
    
    1851 1851
       withCurrentUnit uid $ do
    
    1852
    -    MakeEnv{..} <- ask
    
    1852
    +    make_env@MakeEnv{..} <- ask
    
    1853 1853
         let dflags = hsc_dflags hsc_env
    
    1854
    -    let hsc_env' = setHUG hug hsc_env
    
    1855 1854
             msg' = (\messager -> \recomp -> messager hsc_env kn recomp (LinkNode deps uid)) <$> env_messager
    
    1856 1855
     
    
    1857
    -    linkresult <- liftIO $ withAbstractSem compile_sem $ do
    
    1858
    -                            link (ghcLink dflags)
    
    1859
    -                                (hsc_logger hsc_env')
    
    1860
    -                                (hsc_tmpfs hsc_env')
    
    1861
    -                                (hsc_FC hsc_env')
    
    1862
    -                                (hsc_hooks hsc_env')
    
    1863
    -                                dflags
    
    1864
    -                                (hsc_unit_env hsc_env')
    
    1865
    -                                True -- We already decided to link
    
    1866
    -                                msg'
    
    1867
    -                                (hsc_HPT hsc_env')
    
    1856
    +    linkresult <- lift $ MaybeT $ withAbstractSem compile_sem $ withLoggerHsc k make_env $ \lcl_hsc_env -> do
    
    1857
    +                             let hsc_env' = setHUG hug lcl_hsc_env
    
    1858
    +                             wrapAction diag_wrapper hsc_env' $ do
    
    1859
    +                               link (ghcLink dflags)
    
    1860
    +                                 hsc_env'
    
    1861
    +                                 True -- We already decided to link
    
    1862
    +                                 msg'
    
    1863
    +                                 (hsc_HPT hsc_env')
    
    1868 1864
         case linkresult of
    
    1869 1865
           Failed -> fail "Link Failed"
    
    1870 1866
           Succeeded -> return ()
    

  • 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
    -