diff options
author | Tamar Christina <tamar@zhox.com> | 2017-03-02 15:14:34 -0500 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2017-03-02 16:05:05 -0500 |
commit | f56fc7f7fe72f96348d663a83f736c4c8b12b08b (patch) | |
tree | 2f433a5333d73106688e998d2978a5e748fbe445 /compiler | |
parent | bc332b3159613190a4dc33a067c1ab31039a8434 (diff) | |
download | haskell-f56fc7f7fe72f96348d663a83f736c4c8b12b08b.tar.gz |
Extend Windows runtime loader libsearch
This adds `.obj` extension to the list of valid
object file (we really shouldn't be using extensions
but instead trying to read the file and see if the header
makes sense.). Microsoft compilers use .obj instead of .o
for object files.
This also adds support to finding static archives when the
"lib" prefix is already in the filename. e.g. `-llibfoo` to
find `libfoo.a`. This is inline with binutils.
Test Plan: ./validate
Reviewers: simonmar, erikd, bgamari, hvr, austin
Reviewed By: bgamari
Subscribers: RyanGlScott, thomie, #ghc_windows_task_force
Differential Revision: https://phabricator.haskell.org/D3082
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/ghci/Linker.hs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/compiler/ghci/Linker.hs b/compiler/ghci/Linker.hs index ebd27b0e33..49f57e51b0 100644 --- a/compiler/ghci/Linker.hs +++ b/compiler/ghci/Linker.hs @@ -1364,7 +1364,9 @@ locateLib hsc_env is_hs dirs lib obj_file = lib <.> "o" dyn_obj_file = lib <.> "dyn_o" - arch_file = "lib" ++ lib ++ lib_tag <.> "a" + arch_files = [ "lib" ++ lib ++ lib_tag <.> "a" + , lib <.> "a" -- native code has no lib_tag + ] lib_tag = if is_hs && loading_profiled_hs_libs then "_p" else "" loading_profiled_hs_libs = interpreterProfiled dflags @@ -1385,9 +1387,10 @@ locateLib hsc_env is_hs dirs lib findObject = liftM (fmap Object) $ findFile dirs obj_file findDynObject = liftM (fmap Object) $ findFile dirs dyn_obj_file - findArchive = let local = liftM (fmap Archive) $ findFile dirs arch_file - linked = liftM (fmap Archive) $ searchForLibUsingGcc dflags arch_file dirs - in liftM2 (<|>) local linked + findArchive = let local name = liftM (fmap Archive) $ findFile dirs name + linked name = liftM (fmap Archive) $ searchForLibUsingGcc dflags name dirs + check name = apply [local name, linked name] + in apply (map check arch_files) findHSDll = liftM (fmap DLLPath) $ findFile dirs hs_dyn_lib_file findDll = liftM (fmap DLLPath) $ findFile dirs dyn_lib_file findSysDll = fmap (fmap $ DLL . dropExtension . takeFileName) $ findSystemLibrary hsc_env so_name |