Skip to content

No -mtriple param being passed to opt/llc when cross compiling

Currently trying to build an x86_64-linu to arm64-linux cross-compiler.

After fixing some code in rts/StgCRun.c i ran into an issue where ghc was calling llc and generating x86_64 assembly instead of aarch64 assembly.

For now, I've hacked compiler/main/SysTools.hs to add -mtriple=aarch64-linux-gnu to the opt and llc command lines and that allows me to get a bit further in the compile process.

For cross-compiling, passing something like this -mtriple=... is pretty much mandatory. I suggest adding it by doing the following:

  • Add a crossCompiling :: Bool field to DynFlags.
  • Add the -mtriple=... string to the sOpt_lo and sOpt_lc fields of Settings when we are cross-compiling.
  • Possibly also store the triple string in the Platform struct.

Comments?

Trac metadata
Trac field Value
Version 7.9
Type FeatureRequest
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information