[Git][ghc/ghc][wip/romes/25637] Don't use build CFLAGS and friends as target settings

Rodrigo Mesquita pushed to branch wip/romes/25637 at Glasgow Haskell Compiler / GHC Commits: 670f28fb by Rodrigo Mesquita at 2025-09-19T10:23:26+01:00 Don't use build CFLAGS and friends as target settings In the GHC in tree configure, `CFLAGS`, `CXXFLAGS`, and similar tool configuration flags apply to the BUILD phase of the compiler, i.e. to the tools run to compile GHC itself. Notably, they should /not/ be carried over to the Target settings, i.e. these flags should /not/ apply to the tool which GHC invokes at runtime. Fixes #25637 - - - - - 3 changed files: - configure.ac - m4/fp_setup_windows_toolchain.m4 - m4/ghc_toolchain.m4 Changes: ===================================== configure.ac ===================================== @@ -43,12 +43,6 @@ dnl interprets build/host/target and how this interacts with $CC tests test -n "$target_alias" && ac_tool_prefix=$target_alias- dnl ---------------------------------------------------------- -dnl ** Store USER specified environment variables to pass them on to -dnl ** ghc-toolchain (in m4/ghc-toolchain.m4) -USER_CFLAGS="$CFLAGS" -USER_LDFLAGS="$LDFLAGS" -USER_LIBS="$LIBS" -USER_CXXFLAGS="$CXXFLAGS" dnl The lower-level/not user-facing environment variables that may still be set dnl by developers such as in ghc-wasm-meta USER_CONF_CC_OPTS_STAGE2="$CONF_CC_OPTS_STAGE2" ===================================== m4/fp_setup_windows_toolchain.m4 ===================================== @@ -146,11 +146,11 @@ AC_DEFUN([FP_SETUP_WINDOWS_TOOLCHAIN],[ dnl We override the USER_* flags here since the user delegated dnl configuration to the bundled windows toolchain, and these are the dnl options required by the bundled windows toolchain. - USER_CFLAGS="$CFLAGS" USER_CPP_ARGS="$CONF_CPP_OPTS_STAGE2" - USER_CXXFLAGS="$CXXFLAGS" USER_HS_CPP_ARGS="$HaskellCPPArgs" - USER_LDFLAGS="$CONF_GCC_LINKER_OPTS_STAGE2" + USER_CONF_CC_OPTS_STAGE2="$CONF_CC_OPTS_STAGE2" + USER_CONF_CXX_OPTS_STAGE2="$CONF_CXX_OPTS_STAGE2" + USER_CONF_GCC_LINKER_OPTS_STAGE2="$CONF_GCC_LINKER_OPTS_STAGE2" USER_JS_CPP_ARGS="$JavaScriptCPPArgs" USER_CMM_CPP_ARGS="$CmmCPPArgs" ]) ===================================== m4/ghc_toolchain.m4 ===================================== @@ -8,18 +8,6 @@ AC_DEFUN([ADD_GHC_TOOLCHAIN_ARG], done ]) -dnl $1 argument name -dnl $2 first variable to try -dnl $3 variable to add if the first variable is empty -AC_DEFUN([ADD_GHC_TOOLCHAIN_ARG_CHOOSE], -[ - if test -z "$2"; then - ADD_GHC_TOOLCHAIN_ARG([$1],[$3]) - else - ADD_GHC_TOOLCHAIN_ARG([$1],[$2]) - fi -]) - AC_DEFUN([ENABLE_GHC_TOOLCHAIN_ARG], [ if test "$2" = "YES"; then @@ -123,10 +111,9 @@ AC_DEFUN([FIND_GHC_TOOLCHAIN], ENABLE_GHC_TOOLCHAIN_ARG([dwarf-unwind], [$enable_dwarf_unwind]) dnl We store USER_* variants of all user-specified flags to pass them over to ghc-toolchain. - ADD_GHC_TOOLCHAIN_ARG_CHOOSE([cc-opt], [$USER_CONF_CC_OPTS_STAGE2], [$USER_CFLAGS]) - ADD_GHC_TOOLCHAIN_ARG_CHOOSE([cc-link-opt], [$USER_CONF_GCC_LINKER_OPTS_STAGE2], [$USER_LDFLAGS]) - ADD_GHC_TOOLCHAIN_ARG([cc-link-opt], [$USER_LIBS]) - ADD_GHC_TOOLCHAIN_ARG_CHOOSE([cxx-opt], [$USER_CONF_CXX_OPTS_STAGE2], [$USER_CXXFLAGS]) + ADD_GHC_TOOLCHAIN_ARG([cc-opt], [$USER_CONF_CC_OPTS_STAGE2]) + ADD_GHC_TOOLCHAIN_ARG([cc-link-opt], [$USER_CONF_GCC_LINKER_OPTS_STAGE2]) + ADD_GHC_TOOLCHAIN_ARG([cxx-opt], [$USER_CONF_CXX_OPTS_STAGE2]) ADD_GHC_TOOLCHAIN_ARG([cpp-opt], [$USER_CPP_ARGS]) ADD_GHC_TOOLCHAIN_ARG([hs-cpp-opt], [$USER_HS_CPP_ARGS]) ADD_GHC_TOOLCHAIN_ARG([js-cpp-opt], [$USER_JS_CPP_ARGS]) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/670f28fbd22e865757fc40a1cc469280... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/670f28fbd22e865757fc40a1cc469280... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Rodrigo Mesquita (@alt-romes)