diff options
| author | Matthew Pickering <matthewtpickering@gmail.com> | 2023-01-09 18:36:15 +0800 |
|---|---|---|
| committer | Matthew Pickering <matthewtpickering@gmail.com> | 2023-01-09 16:53:52 +0000 |
| commit | 78a9bec6d43cd5d5e314532d919893e9f23fc177 (patch) | |
| tree | 3e3f62549623890f2ae2d50ff2e1679c405adba7 | |
| parent | 965a273510adfac4f041a31182c2fec82e614e47 (diff) | |
| download | haskell-78a9bec6d43cd5d5e314532d919893e9f23fc177.tar.gz | |
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
| -rw-r--r-- | configure.ac | 2 | ||||
| -rw-r--r-- | distrib/configure.ac.in | 2 | ||||
| -rw-r--r-- | m4/ghc_llvm_target.m4 | 7 |
3 files changed, 10 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac index 6c4b6b6f53..9b4dc0b650 100644 --- a/configure.ac +++ b/configure.ac @@ -667,6 +667,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. diff --git a/distrib/configure.ac.in b/distrib/configure.ac.in index 6263db351d..8c0caa56e1 100644 --- a/distrib/configure.ac.in +++ b/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) diff --git a/m4/ghc_llvm_target.m4 b/m4/ghc_llvm_target.m4 index abb10d963e..dfb16f78da 100644 --- a/m4/ghc_llvm_target.m4 +++ b/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 ]) |
