From 8002c9d5ceafef6b8fa6765701c5c3103c69760c Mon Sep 17 00:00:00 2001 From: Duncan Coutts Date: Wed, 7 Dec 2005 10:56:54 +0000 Subject: [PATCH] Use extraGHCiLibraries (if supplied) in GHCi linker rather than extraLibraries Also extend the parser. --- ghc/compiler/ghci/Linker.lhs | 15 +++++++++++++-- ghc/compiler/main/ParsePkgConf.y | 1 + 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/ghc/compiler/ghci/Linker.lhs b/ghc/compiler/ghci/Linker.lhs index 162adbf..15786f4 100644 --- a/ghc/compiler/ghci/Linker.lhs +++ b/ghc/compiler/ghci/Linker.lhs @@ -756,8 +756,19 @@ linkPackage :: DynFlags -> PackageConfig -> IO () linkPackage dflags pkg = do let dirs = Packages.libraryDirs pkg - let libs = Packages.hsLibraries pkg ++ Packages.extraLibraries pkg - ++ [ lib | '-':'l':lib <- Packages.ldOptions pkg ] + + let libs = Packages.hsLibraries pkg + -- Because of slight differences between the GHC dynamic linker and + -- the native system linker some packages have to link with a + -- different list of libraries when using GHCi. Examples include: libs + -- that are actually gnu ld scripts, and the possability that the .a + -- libs do not exactly match the .so/.dll equivalents. So if the + -- package file provides an "extra-ghci-libraries" field then we use + -- that instead of the "extra-libraries" field. + ++ (if null (Packages.extraGHCiLibraries pkg) + then Packages.extraLibraries pkg + else Packages.extraGHCiLibraries pkg) + ++ [ lib | '-':'l':lib <- Packages.ldOptions pkg ] classifieds <- mapM (locateOneObj dirs) libs -- Complication: all the .so's must be loaded before any of the .o's. diff --git a/ghc/compiler/main/ParsePkgConf.y b/ghc/compiler/main/ParsePkgConf.y index 6d3f0df..901a5bc 100644 --- a/ghc/compiler/main/ParsePkgConf.y +++ b/ghc/compiler/main/ParsePkgConf.y @@ -82,6 +82,7 @@ field :: { PackageConfig -> PackageConfig } "libraryDirs" -> p{libraryDirs = $3} "hsLibraries" -> p{hsLibraries = $3} "extraLibraries" -> p{extraLibraries = $3} + "extraGHCiLibraries"-> p{extraGHCiLibraries= $3} "includeDirs" -> p{includeDirs = $3} "includes" -> p{includes = $3} "hugsOptions" -> p{hugsOptions = $3} -- 1.7.10.4