[Git][ghc/ghc][wip/hadrian-windows-bindist-cross] 3 commits: AC_PATH_TARGET_TOOL for LD
Matthew Pickering (@mpickering)
gitlab at gitlab.haskell.org
Thu Aug 24 08:54:02 UTC 2023
Matthew Pickering pushed to branch wip/hadrian-windows-bindist-cross at Glasgow Haskell Compiler / GHC
Commits:
e96c07b3 by Matthew Pickering at 2023-08-23T16:30:08+01:00
AC_PATH_TARGET_TOOL for LD
- - - - -
380b5d13 by Matthew Pickering at 2023-08-23T16:30:23+01:00
gnu99
- - - - -
3c7c8455 by Matthew Pickering at 2023-08-24T09:53:54+01:00
std99 in CPP as well
- - - - -
3 changed files:
- m4/find_merge_objects.m4
- utils/ghc-toolchain/src/GHC/Toolchain/Tools/Cc.hs
- utils/ghc-toolchain/src/GHC/Toolchain/Tools/Cpp.hs
Changes:
=====================================
m4/find_merge_objects.m4
=====================================
@@ -45,7 +45,7 @@ AC_DEFUN([FIND_MERGE_OBJECTS],[
if test "$result" = "1"; then
AC_MSG_NOTICE([$MergeObjsCmd is broken due to binutils 22266, looking for another linker...])
MergeObjsCmd=""
- AC_CHECK_TARGET_TOOL([MergeObjsCmd], [ld])
+ AC_PATH_TARGET_TOOL([MergeObjsCmd], [ld])
CHECK_FOR_GOLD_T22266($MergeObjsCmd)
if test "$result" = "1"; then
AC_MSG_ERROR([Linker is affected by binutils 22266 but couldn't find another unaffected linker. Please set the MergeObjsCmd variable to a functional linker.])
=====================================
utils/ghc-toolchain/src/GHC/Toolchain/Tools/Cc.hs
=====================================
@@ -10,6 +10,7 @@ module GHC.Toolchain.Tools.Cc
, compileC
, compileAsm
, addPlatformDepCcFlags
+ , checkC99Support
) where
import Control.Monad
@@ -44,7 +45,7 @@ findCc llvmTarget progOpt = checking "for C compiler" $ do
checking "whether Cc works" $ checkCcWorks cc1
cc2 <- oneOf "cc doesn't support C99" $ map checkC99Support
[ cc1
- , cc1 & _ccFlags %++ "-std=c99"
+ , cc1 & _ccFlags %++ "-std=gnu99"
]
checkCcSupportsExtraViaCFlags cc2
return cc2
=====================================
utils/ghc-toolchain/src/GHC/Toolchain/Tools/Cpp.hs
=====================================
@@ -10,7 +10,7 @@ import GHC.Toolchain.Prelude
import GHC.Toolchain.Program
import GHC.Toolchain.Tools.Cc
-import GHC.Toolchain.Utils (withTempDir)
+import GHC.Toolchain.Utils (withTempDir, oneOf)
newtype Cpp = Cpp { cppProgram :: Program
}
@@ -83,7 +83,12 @@ findCpp :: ProgOpt -> Cc -> M Cpp
findCpp progOpt cc = checking "for C preprocessor" $ do
-- Use the specified CPP or try to use the c compiler
foundCppProg <- findProgram "C preprocessor" progOpt [] <|> pure (programFromOpt progOpt (prgPath $ ccProgram cc) [])
+ -- Check whether the C preprocessor needs -std=gnu99 (only very old toolchains need this)
+ Cc cpp2 <- oneOf "cc doesn't support C99" $ map checkC99Support
+ [ Cc foundCppProg
+ , Cc (foundCppProg & _prgFlags %++ "-std=gnu99")
+ ]
-- Always add the -E flag to the CPP, regardless of the user options
- let cppProgram = addFlagIfNew "-E" foundCppProg
+ let cppProgram = addFlagIfNew "-E" cpp2
return Cpp{cppProgram}
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/6fb968c866641f2da0efc64a2ff657e20719dbd3...3c7c845547395840c0cde43f003062a37fb18c9e
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/6fb968c866641f2da0efc64a2ff657e20719dbd3...3c7c845547395840c0cde43f003062a37fb18c9e
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/20230824/a363634b/attachment-0001.html>
More information about the ghc-commits
mailing list