Opened 15 months ago

Last modified 13 months ago

#7608 new task

LLVM only handles a hard-coded list of triples.

Reported by: singpolyma Owned by: dterei
Priority: normal Milestone: 7.8.3
Component: Compiler (LLVM) Version: 7.7
Keywords: cross-compiling llvm Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Other Difficulty: Unknown
Test Case: Blocked By:
Blocking: #7610 Related Tickets:

Description (last modified by dterei)

LLVM simply has a hard-coded list of triples for supported platforms in compiler/llvmGen/LlvmCodeGen/Ppr.hs :: moduleLayout.

Apparently this information can potentially be sourced by configure / autotools instead. This may be a better way forward rather than adding code for each platform.

Change History (8)

comment:1 Changed 15 months ago by singpolyma

  • Version changed from 7.6.1 to 7.7

comment:2 Changed 15 months ago by singpolyma

There are reports that setting up moduleLayout in compiler/llvmGen/LlvmCodeGen/Ppr.hs for a platform will make the right triple be selected, even in cross-compiling mode.

This may be sufficient, and I am testing it for my target platform now.

comment:3 Changed 15 months ago by dterei

  • Blocking 7610 added

comment:4 Changed 15 months ago by simonmar

  • Difficulty set to Unknown

This bug is somewhat false. The .ll file generated by my x86_64-to-arm cross compiler starts with:

target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:64:128-a0:0:64-n32"
target triple = "arm-unknown-linux-gnueabi"

which is emitted by the code in LlvmCodeGen.Ppr.moduleLayout. If there's a bug here at all, it is that there are a fixed set of cases handled by moduleLayout, so to cross-compile for a new target you need to modify this code by hand.

comment:5 Changed 15 months ago by singpolyma

I agree. Any fix for this should be in moduleLayout

comment:6 Changed 15 months ago by dterei

  • Description modified (diff)
  • Summary changed from Triple not passed to LLVM when cross-compiling to LLVM only handles a hard-coded list of triples.

Yes, I've been meaning to update this bug. Doing now.

comment:7 Changed 15 months ago by dterei

  • Type changed from bug to task
  • Type of failure changed from GHC doesn't work at all to Other

comment:8 Changed 13 months ago by igloo

  • Milestone set to 7.8.1
  • Owner set to dterei

David, I've assigned this to you as you're our LLVM guru. Please unassign it if you don't plan to look at it.

Note: See TracTickets for help on using tickets.