[commit: ghc] master: Some minor linker cleanups. (1964d86)

git at git.haskell.org git at git.haskell.org
Sun Nov 6 19:11:19 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/1964d8690aa41313de31f4ae0113a498d6943d44/ghc

>---------------------------------------------------------------

commit 1964d8690aa41313de31f4ae0113a498d6943d44
Author: Tamar Christina <tamar at zhox.com>
Date:   Sun Nov 6 19:08:40 2016 +0000

    Some minor linker cleanups.
    
    Summary:
    Just some cleanups to some oddities I've noticed
    while investigating a linker issue.
    
    Particularly the dll name returned by `findSysDll`
    was decorated. So foo.dll is returned. We make it
    `foo.dll.dll` and later drop one `.dll` when passed to
    `addDll` which expects it without extension, but still
    tries the name *as is* which is why it worked.
    
    This should be slightly faster, since we don't try 4 loads
    before we succeed.
    
    Test Plan: ./validate
    
    Reviewers: austin, hvr, erikd, simonmar, bgamari
    
    Reviewed By: bgamari
    
    Subscribers: thomie, #ghc_windows_task_force
    
    Differential Revision: https://phabricator.haskell.org/D2680


>---------------------------------------------------------------

1964d8690aa41313de31f4ae0113a498d6943d44
 compiler/ghci/Linker.hs   | 2 +-
 compiler/main/HscTypes.hs | 5 ++---
 rts/linker/PEi386.c       | 2 +-
 3 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/compiler/ghci/Linker.hs b/compiler/ghci/Linker.hs
index 73d0fac..4a0b62f 100644
--- a/compiler/ghci/Linker.hs
+++ b/compiler/ghci/Linker.hs
@@ -1349,7 +1349,7 @@ locateLib hsc_env is_hs dirs lib
                      in liftM2 (<|>) local linked
      findHSDll     = liftM (fmap DLLPath) $ findFile dirs hs_dyn_lib_file
      findDll       = liftM (fmap DLLPath) $ findFile dirs dyn_lib_file
-     findSysDll    = fmap (fmap $ DLL . takeFileName) $ findSystemLibrary hsc_env so_name
+     findSysDll    = fmap (fmap $ DLL . dropExtension . takeFileName) $ findSystemLibrary hsc_env so_name
      tryGcc        = let short = liftM (fmap DLLPath) $ searchForLibUsingGcc dflags so_name     dirs
                          full  = liftM (fmap DLLPath) $ searchForLibUsingGcc dflags lib_so_name dirs
                      in liftM2 (<|>) short full
diff --git a/compiler/main/HscTypes.hs b/compiler/main/HscTypes.hs
index 9b2584d..44b5634 100644
--- a/compiler/main/HscTypes.hs
+++ b/compiler/main/HscTypes.hs
@@ -2521,9 +2521,8 @@ updNameCacheIO hsc_env upd_fn
 mkSOName :: Platform -> FilePath -> FilePath
 mkSOName platform root
     = case platformOS platform of
-      OSDarwin  -> ("lib" ++ root) <.> "dylib"
-      OSMinGW32 ->           root  <.> "dll"
-      _         -> ("lib" ++ root) <.> "so"
+      OSMinGW32 ->           root  <.> soExt platform
+      _         -> ("lib" ++ root) <.> soExt platform
 
 mkHsSOName :: Platform -> FilePath -> FilePath
 mkHsSOName platform root = ("lib" ++ root) <.> soExt platform
diff --git a/rts/linker/PEi386.c b/rts/linker/PEi386.c
index b8c5231..56975ed 100644
--- a/rts/linker/PEi386.c
+++ b/rts/linker/PEi386.c
@@ -1559,7 +1559,7 @@ SymbolAddr *lookupSymbol_PEi386(SymbolName *lbl)
     RtsSymbolInfo *pinfo;
 
     if (!ghciLookupSymbolInfo(symhash, lbl, &pinfo)) {
-        IF_DEBUG(linker, debugBelch("lookupSymbol: symbol not found\n"));
+        IF_DEBUG(linker, debugBelch("lookupSymbol: symbol '%s' not found\n", lbl));
 
         SymbolAddr* sym;
 



More information about the ghc-commits mailing list