diff options
| author | Simon Marlow <marlowsd@gmail.com> | 2016-11-15 16:49:33 +0000 |
|---|---|---|
| committer | Simon Marlow <marlowsd@gmail.com> | 2016-11-16 14:31:01 +0000 |
| commit | fa70b1ec2e4638886e610279857c1c7529d6a361 (patch) | |
| tree | de1090bac747d7e7cc897f0ccf6421abd5c3b339 /compiler/ghci | |
| parent | 0135188fecfc679a498093f8fc5f665d706fa4cb (diff) | |
| download | haskell-fa70b1ec2e4638886e610279857c1c7529d6a361.tar.gz | |
Fix -fobject-code with -fexternal-interpreter
If the user does :cd in GHCi with -fexternal-interpreter, then we can
fail to find the object files.
Diffstat (limited to 'compiler/ghci')
| -rw-r--r-- | compiler/ghci/GHCi.hs | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/compiler/ghci/GHCi.hs b/compiler/ghci/GHCi.hs index c6d0d229fd..755771e1ba 100644 --- a/compiler/ghci/GHCi.hs +++ b/compiler/ghci/GHCi.hs @@ -79,6 +79,7 @@ import GHC.IO.Handle.Types (Handle) import Foreign.C import GHC.IO.Handle.FD (fdToHandle) #else +import System.Directory import System.Posix as Posix #endif import System.Process @@ -383,13 +384,24 @@ loadDLL :: HscEnv -> String -> IO (Maybe String) loadDLL hsc_env str = iservCmd hsc_env (LoadDLL str) loadArchive :: HscEnv -> String -> IO () -loadArchive hsc_env str = iservCmd hsc_env (LoadArchive str) +loadArchive hsc_env path = do + path' <- canonicalizePath path -- Note [loadObj and relative paths] + iservCmd hsc_env (LoadArchive path') loadObj :: HscEnv -> String -> IO () -loadObj hsc_env str = iservCmd hsc_env (LoadObj str) +loadObj hsc_env path = do + path' <- canonicalizePath path -- Note [loadObj and relative paths] + iservCmd hsc_env (LoadObj path') unloadObj :: HscEnv -> String -> IO () -unloadObj hsc_env str = iservCmd hsc_env (UnloadObj str) +unloadObj hsc_env path = do + path' <- canonicalizePath path -- Note [loadObj and relative paths] + iservCmd hsc_env (UnloadObj path') + +-- Note [loadObj and relative paths] +-- the iserv process might have a different current directory from the +-- GHC process, so we must make paths absolute before sending them +-- over. addLibrarySearchPath :: HscEnv -> String -> IO (Ptr ()) addLibrarySearchPath hsc_env str = |
