diff options
-rw-r--r-- | compiler/main/SysTools.hs | 21 | ||||
-rw-r--r-- | rules/distdir-opts.mk | 5 | ||||
-rw-r--r-- | utils/ghc-cabal/Main.hs | 3 |
3 files changed, 2 insertions, 27 deletions
diff --git a/compiler/main/SysTools.hs b/compiler/main/SysTools.hs index d5fd0c5c29..5fb92c8583 100644 --- a/compiler/main/SysTools.hs +++ b/compiler/main/SysTools.hs @@ -910,26 +910,9 @@ runLink dflags args = do let (p,args0) = pgm_l dflags args1 = map Option (getOpts dflags opt_l) args2 = args0 ++ linkargs ++ args1 ++ args - args3 = argFixup args2 [] - mb_env <- getGccEnv args3 - runSomethingResponseFile dflags ld_filter "Linker" p args3 mb_env + mb_env <- getGccEnv args2 + runSomethingResponseFile dflags ld_filter "Linker" p args2 mb_env where - testLib lib = "-l" `isPrefixOf` lib || ".a" `isSuffixOf` lib - {- GHC is just blindly appending linker arguments from libraries and - the commandline together. This results in very problematic link orders - which will cause incorrect linking. Since we're changing the link - arguments anyway, let's just make sure libraries are last. - This functions moves libraries on the link all the way back - but keeps the order amongst them the same. -} - argFixup [] r = [] ++ r - -- retain any lib in "-o" position. - argFixup (o@(Option "-o"):o'@(FileOption _ _):xs) r = o:o':argFixup xs r - argFixup (o@(Option opt):xs) r = if testLib opt - then argFixup xs (r ++ [o]) - else o:argFixup xs r - argFixup (o@(FileOption _ opt):xs) r = if testLib opt - then argFixup xs (r ++ [o]) - else o:argFixup xs r ld_filter = case (platformOS (targetPlatform dflags)) of OSSolaris2 -> sunos_ld_filter _ -> id diff --git a/rules/distdir-opts.mk b/rules/distdir-opts.mk index 0d60f99fe6..b3dfba1c44 100644 --- a/rules/distdir-opts.mk +++ b/rules/distdir-opts.mk @@ -44,16 +44,11 @@ $1_$2_DIST_CC_OPTS = \ $$($1_$2_DEP_CC_OPTS) \ $$(SRC_CC_WARNING_OPTS) -ifneq ($$(strip $$($1_$2_DEP_LIB_DIRS_SINGLE_QUOTED)),) -$1_$2_DIST_LD_LIB_DIRS := $$(subst $$(space)',$$(space)-L',$$(space)$$($1_$2_DEP_LIB_DIRS_SINGLE_QUOTED)) -endif - $1_$2_DIST_LD_OPTS = \ $$(SRC_LD_OPTS) \ $$($1_LD_OPTS) \ $$($1_$2_LD_OPTS) \ $$($1_$2_DIST_LD_LIB_DIRS) \ - $$(foreach opt,$$($1_$2_DEP_EXTRA_LIBS),-l$$(opt)) \ $$($1_$2_DEP_LD_OPTS) # c.f. Cabal's Distribution.Simple.PreProcess.ppHsc2hs diff --git a/utils/ghc-cabal/Main.hs b/utils/ghc-cabal/Main.hs index 4b6b496b66..3b55fe7b0a 100644 --- a/utils/ghc-cabal/Main.hs +++ b/utils/ghc-cabal/Main.hs @@ -399,7 +399,6 @@ generate directory distdir dll0Modules config_args mkLibraryRelDir l = "libraries/" ++ l ++ "/dist-install/build" libraryRelDirs = map mkLibraryRelDir transitiveDepNames wrappedIncludeDirs <- wrap $ forDeps Installed.includeDirs - wrappedLibraryDirs <- wrap libraryDirs let variablePrefix = directory ++ '_':distdir mods = map display modules @@ -439,11 +438,9 @@ generate directory distdir dll0Modules config_args variablePrefix ++ "_LD_OPTS = " ++ unwords (ldOptions bi), variablePrefix ++ "_DEP_INCLUDE_DIRS_SINGLE_QUOTED = " ++ unwords wrappedIncludeDirs, variablePrefix ++ "_DEP_CC_OPTS = " ++ unwords (forDeps Installed.ccOptions), - variablePrefix ++ "_DEP_LIB_DIRS_SINGLE_QUOTED = " ++ unwords wrappedLibraryDirs, variablePrefix ++ "_DEP_LIB_DIRS_SEARCHPATH = " ++ mkSearchPath libraryDirs, variablePrefix ++ "_DEP_LIB_REL_DIRS = " ++ unwords libraryRelDirs, variablePrefix ++ "_DEP_LIB_REL_DIRS_SEARCHPATH = " ++ mkSearchPath libraryRelDirs, - variablePrefix ++ "_DEP_EXTRA_LIBS = " ++ unwords (forDeps Installed.extraLibraries), variablePrefix ++ "_DEP_LD_OPTS = " ++ unwords (forDeps Installed.ldOptions), variablePrefix ++ "_BUILD_GHCI_LIB = " ++ boolToYesNo (withGHCiLib lbi), "", |