diff options
author | Ryan Scott <ryan.gl.scott@gmail.com> | 2018-04-13 11:33:54 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2018-04-13 11:33:59 -0400 |
commit | 7613a812888424b49cb334a4e63bd7280adf2774 (patch) | |
tree | 2a9f67a3283a9f69fc4dc77e0867aab36ef65f0a /compiler/ghci | |
parent | 6f6230308fda376c55cb7cbcd4b6b51b680d4cef (diff) | |
download | haskell-7613a812888424b49cb334a4e63bd7280adf2774.tar.gz |
Fix #9438 by converting a panic to an error message
Previously, GHC was quite eager to panic whenever it was fed
an archive file when `DYNAMIC_GHC_PROGRAMS=YES`. This ought to be an
explicit error message instead, so this patch accomplishes just that.
Test Plan: make test TEST=T14708
Reviewers: Phyx, hvr, bgamari
Reviewed By: Phyx
Subscribers: thomie, carter
GHC Trac Issues: #9438, #14708, #15032
Differential Revision: https://phabricator.haskell.org/D4589
Diffstat (limited to 'compiler/ghci')
-rw-r--r-- | compiler/ghci/Linker.hs | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/compiler/ghci/Linker.hs b/compiler/ghci/Linker.hs index a91df323ce..8d0338a9dd 100644 --- a/compiler/ghci/Linker.hs +++ b/compiler/ghci/Linker.hs @@ -71,7 +71,10 @@ import System.Win32.Info (getSystemDirectory) import Exception -import Foreign (Ptr) -- needed for 2nd stage +-- needed for 2nd stage +#if STAGE >= 2 +import Foreign (Ptr) +#endif {- ********************************************************************** @@ -504,9 +507,17 @@ preloadLib hsc_env lib_paths framework_paths pls lib_spec = do = do b <- doesFileExist name if not b then return False else do if dynamicGhc - then panic "Loading archives not supported" + then throwGhcExceptionIO $ + CmdLineError dynamic_msg else loadArchive hsc_env name return True + where + dynamic_msg = unlines + [ "User-specified static library could not be loaded (" + ++ name ++ ")" + , "Loading static libraries is not supported in this configuration." + , "Try using a dynamic library instead." + ] {- ********************************************************************** |