Commit 1964d869 authored by Tamar Christina's avatar Tamar Christina

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
parent ead83db8
......@@ -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
......
......@@ -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
......
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment