[Git][ghc/ghc][wip/ghc-9.4.5-backports] Store bootstrap_llvm_target and use it to set LlvmTarget in bindists

Zubin (@wz1000) gitlab at gitlab.haskell.org
Fri Apr 14 08:39:44 UTC 2023



Zubin pushed to branch wip/ghc-9.4.5-backports at Glasgow Haskell Compiler / GHC


Commits:
baccc79d by Matthew Pickering at 2023-04-14T14:09:29+05:30
Store bootstrap_llvm_target and use it to set LlvmTarget in bindists

This mirrors some existing logic for the bootstrap_target which
influences how TargetPlatform is set.

As described on #21970 not storing this led to `LlvmTarget` being set incorrectly
and hence the wrong `--target` flag being passed to the C compiler.

Towards #21970

(cherry picked from commit 64286132cc0db4e227637887f98f5a3ecf7d326a)
(cherry picked from commit 48a9e688331fbc2ac91392c654bb7457c5f8a876)

- - - - -


3 changed files:

- configure.ac
- distrib/configure.ac.in
- m4/ghc_llvm_target.m4


Changes:

=====================================
configure.ac
=====================================
@@ -694,6 +694,8 @@ GHC_LLVM_TARGET_SET_VAR
 # we intend to pass trough --targets to llvm as is.
 LLVMTarget_CPP=`    echo "$LlvmTarget"`
 AC_SUBST(LLVMTarget_CPP)
+# The target is substituted into the distrib/configure.ac file
+AC_SUBST(LlvmTarget)
 
 dnl ** See whether cc supports --target=<triple> and set
 dnl CONF_CC_OPTS_STAGE[012] accordingly.


=====================================
distrib/configure.ac.in
=====================================
@@ -18,6 +18,8 @@ dnl--------------------------------------------------------------------
 dnl Various things from the source distribution configure
 bootstrap_target=@TargetPlatform@
 
+bootstrap_llvm_target=@LlvmTarget@
+
 TargetHasRTSLinker=@TargetHasRTSLinker@
 AC_SUBST(TargetHasRTSLinker)
 


=====================================
m4/ghc_llvm_target.m4
=====================================
@@ -50,5 +50,10 @@ AC_DEFUN([GHC_LLVM_TARGET], [
 # require it.
 AC_DEFUN([GHC_LLVM_TARGET_SET_VAR], [
   AC_REQUIRE([FPTOOLS_SET_PLATFORMS_VARS])
-  GHC_LLVM_TARGET([$target],[$target_cpu],[$target_vendor],[$target_os],[LlvmTarget])
+  if test "$bootstrap_llvm_target" != ""
+  then
+    LlvmTarget=$bootstrap_llvm_target
+  else
+    GHC_LLVM_TARGET([$target],[$target_cpu],[$target_vendor],[$target_os],[LlvmTarget])
+  fi
 ])



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

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/baccc79d6e96fc7a670b71e2d1c85f47954a6fe4
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/20230414/63d14c92/attachment-0001.html>


More information about the ghc-commits mailing list