[Git][ghc/ghc][wip/supersven/add-LLVMAS-target] Host target needs to be LLVM adjusted

Sven Tennie (@supersven) gitlab at gitlab.haskell.org
Sat Aug 10 08:54:12 UTC 2024



Sven Tennie pushed to branch wip/supersven/add-LLVMAS-target at Glasgow Haskell Compiler / GHC


Commits:
deae7b24 by Sven Tennie at 2024-08-10T10:52:35+02:00
Host target needs to be LLVM adjusted

Same as for target target: LLVM does not support all triples.

- - - - -


2 changed files:

- m4/fp_prog_llvm_as_args.m4
- m4/ghc_llvm_target.m4


Changes:

=====================================
m4/fp_prog_llvm_as_args.m4
=====================================
@@ -4,10 +4,14 @@
 # Sets the arguments of the LLVM assembler ($LLVMAS; usually clang.)
 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.
-# Though, it does not hurt to define it for the non-cross case as well.
-LlvmAsArgsTarget="--target=$TargetPlatform"
-LlvmAsArgsHost="--target=$HostPlatform"
+# Otherwise, LLVMAS tries to build for the host architecture. Defining the host
+# target is not strictly necessary, but it usually help to be specific about the
+# build options.
+LlvmAsArgsTarget="--target=$LlvmTarget"
+LlvmAsArgsHost="--target=$LlvmHostTarget"
 
 # Create a minimal LLVM IR file for testing
 cat > test.ll <<EOF


=====================================
m4/ghc_llvm_target.m4
=====================================
@@ -57,3 +57,13 @@ AC_DEFUN([GHC_LLVM_TARGET_SET_VAR], [
     GHC_LLVM_TARGET([$target],[$target_cpu],[$target_vendor],[$target_os],[LlvmTarget])
   fi
 ])
+
+# GHC_LLVM_HOST_TARGET_SET_VAR
+# -----------------------
+#
+# Sets the cannonical target variable of the host. This stub exists so other
+# macros can require it.
+AC_DEFUN([GHC_LLVM_HOST_TARGET_SET_VAR], [
+  AC_REQUIRE([FPTOOLS_SET_PLATFORMS_VARS])
+  GHC_LLVM_TARGET([$host],[$host_cpu],[$host_vendor],[$host_os],[LlvmHostTarget])
+])



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

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/deae7b24df4ca37f6f2a90a85cf8c05cf77fe161
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/20240810/2d18376c/attachment-0001.html>


More information about the ghc-commits mailing list