[Git][ghc/ghc][wip/hadrian-windows-bindist-cross] configure: Probe stage0 link flags

Ben Gamari (@bgamari) gitlab at gitlab.haskell.org
Wed Oct 4 13:01:10 UTC 2023



Ben Gamari pushed to branch wip/hadrian-windows-bindist-cross at Glasgow Haskell Compiler / GHC


Commits:
ef5ac072 by Ben Gamari at 2023-10-04T09:01:03-04:00
configure: Probe stage0 link flags

For consistency with later stages and CC.

- - - - -


2 changed files:

- configure.ac
- m4/fp_prog_cc_linker_target.m4


Changes:

=====================================
configure.ac
=====================================
@@ -661,8 +661,9 @@ FP_CC_SUPPORTS_TARGET([$CC_STAGE0], [CONF_CC_OPTS_STAGE0], [CONF_CXX_OPTS_STAGE0
 FP_CC_SUPPORTS_TARGET([$CC], [CONF_CC_OPTS_STAGE1], [CONF_CXX_OPTS_STAGE1])
 FP_CC_SUPPORTS_TARGET([$CC], [CONF_CC_OPTS_STAGE2], [CONF_CXX_OPTS_STAGE2])
 
-FP_PROG_CC_LINKER_TARGET([CONF_CC_OPTS_STAGE1], [CONF_GCC_LINKER_OPTS_STAGE1])
-FP_PROG_CC_LINKER_TARGET([CONF_CC_OPTS_STAGE2], [CONF_GCC_LINKER_OPTS_STAGE2])
+FP_PROG_CC_LINKER_TARGET([$CC_STAGE0], [CONF_CC_OPTS_STAGE0], [CONF_GCC_LINKER_OPTS_STAGE0])
+FP_PROG_CC_LINKER_TARGET([$CC], [CONF_CC_OPTS_STAGE1], [CONF_GCC_LINKER_OPTS_STAGE1])
+FP_PROG_CC_LINKER_TARGET([$CC], [CONF_CC_OPTS_STAGE2], [CONF_GCC_LINKER_OPTS_STAGE2])
 
 dnl ** See whether cc used as a linker supports -no-pie
 FP_GCC_SUPPORTS_NO_PIE


=====================================
m4/fp_prog_cc_linker_target.m4
=====================================
@@ -2,8 +2,9 @@
 # -------------------
 # Check to see if the C compiler used as a linker supports `--target`
 #
-# $1 - Variable which contains the options passed to the C compiler when compiling a C file
-# $2 - Variable which contains the options passed to the C compiler when used as
+# $1 - The compiler
+# $2 - Variable which contains the options passed to the C compiler when compiling a C file
+# $3 - Variable which contains the options passed to the C compiler when used as
 #      a linker
 AC_DEFUN([FP_PROG_CC_LINKER_TARGET],
 [
@@ -11,17 +12,17 @@ AC_DEFUN([FP_PROG_CC_LINKER_TARGET],
 
     echo 'int foo() { return 0; }' > conftest1.c
     echo 'int main() { return 0; }' > conftest2.c
-    "${CC}" $$1 -c conftest1.c || AC_MSG_ERROR([Failed to compile conftest1.c])
-    "${CC}" $$1 -c conftest2.c || AC_MSG_ERROR([Failed to compile conftest2.c])
+    "$1" $$2 -c conftest1.c || AC_MSG_ERROR([Failed to compile conftest1.c])
+    "$1" $$2 -c conftest2.c || AC_MSG_ERROR([Failed to compile conftest2.c])
 
     if test "$target_cpu" = "javascript"
     then
         # See Note [Don't pass --target to emscripten toolchain] in GHC.Toolchain.Program
         CONF_CC_SUPPORTS_TARGET=NO
         AC_MSG_RESULT([no])
-    elif "$CC" $$2 --target=$LlvmTarget -o conftest conftest1.o conftest2.o;
+    elif "$CC" $$3 --target=$LlvmTarget -o conftest conftest1.o conftest2.o;
     then
-        $2="--target=$LlvmTarget $$2"
+        $3="--target=$LlvmTarget $$3"
         AC_MSG_RESULT([yes])
     else
         AC_MSG_RESULT([no])



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

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/ef5ac0722fd55f3d3c0eba0c56c74c4724efc783
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/20231004/376f6e20/attachment-0001.html>


More information about the ghc-commits mailing list