[GHC] #7608: Triple not passed to LLVM when cross-compiling

#7608: Triple not passed to LLVM when cross-compiling ------------------------------------+--------------------------------------- Reporter: singpolyma | Owner: Type: bug | Status: new Priority: normal | Component: Compiler (LLVM) Version: 7.6.1 | Keywords: cross-compiling llvm Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: GHC doesn't work at all | Blockedby: Blocking: | Related: ------------------------------------+--------------------------------------- First found in http://www.haskell.org/pipermail/cvs- ghc/2012-December/079115.html When cross-compiling to a different architecture, LLVM is not informed what architecture we are building for, and so generates code for the host architecture instead. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7608 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7608: Triple not passed to LLVM when cross-compiling ------------------------------------+--------------------------------------- Reporter: singpolyma | Owner: Type: bug | Status: new Priority: normal | Component: Compiler (LLVM) Version: 7.7 | Keywords: cross-compiling llvm Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: GHC doesn't work at all | Blockedby: Blocking: | Related: ------------------------------------+--------------------------------------- Changes (by singpolyma): * version: 7.6.1 => 7.7 -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7608#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7608: Triple not passed to LLVM when cross-compiling ------------------------------------+--------------------------------------- Reporter: singpolyma | Owner: Type: bug | Status: new Priority: normal | Component: Compiler (LLVM) Version: 7.7 | Keywords: cross-compiling llvm Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: GHC doesn't work at all | Blockedby: Blocking: | Related: ------------------------------------+--------------------------------------- Comment(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. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7608#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7608: Triple not passed to LLVM when cross-compiling -------------------------------------+-------------------------------------- Reporter: singpolyma | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (LLVM) | Version: 7.7 Keywords: cross-compiling llvm | Os: Unknown/Multiple Architecture: Unknown/Multiple | Failure: GHC doesn't work at all Difficulty: Unknown | Testcase: Blockedby: | Blocking: 7610 Related: | -------------------------------------+-------------------------------------- Changes (by simonmar): * difficulty: => Unknown Comment: This bug is somewhat false. The `.ll` file generated by my linux->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. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7608#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7608: Triple not passed to LLVM when cross-compiling -------------------------------------+-------------------------------------- Reporter: singpolyma | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (LLVM) | Version: 7.7 Keywords: cross-compiling llvm | Os: Unknown/Multiple Architecture: Unknown/Multiple | Failure: GHC doesn't work at all Difficulty: Unknown | Testcase: Blockedby: | Blocking: 7610 Related: | -------------------------------------+-------------------------------------- Comment(by singpolyma): I agree. Any fix for this should be in `moduleLayout` -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7608#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7608: LLVM only handles a hard-coded list of triples. -------------------------------------+-------------------------------------- Reporter: singpolyma | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (LLVM) | Version: 7.7 Keywords: cross-compiling llvm | Os: Unknown/Multiple Architecture: Unknown/Multiple | Failure: GHC doesn't work at all Difficulty: Unknown | Testcase: Blockedby: | Blocking: 7610 Related: | -------------------------------------+-------------------------------------- Old description:
First found in http://www.haskell.org/pipermail/cvs- ghc/2012-December/079115.html
When cross-compiling to a different architecture, LLVM is not informed what architecture we are building for, and so generates code for the host architecture instead.
New description: 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. -- Comment(by dterei): Yes, I've been meaning to update this bug. Doing now. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7608#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7608: LLVM only handles a hard-coded list of triples. -------------------------------------+-------------------------------------- Reporter: singpolyma | Owner: Type: task | Status: new Priority: normal | Milestone: Component: Compiler (LLVM) | Version: 7.7 Keywords: cross-compiling llvm | Os: Unknown/Multiple Architecture: Unknown/Multiple | Failure: Other Difficulty: Unknown | Testcase: Blockedby: | Blocking: 7610 Related: | -------------------------------------+-------------------------------------- Changes (by dterei): * failure: GHC doesn't work at all => Other * type: bug => task -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7608#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7608: LLVM only handles a hard-coded list of triples. -------------------------------------+-------------------------------------- Reporter: singpolyma | Owner: dterei Type: task | Status: new Priority: normal | Milestone: 7.8.1 Component: Compiler (LLVM) | Version: 7.7 Keywords: cross-compiling llvm | Os: Unknown/Multiple Architecture: Unknown/Multiple | Failure: Other Difficulty: Unknown | Testcase: Blockedby: | Blocking: 7610 Related: | -------------------------------------+-------------------------------------- Changes (by igloo): * owner: => dterei * milestone: => 7.8.1 Comment: 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. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7608#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC