[GHC] #9895: No -mtriple param being passed to opt/llc when cross compiling

GHC ghc-devs at haskell.org
Thu Dec 18 04:04:36 UTC 2014


#9895: No -mtriple param being passed to opt/llc when cross compiling
-------------------------------------+-------------------------------------
       Reporter:  erikd              |                   Owner:  erikd
           Type:  feature request    |                  Status:  new
       Priority:  normal             |               Milestone:  7.10.1
      Component:  Compiler           |                 Version:  7.9
       Keywords:                     |        Operating System:
   Architecture:  Unknown/Multiple   |  Unknown/Multiple
     Difficulty:  Moderate (less     |         Type of failure:
  than a day)                        |  None/Unknown
     Blocked By:                     |               Test Case:
Related Tickets:                     |                Blocking:
                                     |  Differential Revisions:
-------------------------------------+-------------------------------------
 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?

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9895>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list