From dc3926523e71b891fd827c4bed01eef02ab38103 Mon Sep 17 00:00:00 2001 From: Clemens Fruhwirth Date: Tue, 17 Jul 2007 19:26:22 +0000 Subject: [PATCH] Add hardwire-lib-paths option and make it default for inplace invocations --- compiler/Makefile | 2 +- compiler/main/DriverPipeline.hs | 6 ++++-- compiler/main/StaticFlags.hs | 3 +++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/compiler/Makefile b/compiler/Makefile index 252da0d..25cedab 100644 --- a/compiler/Makefile +++ b/compiler/Makefile @@ -725,7 +725,7 @@ endif $(INPLACE_HS): Makefile $(FPTOOLS_TOP)/mk/config.mk echo "import System.Cmd; import $(EnvImport); import System.Exit" > $@ - echo "main = do args <- $(GetArgs); rawSystem \"$(TOP_ABS)/$(GHC_COMPILER_DIR_REL)/$(GHC_PROG)\" (\"-B$(TOP_ABS)\":args) >>= exitWith" >> $@ + echo "main = do args <- $(GetArgs); rawSystem \"$(TOP_ABS)/$(GHC_COMPILER_DIR_REL)/$(GHC_PROG)\" (\"-B$(TOP_ABS)\":\"-fhardwire-lib-paths\":args) >>= exitWith" >> $@ $(INPLACE_PROG): $(INPLACE_HS) $(HC) --make $< -o $@ diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs index 4dc287a..a9e9ab4 100644 --- a/compiler/main/DriverPipeline.hs +++ b/compiler/main/DriverPipeline.hs @@ -35,7 +35,7 @@ import Module import UniqFM ( eltsUFM ) import ErrUtils import DynFlags -import StaticFlags ( v_Ld_inputs, opt_Static, WayName(..) ) +import StaticFlags ( v_Ld_inputs, opt_Static, opt_HardwireLibPaths, WayName(..) ) import Config import Panic import Util @@ -1173,7 +1173,9 @@ linkBinary dflags o_files dep_packages = do -- dependencies, and eliminating duplicates. pkg_lib_paths <- getPackageLibraryPath dflags dep_packages - let pkg_lib_path_opts = map ("-L"++) pkg_lib_paths + let pkg_lib_path_opts = concat (map get_pkg_lib_path_opts pkg_lib_paths) + get_pkg_lib_path_opts l | opt_HardwireLibPaths = ["-L" ++ l, "-Wl,-rpath", "-Wl," ++ l] + | otherwise = ["-L" ++ l] let lib_paths = libraryPaths dflags let lib_path_opts = map ("-L"++) lib_paths diff --git a/compiler/main/StaticFlags.hs b/compiler/main/StaticFlags.hs index e71c5c7..9c4427c 100644 --- a/compiler/main/StaticFlags.hs +++ b/compiler/main/StaticFlags.hs @@ -57,6 +57,7 @@ module StaticFlags ( -- Related to linking opt_PIC, opt_Static, + opt_HardwireLibPaths, -- misc opts opt_IgnoreDotGhci, @@ -328,6 +329,7 @@ opt_PIC = True opt_PIC = lookUp FSLIT("-fPIC") #endif opt_Static = lookUp FSLIT("-static") +opt_HardwireLibPaths = lookUp FSLIT("-fhardwire-lib-paths") opt_Unregisterised = lookUp FSLIT("-funregisterised") -- Derived, not a real option. Determines whether we will be compiling @@ -368,6 +370,7 @@ isStaticFlag f = "fexcess-precision", "funfolding-update-in-place", "static", + "fhardwire-lib-paths", "funregisterised", "fext-core", "fcpr-off", -- 1.7.10.4