[GHC] #11395: The via-C code generation backend is incompatible with gcc 5.3.1 on m68k (ELF)

#11395: The via-C code generation backend is incompatible with gcc 5.3.1 on m68k
(ELF)
-------------------------------------+-------------------------------------
Reporter: mkarcher | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.10.2
Keywords: | Operating System: Linux
Architecture: m68k | Type of failure: GHC doesn't work
| at all
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
ghc is generating C code like in the following simplified example:
demo1.c:
{{{
#include

#11395: The via-C code generation backend is incompatible with gcc 5.3.1 on m68k (ELF) --------------------------------------------+------------------------------ Reporter: mkarcher | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Linux | Architecture: m68k Type of failure: GHC doesn't work at all | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | --------------------------------------------+------------------------------ Changes (by slyfox): * cc: slyfox (added) Comment: changeset:5a31f231eebfb8140f9b519b166094d9d4fc2d79 and changeset:31a7bb463b6a3e99ede6de994c1f449c43a9118c dealt with similar issue on ELFv2 PPC64 but for passed arguments for a function. There is a way to detect a prototype skew by building ghc with CFLAGS/LDFLAGS=-flto. With this hack i've fixed a few SIGSEGVs on ia64 where pointers differ from function pointers (like changeset:d82f592522eb8e063276a8a8c87ab93e18353c6b) GHC still has a lot of mismatching prototypes though. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11395#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11395: The via-C code generation backend is incompatible with gcc 5.3.1 on m68k (ELF) --------------------------------------------+------------------------------ Reporter: mkarcher | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Linux | Architecture: m68k Type of failure: GHC doesn't work at all | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | --------------------------------------------+------------------------------ Comment (by slyfox): my mk/build.mk for the LTO test is: {{{ CPUS=9 SRC_CC_OPTS += -flto=$(CPUS) -ffat-lto-objects SRC_LD_OPTS += -flto=$(CPUS) -ffat-lto-objects SRC_HC_OPTS += -optc-flto=$(CPUS) -optc-ffat-lto-objects SRC_HC_OPTS += -optl-flto=$(CPUS) -optl-ffat-lto-objects }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11395#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11395: The via-C code generation backend is incompatible with gcc 5.3.1 on m68k (ELF) --------------------------------------------+------------------------------ Reporter: mkarcher | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Linux | Architecture: m68k Type of failure: GHC doesn't work at all | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | --------------------------------------------+------------------------------ Comment (by slyfox): To get generated code we can run: {{{ "inplace/bin/ghc-stage1" \ -static -H64m -O1 \ -optc-flto=9 -optc-ffat-lto-objects \ -optl-flto=9 -optl-ffat-lto-objects \ -optc-ggdb2 -optl-ggdb2 \ -j4 \ -optc-Werror=implicit-function-declaration -optc-Werror=overflow \ -Wall \ -lbfd \ -Iincludes -Iincludes/dist -Iincludes/dist-derivedconstants/header \ -Iincludes/dist-ghcconstants/header -Irts -Irts/dist/build \ -DCOMPILING_RTS -this-package-key rts \ -optc-DNOSMP -dcmm-lint \ -i -irts -irts/dist/build \ -irts/dist/build/autogen \ -Irts/dist/build -Irts/dist/build/autogen \ -O2 \ -C rts/Exception.cmm \ -o rts/dist/build/Exception.hc }}} '''rts/dist/build/Exception.hc''' contains the following declarations: {{{ /* (incomplete) symbol declaraion */ EF_(raiseExceptionHelper); ... /* exact prototype dectaration, assignment and call: */ { W_ (*ghcFunPtr)(void *, void *, void *); ghcFunPtr = ((W_ (*)(void *, void *, void *))raiseExceptionHelper); _c2y = ghcFunPtr((void *)(W_)BaseReg, (void *)(W_)CurrentTSO, (void *)_c2z);;} }}} It comes from '''rts/Exception.cmm''': {{{ retry_pop_stack: SAVE_THREAD_STATE(); (frame_type) = ccall raiseExceptionHelper(BaseReg "ptr", CurrentTSO "ptr", exception "ptr"); LOAD_THREAD_STATE(); }}} As we see unannotated return type defaults to '''W_''' ('''StgWord''', non-pointer type). So the question is: Does gcc ignore type coercion given in '''ghcFunPtr =''' assignment and uses original declaration? gcc's '''-fdump-*-all''' options might hint at where gcc loses information about argument type. Could it be real (but similar) error happens somewhere else? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11395#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11395: The via-C code generation backend is incompatible with gcc 5.3.1 on m68k (ELF) --------------------------------------------+------------------------------ Reporter: mkarcher | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Linux | Architecture: m68k Type of failure: GHC doesn't work at all | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | --------------------------------------------+------------------------------ Comment (by slyfox): One more note: The bug you describe should surface on amd64 if you change return type from 'int' (%rax) to 'double' (%xmm0) in your example, correct? On gcc-5.3.0/amd64 it seems to work as expected: {{{ call double_returning_function cvttsd2si %xmm0, %eax cmpl $42, %eax }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11395#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11395: The via-C code generation backend is incompatible with gcc 5.3.1 on m68k (ELF) --------------------------------------------+------------------------------ Reporter: mkarcher | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Linux | Architecture: m68k Type of failure: GHC doesn't work at all | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | --------------------------------------------+------------------------------ Comment (by slyfox): Filed a bug upstream to investigate further and/or find a workaround: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69221 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11395#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11395: The via-C code generation backend is incompatible with gcc 5.3.1 on m68k (ELF) --------------------------------------------+------------------------------ Reporter: mkarcher | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Linux | Architecture: m68k Type of failure: GHC doesn't work at all | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | --------------------------------------------+------------------------------ Comment (by mkarcher): I can confirm your obvservation that on amd64, gcc 5.3.1 does indeed take the type of the function pointer into account when it decides whether the return value is in %eax (for int), %rax (for void*) or %xmm0 (for double). It's interesting that gcc doesn't do it on m68k. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11395#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11395: The via-C code generation backend is incompatible with gcc 5.3.1 on m68k (ELF) --------------------------------------------+------------------------------ Reporter: mkarcher | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Linux | Architecture: m68k Type of failure: GHC doesn't work at all | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | --------------------------------------------+------------------------------ Comment (by mkarcher): It seems gcc introduces a temporary double variable in the double/int mismatch on amd64, because the double-to-int conversion is a semantic conversion changing the representation. On the other hand, the void*-to- int conversion is reinterpreting the same value as a different type without the need of a conversion instruction (like cvttsd2si in the amd64 case). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11395#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11395: The via-C code generation backend is incompatible with gcc 5.3.1 on m68k (ELF) --------------------------------------------+------------------------------ Reporter: mkarcher | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Linux | Architecture: m68k Type of failure: GHC doesn't work at all | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | --------------------------------------------+------------------------------ Comment (by glaubitz): Replying to [comment:5 slyfox]:
Filed a bug upstream to investigate further and/or find a workaround: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69221
Hmm, looks like gcc upstream doesn't agree it's actually a gcc problem. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11395#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11395: The via-C code generation backend is incompatible with gcc 5.3.1 on m68k (ELF) --------------------------------------------+------------------------------ Reporter: mkarcher | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Linux | Architecture: m68k Type of failure: GHC doesn't work at all | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | --------------------------------------------+------------------------------ Comment (by rwbarton): Could we, instead of {{{ EF_(raiseExceptionHelper); ... /* exact prototype dectaration, assignment and call: */ { W_ (*ghcFunPtr)(void *, void *, void *); ghcFunPtr = ((W_ (*)(void *, void *, void *))raiseExceptionHelper); }}} generate a local extern function declaration, like {{{ { W_ (*ghcFunPtr)(void *, void *, void *); extern W_ (*raiseExceptionHelper)(void *, void *, void *); ghcFunPtr = ((W_ (*)(void *, void *, void *))raiseExceptionHelper); }}} (sorry if I got the syntax wrong)? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11395#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11395: The via-C code generation backend is incompatible with gcc 5.3.1 on m68k (ELF) --------------------------------------------+------------------------------ Reporter: mkarcher | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Linux | Architecture: m68k Type of failure: GHC doesn't work at all | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | --------------------------------------------+------------------------------ Comment (by mkarcher): rwbarton: The possibility to use a local extern function declaration to avoid the function pointer hack occurred to me, too. I don't know enough about ghc internals to determine whether it is viable. You might try to go without ghcFunPtr, if possible. Like generating {{{ { extern W_ raiseExceptionHelper(void *, void *, void *); raiseExceptionHelper((void*)((W_)BaseReg, (void*)(W_)CurrentTSO, (void*)_c2z);;} }}} instead of {{{ { W_ (*ghcFunPtr)(void *, void *, void *); ghcFunPtr = ((W_ (*)(void *, void *, void *))raiseExceptionHelper); _c2y = ghcFunPtr((void *)(W_)BaseReg, (void *)(W_)CurrentTSO, (void *)_c2z);;} }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11395#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11395: The via-C code generation backend is incompatible with gcc 5.3.1 on m68k (ELF) --------------------------------------------+------------------------------ Reporter: mkarcher | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Linux | Architecture: m68k Type of failure: GHC doesn't work at all | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | --------------------------------------------+------------------------------ Comment (by slyfox): Yeah, I think local extern should work fine (and be cleaner!). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11395#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11395: The via-C code generation backend is incompatible with gcc 5.3.1 on m68k (ELF) --------------------------------------------+------------------------------ Reporter: mkarcher | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Linux | Architecture: m68k Type of failure: GHC doesn't work at all | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | --------------------------------------------+------------------------------ Comment (by glaubitz): Another m68k porter showed me today that this bug isn't unique to ghcb but was also found in Erlang:
http://www.grep.be/blog/en/computer/debian/m68k/broken_c_code/ https://lists.debian.org/debian-68k/2007/12/msg00078.html
Wouter's analysis confirms what has being sad in this bug report. The code in question is basically violating the C standard and the fact that it doesn't result in problems is just luck. Who knows we might have new architectures or compilers in the future which will behave differently and therefore this bug might become visible again unless it is fixed. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11395#comment:12 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11395: The via-C code generation backend is incompatible with gcc 5.3.1 on m68k (ELF) --------------------------------------------+------------------------------ Reporter: mkarcher | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Linux | Architecture: m68k Type of failure: GHC doesn't work at all | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | --------------------------------------------+------------------------------ Changes (by mkarcher): * Attachment "0001-Extend-gcc-on-m68k-to-allow-calling-incorrectly- decl.patch" added. Patch for gcc to support the non-standard construct used by ghc on m68k. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11395 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11395: The via-C code generation backend is incompatible with gcc 5.3.1 on m68k (ELF) --------------------------------------------+------------------------------ Reporter: mkarcher | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Linux | Architecture: m68k Type of failure: GHC doesn't work at all | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | --------------------------------------------+------------------------------ Changes (by slyfox): * Attachment "0001-c-codegen-split-external-symbol-prototypes-EF_.patch" added. 0001-c-codegen-split-external-symbol-prototypes-EF_.patch -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11395 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11395: The via-C code generation backend is incompatible with gcc 5.3.1 on m68k (ELF) --------------------------------------------+------------------------------ Reporter: mkarcher | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Linux | Architecture: m68k Type of failure: GHC doesn't work at all | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | --------------------------------------------+------------------------------ Comment (by slyfox): Please try the 0001-c-codegen-split-external-symbol-prototypes-EF_.patch patch on vanilla gcc. I hope it will workaround a problem on m68k without breaking other platforms. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11395#comment:13 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

Please try the 0001-c-codegen-split-external-symbol-prototypes-EF_.patch
#11395: The via-C code generation backend is incompatible with gcc 5.3.1 on m68k (ELF) --------------------------------------------+------------------------------ Reporter: mkarcher | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Linux | Architecture: m68k Type of failure: GHC doesn't work at all | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | --------------------------------------------+------------------------------ Comment (by glaubitz): Replying to [comment:13 slyfox]: patch on vanilla gcc. Thanks. I'll give it a shot and report back. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11395#comment:14 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11395: The via-C code generation backend is incompatible with gcc 5.3.1 on m68k (ELF) --------------------------------------------+------------------------------ Reporter: mkarcher | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Linux | Architecture: m68k Type of failure: GHC doesn't work at all | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | --------------------------------------------+------------------------------ Comment (by glaubitz): Just cloned ghc from git, applied the patch and cross-compiled it. Unfortunately, it segfaults right away: {{{ root@pacman:~> ./ghc Segmentation fault (core dumped) root@pacman:~> file ./ghc ./ghc: ELF 32-bit MSB executable, Motorola m68k, 68020, version 1 (SYSV), dynamically linked, interpreter /lib/ld.so.1, for GNU/Linux 3.2.0, BuildID[sha1]=b7cc59d2d71bcb64fef73c1628602253f24bfa9f, not stripped root@pacman:~> }}} Will remove the patch and test again, just to make sure it's not a general issue with ghc 8.x on m68k. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11395#comment:15 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11395: The via-C code generation backend is incompatible with gcc 5.3.1 on m68k
(ELF)
--------------------------------------------+------------------------------
Reporter: mkarcher | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.10.2
Resolution: | Keywords:
Operating System: Linux | Architecture: m68k
Type of failure: GHC doesn't work at all | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
--------------------------------------------+------------------------------
Comment (by slyfox):
I've also tried to build m68k crosscompiler
(using https://wiki.debian.org/M68k/sbuildQEMU to test produced binaries)
and noticed GHC has the issue similar to:
http://bugs.python.org/issue17237
m68k aligns structs containing integers and pointers to 2 bytes
(not 4 bytes). That makes StgClosure struct addresses look tagged
even if they are not.
An example of GHC's startup crash.
Test checks if untagging macro works:
{{{
Core was generated by `/tmp/a +RTS -Ds -Di -Dw -DG -Dg -Db -DS -Dt -Dp -Da
-Dl -Dm -Dz -Dc -Dr'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x80463b0a in LOOKS_LIKE_INFO_PTR_NOT_NULL (p=32858) at
includes/rts/storage/ClosureMacros.h:248
248 return (info->type != INVALID_OBJECT && info->type <
N_CLOSURE_TYPES) ? rtsTrue : rtsFalse;
(gdb) bt
#0 0x80463b0a in LOOKS_LIKE_INFO_PTR_NOT_NULL (p=32858) at
includes/rts/storage/ClosureMacros.h:248
#1 0x80463b46 in LOOKS_LIKE_INFO_PTR (p=32858) at
includes/rts/storage/ClosureMacros.h:253
#2 0x80463b6c in LOOKS_LIKE_CLOSURE_PTR (p=0x805aac6e

#11395: The via-C code generation backend is incompatible with gcc 5.3.1 on m68k (ELF) --------------------------------------------+------------------------------ Reporter: mkarcher | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Linux | Architecture: m68k Type of failure: GHC doesn't work at all | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | --------------------------------------------+------------------------------ Comment (by slyfox): Sent the patch for review addressing comment 16: Phab:D1974 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11395#comment:17 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11395: The via-C code generation backend is incompatible with gcc 5.3.1 on m68k (ELF) --------------------------------------------+------------------------------ Reporter: mkarcher | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Linux | Architecture: m68k Type of failure: GHC doesn't work at all | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | --------------------------------------------+------------------------------ Comment (by slyfox): Sent slightly tweaked 0001-c-codegen-split-external-symbol-prototypes- EF_.patch for review as Phab:D1975 With both Phab:D1974 and Phab:D1975 I get hello world working on qemu-m68k in vanilla -dynamic and -prof modes. Don't know about ghc itself as my emulator can't handle generated code yet: $ inplace/bin/ghc-stage2 --make /tmp/a.hs /home/slyfox/dev/git/qemu-m68k/tcg/tcg.c:1774: tcg fatal error -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11395#comment:18 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11395: The via-C code generation backend is incompatible with gcc 5.3.1 on m68k (ELF) --------------------------------------------+------------------------------ Reporter: mkarcher | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Linux | Architecture: m68k Type of failure: GHC doesn't work at all | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | --------------------------------------------+------------------------------ Comment (by glaubitz): Replying to [comment:18 slyfox]:
With both Phab:D1974 and Phab:D1975 I get hello world working on qemu-m68k in vanilla -dynamic and -prof modes.
Wow, I am very excited to hear this! Thanks a lot for investing your time into fixing this. Also, I was very happy to see another bug in qemu-m68k being squashed in the process. Looking forward to test the changes once they have been merged. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11395#comment:19 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11395: The via-C code generation backend is incompatible with gcc 5.3.1 on m68k
(ELF)
--------------------------------------------+------------------------------
Reporter: mkarcher | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.10.2
Resolution: | Keywords:
Operating System: Linux | Architecture: m68k
Type of failure: GHC doesn't work at all | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
--------------------------------------------+------------------------------
Comment (by Sergei Trofimovich

#11395: The via-C code generation backend is incompatible with gcc 5.3.1 on m68k (ELF) --------------------------------------------+------------------------------ Reporter: mkarcher | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Linux | Architecture: m68k Type of failure: GHC doesn't work at all | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | --------------------------------------------+------------------------------ Comment (by slyfox): Filed https://github.com/vivier/qemu-m68k/issues/6 for possible qemu limitation to handle complex memory loads. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11395#comment:21 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11395: The via-C code generation backend is incompatible with gcc 5.3.1 on m68k
(ELF)
--------------------------------------------+------------------------------
Reporter: mkarcher | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.10.2
Resolution: | Keywords:
Operating System: Linux | Architecture: m68k
Type of failure: GHC doesn't work at all | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
--------------------------------------------+------------------------------
Comment (by Sergei Trofimovich

#11395: The via-C code generation backend is incompatible with gcc 5.3.1 on m68k (ELF) --------------------------------------------+------------------------------ Reporter: mkarcher | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Linux | Architecture: m68k Type of failure: GHC doesn't work at all | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | --------------------------------------------+------------------------------ Comment (by slyfox): The problem in comment:#21 was in ASL/LSL implementation: https://github.com/vivier/qemu-m68k/pull/7 should fix it (lightly tested) With Phab:D1975 applied ghc-stage2 still SIGSEGs. Current run of regression tests fails the following ~200 tests: {{{ $ make fasttest TEST_HC=$(pwd)/inplace/bin/ghc-stage1 THREADS=12 # testsuite/mk/ghcconfig_*.mk needs a fix in WORDSIZE, GHCI support }}} TEST="T7962 T9905fail3 T9905fail2 T9905fail1 ghc-e-fail2 ghc-e-fail1 annfail09 annfail03 T7859 cabal08 T1372 T5681 T8131b T7571 T9576 cabal09 cabal01 cabal03 cabal04 cabal05 cabal06 rnfail043 T3333 ghcilink001 ghcilink002 ghcilink003 ghcilink004 ghcilink005 ghcilink006 GShow1 T9045 linker_unload stack001 stack003 T5435_v_gcc bug1010 T5435_v_asm T9839_01 T10017 testmblockalloc T8124 T5250 T9329 T11103 overloadedrecfldsfail09 SafeLang16 SafeLang12 SafeLang01 T8628 T6145 T8639_api T10508_api literals parsed RAE_T32a T11195 T11303b T11303 T11276 T11374 UnsafeInfered02 UnsafeWarn02 UnsafeInfered12 T5550 T7702 T5321FD T5030 T4801 T5631 T5837 T9872a T5642 T9872b T3064 parsing001 T9872d T9872c T1969 T5321Fun T783 T9233 T9961 recomp009 ImpSafeOnly08 safePkg01 ImpSafeOnly02 ImpSafeOnly03 ImpSafeOnly01 ImpSafeOnly06 ImpSafeOnly07 ImpSafeOnly04 ImpSafeOnly05 ImpSafeOnly09 ImpSafeOnly10 T10052 prog001 T7022 T9160 AtomicPrimops tryReadMVar2 conc006 overloadedrecfldsrun04 overloadedlabelsrun04 T680 T5314 T949 prof-doc-last heapprof001 T3001-2 scc003 T10826 dynCompileExpr bug1465 ExtraConstraintsWildcardInPatternSplice NamedWildcardInTypeSplice posix004 ghci004 ghci006 landmines dynHelloWorld T9360a T9360b T5313 T7478 Conversions T3586 T5549 T7954 T5237 T3245 T4321 T7850 T9203 T10359 MethSharing integerGmpInternals dataToExpQUnit T3007 T1679 ffi014 TH_spliceViewPat T1407 load_short_name T6016 qsem001 hTell002 showDouble qsemn001 T4006 memo002 dynamic003 unicode002 stableptr003 stableptr004 T7600 cgrun058 cgrun074 cgrun026 encoding004 T3307 openTempFile001 environment001 T4855 num008 T11430 T10269 T10268 exampleTest T11321 comments T10396 listcomps T10307 T10399 bundle-export T10357 T10354 T10358 annotations T10255 T10276 T10278 T11018 T10313 T10312 T11332 parseTree T10309 T10280 boolFormula apirecomp001 numrun014 T8726 arith001 arith012 arith005 KindEqualities2 RAE_T32b Rae31 T876 T4830 T7257 lazy-bs-alloc" Many of them are not real problems (like missing TH annotation around tests, perf failures) but some are real failures. Investigating. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11395#comment:23 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11395: The via-C code generation backend is incompatible with gcc 5.3.1 on m68k
(ELF)
--------------------------------------------+------------------------------
Reporter: mkarcher | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.10.2
Resolution: | Keywords:
Operating System: Linux | Architecture: m68k
Type of failure: GHC doesn't work at all | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
--------------------------------------------+------------------------------
Comment (by Sergei Trofimovich

#11395: The via-C code generation backend is incompatible with gcc 5.3.1 on m68k
(ELF)
--------------------------------------------+------------------------------
Reporter: mkarcher | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.10.2
Resolution: | Keywords:
Operating System: Linux | Architecture: m68k
Type of failure: GHC doesn't work at all | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
--------------------------------------------+------------------------------
Comment (by Sergei Trofimovich

#11395: The via-C code generation backend is incompatible with gcc 5.3.1 on m68k (ELF) --------------------------------------------+------------------------------ Reporter: mkarcher | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Linux | Architecture: m68k Type of failure: GHC doesn't work at all | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | --------------------------------------------+------------------------------ Comment (by slyfox): With changeset:e46742f5c51938bc7c992ac37fecc6df8cab7647 I can get ghci working \o/ {{{ $ inplace/bin/ghc-stage2 --interactive GHCi, version 8.1.20160305: http://www.haskell.org/ghc/ :? for help Loaded GHCi configuration from /home/slyfox/.ghci }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11395#comment:26 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11395: The via-C code generation backend is incompatible with gcc 5.3.1 on m68k (ELF) --------------------------------------------+------------------------------ Reporter: mkarcher | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Linux | Architecture: m68k Type of failure: GHC doesn't work at all | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | --------------------------------------------+------------------------------ Comment (by glaubitz): Replying to [comment:26 slyfox]:
With changeset:e46742f5c51938bc7c992ac37fecc6df8cab7647 I can get ghci working \o/
Whoa, congrats. That's very impressive. Can't wait to start bootstrapping ghc on m68k in Debian :). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11395#comment:27 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11395: The via-C code generation backend is incompatible with gcc 5.3.1 on m68k (ELF) --------------------------------------------+------------------------------ Reporter: mkarcher | Owner: Type: bug | Status: closed Priority: normal | Milestone: 8.0.1 Component: Compiler | Version: 7.10.2 Resolution: fixed | Keywords: Operating System: Linux | Architecture: m68k Type of failure: GHC doesn't work at all | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | --------------------------------------------+------------------------------ Changes (by bgamari): * status: new => closed * resolution: => fixed * milestone: => 8.0.1 Comment: I've merged these to `ghc-8.0` as bd454972e94a639f57cf16a2d419e879f023e80e, 79737db203bed639c525861c5da57224ea663374, c769188ba88dc8e9011451170c58fdb5b03b4a35, f996692ed93c4d7744242a2212c2886359d29586. Thanks for your work! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11395#comment:28 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC