[Git][ghc/ghc][wip/supersven/add-LLVMAS-target] Make host --target optional
Sven Tennie (@supersven)
gitlab at gitlab.haskell.org
Fri Aug 30 06:53:39 UTC 2024
Sven Tennie pushed to branch wip/supersven/add-LLVMAS-target at Glasgow Haskell Compiler / GHC
Commits:
c7672883 by Sven Tennie at 2024-08-30T08:53:13+02:00
Make host --target optional
- - - - -
1 changed file:
- m4/fp_prog_llvm_as_args.m4
Changes:
=====================================
m4/fp_prog_llvm_as_args.m4
=====================================
@@ -7,10 +7,13 @@ AC_DEFUN([FP_PROG_LLVM_AS_ARGS],
AC_REQUIRE([GHC_LLVM_TARGET_SET_VAR])
AC_REQUIRE([GHC_LLVM_HOST_TARGET_SET_VAR])
# Cross-compiling: We need to define the target triple for the LLVM assembler.
-# Otherwise, LLVMAS tries to build for the host architecture. Defining the host
-# target is not strictly necessary, but it usually helps to be specific about
-# the build options.
+# Otherwise, $LLVMAS tries to build for the host architecture.
LlvmAsArgsTarget="--target=$LlvmTarget"
+# Usually, the installed LLVMAS should be able to assemble for the host. There
+# may be special setups for cross-compiling where this is not the case, because
+# only the last stage uses the LLVM backend (and thus LLVMAS.) If this happens,
+# we just set this variable to empty such that it will succeed as long as LLVMAS
+# exists.
LlvmAsArgsHost="--target=$LlvmHostTarget"
# Create a minimal LLVM IR file for testing
@@ -26,7 +29,12 @@ if $LLVMAS $LlvmAsArgsHost test.ll > /dev/null 2>&1 ; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
- AC_MSG_ERROR([\$LLVMAS ($LLVMAS) does not support host flags: $LlvmAsArgsHost])
+ AC_MSG_WARN([\$LLVMAS ($LLVMAS) does not support host flags: $LlvmAsArgsHost.])
+ AC_MSG_WARN([Falling back to no flags (won't be able to build stages for the host architecture with \$LLVMAS).])
+ # Here LLVMAS cannot assemble for the host. I.e. we won't be able to use it
+ # to build intermediate GHC stages (with host target). This ressembles old
+ # behaviour and is added for backwards compatibility.
+ LlvmAsArgsHost=""
fi
AC_MSG_CHECKING([whether \$LLVMAS supports target flags passed by GHC when compiling])
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/c76728835c71ed75eb48013c343b9a7ec7f24ba7
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/c76728835c71ed75eb48013c343b9a7ec7f24ba7
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/20240830/af11403a/attachment-0001.html>
More information about the ghc-commits
mailing list