[GHC] #8816: Make SPARC registerised again.

#8816: Make SPARC registerised again. -----------------------------------+--------------------------------- Reporter: kgardas | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Keywords: | Operating System: Solaris Architecture: sparc | Type of failure: None/Unknown Difficulty: Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | -----------------------------------+--------------------------------- It looks like recent GHC switched to unregisterised build on SPARC by default. This is kind of regression with the past GHCs where registerised builds were supported. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8816 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8816: Make SPARC registerised again. ------------------------------------+--------------------------- Reporter: kgardas | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: Solaris | Architecture: sparc Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: 8847 Blocking: | Related Tickets: ------------------------------------+--------------------------- Changes (by kgardas): * blockedby: => 8847 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8816#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8816: Make SPARC registerised again. ------------------------------------+--------------------------- Reporter: kgardas | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: Resolution: | Keywords: Operating System: Solaris | Architecture: sparc Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: 8847 Blocking: | Related Tickets: ------------------------------------+--------------------------- Changes (by kgardas): * version: 7.6.3 => -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8816#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8816: Make SPARC registerised again. ------------------------------------------+--------------------------- Reporter: kgardas | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: Resolution: | Keywords: Operating System: Solaris | Architecture: sparc Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: 8847 Blocking: | Related Tickets: Differential Revisions: | ------------------------------------------+--------------------------- Comment (by thomie): This may be obvious, but that default is decided in `configure.ac`: {{{ dnl ** Do an unregisterised build? dnl -------------------------------------------------------------- case "$HostArch" in i386|x86_64|powerpc|arm) UnregisterisedDefault=NO ;; *) UnregisterisedDefault=YES ;; esac }}} Last changed in commit f917eeb824cfb7143dde9b12e501d4ddb0049b65. But before adding `|sparc` to that list, at least #8847 needs to be fixed first. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8816#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8816: Make SPARC registerised again. ------------------------------------+------------------------------ Reporter: kgardas | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: Resolution: | Keywords: Operating System: Solaris | Architecture: sparc Type of failure: None/Unknown | Test Case: Blocked By: 8847 | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ------------------------------------+------------------------------ Comment (by slyfox): To try NCG locally you don't even need to patch autoconf. That did the trick for me: {{{ $ ./configure --target=sparc-unknown-linux-gnu --disable-unregisterised $ make }}} Unfortunately NCG for sparc needs a few more fixes. 64-bit subtract inplementation: {{{ rts_dist_HC rts/dist/build/StgStartup.o ghc-stage1: panic! (the 'impossible' happened) (GHC version 8.3.20170408 for sparc-unknown-linux): iselExpr64(sparc) I64[_c2::P32 + 64] - %MO_UU_Conv_W32_W64((Hp + 4) - I32[_c3::I32]) Call stack: CallStack (from HasCallStack): prettyCurrentCallStack, called at compiler/utils/Outputable.hs:1134:58 in ghc:Outputable callStackDoc, called at compiler/utils/Outputable.hs:1138:37 in ghc:Outputable pprPanic, called at compiler/nativeGen/SPARC/CodeGen/Gen64.hs:196:6 in ghc:SPARC.CodeGen.Gen64 Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug }}} Something fun in register allocator WRT PIC register: {{{ HC [stage 1] libraries/ghc-prim/dist-install/build/GHC/Types.o ghc-stage1: panic! (the 'impossible' happened) (GHC version 8.3.20170408 for sparc-unknown-linux): SPARC.CodeGen.Base.getRegisterReg: global is in memory PicBaseReg Call stack: CallStack (from HasCallStack): prettyCurrentCallStack, called at compiler/utils/Outputable.hs:1134:58 in ghc:Outputable callStackDoc, called at compiler/utils/Outputable.hs:1138:37 in ghc:Outputable pprPanic, called at compiler/nativeGen/SPARC/CodeGen/Base.hs:103:21 in ghc:SPARC.CodeGen.Base }}} '''-fPIC''' is not really supported by NCG: {{{ rts_dist_HC rts/dist/build/Compact.thr_l_dyn_o ghc-stage1: panic! (the 'impossible' happened) (GHC version 8.3.20170408 for sparc-unknown-linux): MachCodeGen: sparc genSwitch PIC not finished CallStack (from HasCallStack): error, called at compiler/nativeGen/SPARC/CodeGen.hs:316:11 in ghc:SPARC.CodeGen }}} prof build is also broken in an interesting way: {{{ HC [stage 1] libraries/ghc-prim/dist-install/build/GHC/Types.p_o /tmp/ghc26402_0/ghc_3.s: Assembler messages: /tmp/ghc26402_0/ghc_3.s:107:0: error: Error: can't resolve `iat6_str' {.rodata.str.iat6_str section} - `ghczmprim_GHCziTypes_HEqzusc_info' {.rodata.str.iat7_str section} | 107 | .long iat6_str-(ghczmprim_GHCziTypes_HEqzusc_info)+0 | ^ }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8816#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8816: Make SPARC registerised again. ------------------------------------+------------------------------ Reporter: kgardas | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: Resolution: | Keywords: Operating System: Solaris | Architecture: sparc Type of failure: None/Unknown | Test Case: Blocked By: 8847 | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ------------------------------------+------------------------------ Changes (by slyfox): * cc: slyfox (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8816#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8816: Make SPARC registerised again. ------------------------------------+------------------------------ Reporter: kgardas | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: Resolution: | Keywords: Operating System: Solaris | Architecture: sparc Type of failure: None/Unknown | Test Case: Blocked By: 8847 | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ------------------------------------+------------------------------ Comment (by kgardas): Hi Sergei, I've just attached {{{git diff}}} in my sparc registerised build tree. It's really old, so probably bit rotted more or less but perhaps you may find it at least a little bit helpful. If I remember correctly, this was able to get GHC running and the majority of failures were caused by bug in show of double type -- hence my attempt to test this in bindisttest/HelloWorld.lhs. The issue was in register mapping while traversing calls from Haskell to C and back in showPrec function IIRC. Otherwise it kind of worked at least somehow. I'll not have time to resurrect my attempts on SPARC for a few upcoming months at least but would be glad if you can have a look at it. I'm surprised you are using sparc linux. I've thought Linux is not well supported on SPARC. My reference hence was always Solaris, but due to recent Oracle movements w.r.t. this OS I'm moving away from it to OpenBSD land... Thanks! Karel -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8816#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8816: Make SPARC registerised again. ------------------------------------+------------------------------ Reporter: kgardas | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: Resolution: | Keywords: Operating System: Solaris | Architecture: sparc Type of failure: None/Unknown | Test Case: Blocked By: 8847 | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ------------------------------------+------------------------------ Changes (by kgardas): * Attachment "sparc-reg.diff" added. outdated SPARC NCG hacking diff -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8816 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC