[Git][ghc/ghc][wip/T22561] compiler: Ensure that GHC toolchain is first in search path
Ben Gamari (@bgamari)
gitlab at gitlab.haskell.org
Fri Dec 23 03:51:48 UTC 2022
Ben Gamari pushed to branch wip/T22561 at Glasgow Haskell Compiler / GHC
Commits:
1dbf6169 by Ben Gamari at 2022-12-22T22:51:40-05:00
compiler: Ensure that GHC toolchain is first in search path
As noted in #22561, it is important that GHC's toolchain look
first for its own headers and libraries to ensure that the
system's are not found instead. If this happens things can
break in surprising ways (e.g. see #22561).
- - - - -
2 changed files:
- compiler/GHC/Settings/IO.hs
- m4/fp_settings.m4
Changes:
=====================================
compiler/GHC/Settings/IO.hs
=====================================
@@ -79,11 +79,11 @@ initSettings top_dir = do
myExtraGccViaCFlags <- getSetting "GCC extra via C opts"
cc_prog <- getToolSetting "C compiler command"
cxx_prog <- getToolSetting "C++ compiler command"
- cc_args_str <- getSetting "C compiler flags"
- cxx_args_str <- getSetting "C++ compiler flags"
+ cc_args_str <- getToolSetting "C compiler flags"
+ cxx_args_str <- getToolSetting "C++ compiler flags"
gccSupportsNoPie <- getBooleanSetting "C compiler supports -no-pie"
cpp_prog <- getToolSetting "Haskell CPP command"
- cpp_args_str <- getSetting "Haskell CPP flags"
+ cpp_args_str <- getToolSetting "Haskell CPP flags"
platform <- either pgmError pure $ getTargetPlatform settingsFile mySettings
@@ -123,13 +123,13 @@ initSettings top_dir = do
-- Other things being equal, as and ld are simply gcc
- cc_link_args_str <- getSetting "C compiler link flags"
+ cc_link_args_str <- getToolSetting "C compiler link flags"
let as_prog = cc_prog
as_args = map Option cc_args
ld_prog = cc_prog
ld_args = map Option (cc_args ++ words cc_link_args_str)
ld_r_prog <- getToolSetting "Merge objects command"
- ld_r_args <- getSetting "Merge objects flags"
+ ld_r_args <- getToolSetting "Merge objects flags"
let ld_r
| null ld_r_prog = Nothing
| otherwise = Just (ld_r_prog, map Option $ words ld_r_args)
=====================================
m4/fp_settings.m4
=====================================
@@ -10,12 +10,12 @@ AC_DEFUN([FP_SETTINGS],
# See Note [tooldir: How GHC finds mingw on Windows]
mingw_bin_prefix='$$tooldir/mingw/bin/'
SettingsCCompilerCommand="${mingw_bin_prefix}clang.exe"
- SettingsCCompilerFlags="$CONF_CC_OPTS_STAGE2"
+ SettingsCCompilerFlags="$CONF_CC_OPTS_STAGE2 -I$$tooldir/mingw/include"
SettingsCxxCompilerCommand="${mingw_bin_prefix}clang++.exe"
- SettingsCxxCompilerFlags="$CONF_CXX_OPTS_STAGE2"
- SettingsCCompilerLinkFlags="$CONF_GCC_LINKER_OPTS_STAGE2"
+ SettingsCxxCompilerFlags="$CONF_CXX_OPTS_STAGE2 -I$$tooldir/mingw/include"
+ SettingsCCompilerLinkFlags="$CONF_GCC_LINKER_OPTS_STAGE2 -L$$tooldir/mingw/lib -L$$tooldir/mingw/x86_64-w64-mingw32/lib"
SettingsHaskellCPPCommand="${mingw_bin_prefix}clang.exe"
- SettingsHaskellCPPFlags="$HaskellCPPArgs"
+ SettingsHaskellCPPFlags="$HaskellCPPArgs -I$$tooldir/mingw/include"
SettingsLdCommand="${mingw_bin_prefix}ld.lld.exe"
SettingsLdFlags=""
# LLD does not support object merging (#21068)
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/1dbf6169d8245260d6147ff57154f1ea5d338381
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/1dbf6169d8245260d6147ff57154f1ea5d338381
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/20221222/0e6fcff0/attachment-0001.html>
More information about the ghc-commits
mailing list