[Git][ghc/ghc][wip/hadrian-windows-bindist-cross] hadrian: Don't pass LDFLAGS as a --configure-arg to cabal configure

Matthew Pickering (@mpickering) gitlab at gitlab.haskell.org
Fri Aug 25 16:33:57 UTC 2023



Matthew Pickering pushed to branch wip/hadrian-windows-bindist-cross at Glasgow Haskell Compiler / GHC


Commits:
f982c4c4 by Matthew Pickering at 2023-08-25T17:33:24+01:00
hadrian: Don't pass LDFLAGS as a --configure-arg to cabal configure

We don't have anything sensible to set LDFLAGS to because the "linker"
flags we have are actually flags we pass to the C compiler when it's
used as a linker.

Likewise stop passing -gcc-options which mixed together linker flags and
non-linker flags. There's no guarantee the C compiler will accept both
of these in each mode.

- - - - -


1 changed file:

- hadrian/src/Settings/Builders/Cabal.hs


Changes:

=====================================
hadrian/src/Settings/Builders/Cabal.hs
=====================================
@@ -13,8 +13,6 @@ import Control.Exception (assert)
 import qualified Data.Set as Set
 import System.Directory
 import Settings.Program (programContext)
-import GHC.Toolchain (ccLinkProgram, tgtCCompilerLink)
-import GHC.Toolchain.Program (prgFlags)
 
 cabalBuilderArgs :: Args
 cabalBuilderArgs = cabalSetupArgs <> cabalInstallArgs
@@ -167,14 +165,13 @@ libraryArgs = do
 configureStageArgs :: Args
 configureStageArgs = do
   let cFlags  = getStagedCCFlags
-      linkFlags = prgFlags . ccLinkProgram . tgtCCompilerLink <$> getStagedTarget
-  mconcat [ configureArgs cFlags linkFlags
+  mconcat [ configureArgs cFlags
           , notStage0 ? arg "--ghc-option=-ghcversion-file=rts/include/ghcversion.h"
           ]
 
 
-configureArgs :: Args -> Args -> Args
-configureArgs cFlags' ldFlags' = do
+configureArgs :: Args -> Args
+configureArgs cFlags' = do
 
     top  <- expr topDirectory
     pkg  <- getPackage
@@ -190,12 +187,8 @@ configureArgs cFlags' ldFlags' = do
                            , arg $ top -/- pkgPath pkg
                            , cFlags'
                            ]
-        ldFlags  = ldArgs <> ldFlags'
-    cldFlags <- unwords <$> (cFlags <> ldFlags)
     mconcat
         [ conf "CFLAGS"   cFlags
-        , conf "LDFLAGS"  ldFlags
-        , not (null cldFlags) ? arg ("--gcc-options=" ++ cldFlags)
         , conf "--with-iconv-includes"    $ arg =<< getSetting IconvIncludeDir
         , conf "--with-iconv-libraries"   $ arg =<< getSetting IconvLibDir
         , conf "--with-gmp-includes"      $ arg =<< getSetting GmpIncludeDir



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f982c4c460d88eb0f9e3804d44b08848851ed28f

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f982c4c460d88eb0f9e3804d44b08848851ed28f
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20230825/0eb1aaac/attachment-0001.html>


More information about the ghc-commits mailing list