Skip to content
Snippets Groups Projects
Commit b632ff5e authored by Cheng Shao's avatar Cheng Shao :beach:
Browse files

driver: fix getGccSearchDirectory for wasm target

This commit fixes getGccSearchDirectory logic for wasm target, ensures
the correct search directory containing libc.so etc can be found by
GHC. getGccSearchDirectory is also exported so it can be used
elsewhere to obtain the wasi-sdk libdir and pass to the dyld script.

(cherry picked from commit b562e3a6)
parent 28b21480
No related branches found
No related tags found
No related merge requests found
......@@ -33,6 +33,7 @@ module GHC.Linker.Loader
, modifyLoaderState
, initLinkDepsOpts
, partitionLinkable
, getGccSearchDirectory
)
where
......@@ -1491,12 +1492,11 @@ searchForLibUsingGcc logger dflags so dirs = do
-- libraries and components. See Note [Fork/Exec Windows].
getGCCPaths :: Logger -> DynFlags -> OS -> IO [FilePath]
getGCCPaths logger dflags os
= case os of
OSMinGW32 ->
| os == OSMinGW32 || platformArch (targetPlatform dflags) == ArchWasm32 =
do gcc_dirs <- getGccSearchDirectory logger dflags "libraries"
sys_dirs <- getSystemDirectories
return $ nub $ gcc_dirs ++ sys_dirs
_ -> return []
| otherwise = return []
-- | Cache for the GCC search directories as this can't easily change
-- during an invocation of GHC. (Maybe with some env. variable but we'll)
......@@ -1529,7 +1529,7 @@ getGccSearchDirectory logger dflags key = do
modifyIORef' gccSearchDirCache ((key, dirs):)
return val
where split :: FilePath -> [FilePath]
split r = case break (==';') r of
split r = case break (`elem` [';', ':']) r of
(s, [] ) -> [s]
(s, (_:xs)) -> s : split xs
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment