[commit: ghc] wip/dont-leak-libffi: Don't shadow libffi tarballs with boot libffi installation (05e6129)

git at git.haskell.org git at git.haskell.org
Wed Feb 27 01:13:48 UTC 2019


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

On branch  : wip/dont-leak-libffi
Link       : http://ghc.haskell.org/trac/ghc/changeset/05e6129ea31ea3e57bdfe4573bf769f257241f2b/ghc

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

commit 05e6129ea31ea3e57bdfe4573bf769f257241f2b
Author: Sebastian Graf <sebastian.graf at kit.edu>
Date:   Tue Feb 26 18:17:25 2019 +0100

    Don't shadow libffi tarballs with boot libffi installation
    
    In Trac #16368, I realised that `ghc-cabal` picked up the libffi
    installation from the boot GHC and inserted it into include and library
    paths of stage 1 libraries. That's rectified by this commit.
    
    Fixes Trac #16368.


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

05e6129ea31ea3e57bdfe4573bf769f257241f2b
 utils/ghc-cabal/Main.hs | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/utils/ghc-cabal/Main.hs b/utils/ghc-cabal/Main.hs
index 8b77649..f4a2313 100644
--- a/utils/ghc-cabal/Main.hs
+++ b/utils/ghc-cabal/Main.hs
@@ -338,14 +338,22 @@ generate directory distdir config_args
               [(_,[rts])] ->
                  PackageIndex.insert rts{
                      Installed.ldOptions = [],
-                     Installed.libraryDirs = filter (not . ("gcc-lib" `isSuffixOf`)) (Installed.libraryDirs rts)} index
-                        -- GHC <= 6.12 had $topdir/gcc-lib in their
-                        -- library-dirs for the rts package, which causes
-                        -- problems when we try to use the in-tree mingw,
-                        -- due to accidentally picking up the incompatible
-                        -- libraries there.  So we filter out gcc-lib from
-                        -- the RTS's library-dirs here.
+                     Installed.libraryDirs = filter_dirs (Installed.libraryDirs rts),
+                     Installed.includeDirs = filter_dirs (Installed.includeDirs rts)
+                  } index
               _ -> error "No (or multiple) ghc rts package is registered!!"
+          filter_dirs = filter (\dir -> not (or [is_gcc_lib dir, is_libffi dir]))
+          -- GHC <= 6.12 had $topdir/gcc-lib in their
+          -- library-dirs for the rts package, which causes
+          -- problems when we try to use the in-tree mingw,
+          -- due to accidentally picking up the incompatible
+          -- libraries there.  So we filter out gcc-lib from
+          -- the RTS's library-dirs here.
+          is_gcc_lib = ("gcc-lib" `isSuffixOf`)
+          -- In Trac #16368, we noticed that libffi paths
+          -- from the boot GHC shadow the local libffi tarballs
+          -- in a similar manner.
+          is_libffi = ("libffi" `isInfixOf`)
 
           dep_ids  = map snd (externalPackageDeps lbi)
           deps     = map display dep_ids



More information about the ghc-commits mailing list