[GHC] #11395: The via-C code generation backend is incompatible with gcc 5.3.1 on m68k (ELF)
GHC
ghc-devs at haskell.org
Sat Mar 5 17:41:36 UTC 2016
#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
<stg_dummy_ret_closure>) at includes/rts/storage/ClosureMacros.h:258
#3 0x80463e4c in initStorage () at rts/sm/Storage.c:121
#4 0x8043ffb4 in hs_init_ghc (argc=0xf6ffebf0, argv=0xf6ffebf4,
rts_config=...) at rts/RtsStartup.c:181
#5 0x80455982 in hs_main (argc=1, argv=0xf6ffed54,
main_closure=0x804b8f70 <ZCMain_main_closure>, rts_config=...)
at rts/RtsMain.c:51
#6 0x80003c1c in main ()
}}}
GHC assumes last 2 pointer bits are tags on 32-bit targets.
But here 'stg_dummy_ret_closure' address violates the assumption:
LOOKS_LIKE_CLOSURE_PTR (p=0x805aac6e <stg_dummy_ret_closure>)
One more thing to tweak.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11395#comment:16>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list