diff --git a/Cabal/Distribution/Simple/GHC.hs b/Cabal/Distribution/Simple/GHC.hs index 192af06d0c9..2b0503c59e7 100644 --- a/Cabal/Distribution/Simple/GHC.hs +++ b/Cabal/Distribution/Simple/GHC.hs @@ -610,7 +610,11 @@ buildOrReplLib mReplFlags verbosity numJobs pkg_descr lbi lib clbi = do } linkerOpts = mempty { ghcOptLinkOptions = PD.ldOptions libBi - ++ [ "-static" | withFullyStaticExe lbi ], + ++ [ "-static" | withFullyStaticExe lbi ] + -- Pass extra `ld-options` given + -- through to GHC's linker. + ++ maybe [] programOverrideArgs + (lookupProgram ldProgram (withPrograms lbi)) ghcOptLinkLibs = extraLibs libBi, ghcOptLinkLibPath = toNubListR $ extraLibDirs libBi, ghcOptLinkFrameworks = toNubListR $ PD.frameworks libBi, @@ -1292,7 +1296,11 @@ gbuild verbosity numJobs pkg_descr lbi bm clbi = do } linkerOpts = mempty { ghcOptLinkOptions = PD.ldOptions bnfo - ++ [ "-static" | withFullyStaticExe lbi ], + ++ [ "-static" | withFullyStaticExe lbi ] + -- Pass extra `ld-options` given + -- through to GHC's linker. + ++ maybe [] programOverrideArgs + (lookupProgram ldProgram (withPrograms lbi)), ghcOptLinkLibs = extraLibs bnfo, ghcOptLinkLibPath = toNubListR $ extraLibDirs bnfo, ghcOptLinkFrameworks = toNubListR $