[Git][ghc/ghc][wip/toolchain-selection] 2 commits: Fixes for compilation
Rodrigo Mesquita (@alt-romes)
gitlab at gitlab.haskell.org
Mon May 22 15:49:59 UTC 2023
Rodrigo Mesquita pushed to branch wip/toolchain-selection at Glasgow Haskell Compiler / GHC
Commits:
ad85762c by Rodrigo Mesquita at 2023-05-22T16:23:35+01:00
Fixes for compilation
- - - - -
8e044118 by Rodrigo Mesquita at 2023-05-22T16:49:41+01:00
Link is GNU linkerg
- - - - -
5 changed files:
- compiler/GHC/Driver/Pipeline/Execute.hs
- hadrian/cfg/system.config.in
- hadrian/src/Rules/Generate.hs
- utils/ghc-toolchain/src/GHC/Toolchain/Target.hs
- utils/ghc-toolchain/src/GHC/Toolchain/Tools/Link.hs
Changes:
=====================================
compiler/GHC/Driver/Pipeline/Execute.hs
=====================================
@@ -289,7 +289,6 @@ runAsPhase with_cpp pipe_env hsc_env location input_fn = do
let dflags = hsc_dflags hsc_env
let logger = hsc_logger hsc_env
let unit_env = hsc_unit_env hsc_env
- let platform = ue_platform unit_env
let cmdline_include_paths = includePaths dflags
let pic_c_flags = picCCOpts dflags
@@ -309,7 +308,6 @@ runAsPhase with_cpp pipe_env hsc_env location input_fn = do
= withAtomicRename outputFilename $ \temp_outputFilename ->
runAs
logger dflags
- platform
(local_includes ++ global_includes
-- See Note [-fPIC for assembler]
++ map GHC.SysTools.Option pic_c_flags
@@ -323,9 +321,6 @@ runAsPhase with_cpp pipe_env hsc_env location input_fn = do
++ [ GHC.SysTools.Option "-Wa,--no-type-check"
| platformArch (targetPlatform dflags) == ArchWasm32]
- ++ (if any (asmInfo ==) [Clang, AppleClang, AppleClang51]
- then [GHC.SysTools.Option "-Qunused-arguments"]
- else [])
++ [ GHC.SysTools.Option "-x"
, if with_cpp
then GHC.SysTools.Option "assembler-with-cpp"
=====================================
hadrian/cfg/system.config.in
=====================================
@@ -93,7 +93,6 @@ project-git-commit-id = @ProjectGitCommitId@
# See Note [tooldir: How GHC finds mingw on Windows]
gcc-extra-via-c-opts = @GccExtraViaCOpts@
-ld-is-gnu-ld = @LdIsGNULd@
# ROMES:TODO: Drop almost every of these from settings.
settings-c-compiler-command = @SettingsCCompilerCommand@
=====================================
hadrian/src/Rules/Generate.hs
=====================================
@@ -432,8 +432,8 @@ generateSettings = do
, ("ld flags", expr $ settingsFileSetting ToolchainSetting_LdFlags)
, ("ld supports compact unwind", expr $ queryTargetTargetConfig linkSupportsCompactUnwind)
, ("ld supports filelist", expr $ queryTargetTargetConfig ldSupportsFilelist)
- , ("ld supports response files", expr $ queryTargetTargetConfig ldSupportsResponseFiles)
- , ("ld is GNU ld", expr $ lookupSystemConfig "ld-is-gnu-ld")
+ , ("ld supports response files", expr $ queryTargetTargetConfig linkSupportsResponseFiles)
+ , ("ld is GNU ld", expr $ queryTargetTargetConfig linkIsGnu)
, ("Merge objects command", expr $ settingsFileSetting ToolchainSetting_MergeObjectsCommand)
, ("Merge objects flags", expr $ settingsFileSetting ToolchainSetting_MergeObjectsFlags)
, ("ar command", expr $ settingsFileSetting ToolchainSetting_ArCommand)
@@ -480,9 +480,10 @@ generateSettings = do
: ((\s' -> "," ++ showTuple s') <$> ss)
++ ["]"]
where
- ldSupportsResponseFiles = yesNo . Toolchain.ccLinkSupportsResponseFiles . Toolchain.tgtCCompilerLink
- ldSupportsFilelist = yesNo . Toolchain.ccLinkSupportsFilelist . Toolchain.tgtCCompilerLink
- linkSupportsCompactUnwind = yesNo . Toolchain.ccLinkSupportsCompactUnwind . Toolchain.tgtCCompilerLink
+ linkSupportsResponseFiles = yesNo . Toolchain.ccLinkSupportsResponseFiles . Toolchain.tgtCCompilerLink
+ linkSupportsFilelist = yesNo . Toolchain.ccLinkSupportsFilelist . Toolchain.tgtCCompilerLink
+ linkSupportsCompactUnwind = yesNo . Toolchain.ccLinkSupportsCompactUnwind . Toolchain.tgtCCompilerLink
+ linkIsGnu = yesNo . Toolchain.ccLinkIsGnu . Toolchain.tgtCCompilerLink
arFlags = unwords . prgFlags . Toolchain.arMkArchive . Toolchain.tgtAr
=====================================
utils/ghc-toolchain/src/GHC/Toolchain/Target.hs
=====================================
@@ -52,7 +52,6 @@ data Target = Target
, tgtHsCPreprocessor :: HsCpp
, tgtCCompilerLink :: CcLink
-- , tgtLd :: Program -- needed? probably not, we link always through the c compiler
- -- , tgtLdIsGnuLd :: Bool -- After rebase on LdHasGcSections (and renamed)
, tgtAr :: Ar
, tgtRanlib :: Maybe Ranlib -- Most ar implementations do good things by default without ranlib so don't need it
, tgtNm :: Nm
=====================================
utils/ghc-toolchain/src/GHC/Toolchain/Tools/Link.hs
=====================================
@@ -22,6 +22,7 @@ data CcLink = CcLink { ccLinkProgram :: Program
, ccLinkSupportsCompactUnwind :: Bool -- Argument to be made about this being part of the cclink flags
, ccLinkSupportsFilelist :: Bool -- This too
, ccLinkSupportsResponseFiles :: Bool
+ , ccLinkIsGnu :: Bool -- We once thought this could instead be LdSupportsGcSections, but then realized it couldn't IIRC
}
deriving (Show, Read, Eq, Ord)
@@ -40,6 +41,7 @@ findCcLink progOpt ldOverride archOs cc readelf = checking "for C compiler for l
ccLinkSupportsCompactUnwind <- checkSupportsCompactUnwind cc ccLinkProgram
ccLinkSupportsFilelist <- checkSupportsFilelist cc ccLinkProgram
ccLinkSupportsResponseFiles <- checkSupportsResponseFiles cc ccLinkProgram
+ ccLinkIsGnu <- checkLinkIsGnu ccLinkProgram
checkBfdCopyBug archOs cc readelf ccLinkProgram
ccLinkProgram <- addPlatformDepLinkFlags archOs cc ccLinkProgram
return $ CcLink {ccLinkProgram, ccLinkSupportsNoPie, ccLinkSupportsCompactUnwind, ccLinkSupportsFilelist, ccLinkSupportsResponseFiles}
@@ -153,6 +155,11 @@ checkLinkWorks cc ccLink = withTempDir $ \dir -> do
callProgram ccLink ["-o", out, test_o, main_o]
expectFileExists out "linker didn't produce any output"
+checkLinkIsGnu :: Program -> M Bool
+checkLinkIsGnu ccLink = do
+ out <- readProgramStdout ccLink ["--version"]
+ return ("GNU" `isInfixOf` out)
+
-- | Check for binutils bug #16177 present in some versions of the bfd ld
-- implementation affecting ARM relocations.
-- https://sourceware.org/bugzilla/show_bug.cgi?id=16177
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/fad8a5ed808b5e56b51983f546cc0453bdb7d278...8e0441181af229ed8322efeda00a431df26b13c1
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/fad8a5ed808b5e56b51983f546cc0453bdb7d278...8e0441181af229ed8322efeda00a431df26b13c1
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/20230522/bc8ee8b9/attachment-0001.html>
More information about the ghc-commits
mailing list