#10383: AArch64: get GHC Calling convention working ----------------------------------------+---------------------------------- Reporter: erikd | Owner: erikd Type: feature request | Status: new Priority: normal | Milestone: 7.12.1 Component: Compiler | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: aarch64 Type of failure: Building GHC failed | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: ----------------------------------------+---------------------------------- Comment (by erikd): With the help of @rwbarton got the disassembly around the crash site: {{{ (gdb) disass 0x0000007fb3dac244 Dump of assembler code for function stg_ap_p_fast$def: 0x0000007fb3dac1d8 <+0>: mov x24, x20 0x0000007fb3dac1dc <+4>: and x8, x22, #0x7 0x0000007fb3dac1e0 <+8>: cmp x8, #0x1 0x0000007fb3dac1e4 <+12>: b.ne 0x7fb3dac1f8 <stg_ap_p_fast$def+32> 0x0000007fb3dac1e8 <+16>: ldr x8, [x22,#-1] 0x0000007fb3dac1ec <+20>: mov x20, x24 0x0000007fb3dac1f0 <+24>: blr x8 0x0000007fb3dac1f4 <+28>: ret 0x0000007fb3dac1f8 <+32>: sub x20, x24, #0x10 0x0000007fb3dac1fc <+36>: cmp x20, x28 0x0000007fb3dac200 <+40>: b.cs 0x7fb3dac220 <stg_ap_p_fast$def+72> 0x0000007fb3dac204 <+44>: str x23, [x24,#-8] 0x0000007fb3dac208 <+48>: adrp x8, 0x7fb3dc0000 0x0000007fb3dac20c <+52>: ldr x8, [x8,#424] 0x0000007fb3dac210 <+56>: str x8, [x24,#-16]! 0x0000007fb3dac214 <+60>: mov x20, x24 0x0000007fb3dac218 <+64>: bl 0x7fb3da32a8 <__stg_gc_enter_1$def> 0x0000007fb3dac21c <+68>: ret 0x0000007fb3dac220 <+72>: and x22, x22, #0xfffffffffffffff8 0x0000007fb3dac224 <+76>: adrp x25, 0x7fb3dbf000 0x0000007fb3dac228 <+80>: ldr x25, [x25,#1584] 0x0000007fb3dac22c <+84>: ldr x26, [x22] 0x0000007fb3dac230 <+88>: ldr w8, [x25,#224] 0x0000007fb3dac234 <+92>: cbz w8, 0x7fb3dac244 <stg_ap_p_fast$def+108> 0x0000007fb3dac238 <+96>: adrp x0, 0x7fb3dbe000 <cIL_str$def> 0x0000007fb3dac23c <+100>: add x0, x0, #0x20 0x0000007fb3dac240 <+104>: bl 0x7fb3d7439c <debugBelch> => 0x0000007fb3dac244 <+108>: ldrsw x26, [x26,#-8] 0x0000007fb3dac248 <+112>: ldr w8, [x25,#224] }}} which shows the crash on the instruction `ldrsw x26, [x26,#-8]`: {{{ (gdb) info registers x0 0x0 0 x1 0x0 0 x2 0x1 1 x3 0x0 0 x4 0x0 0 x5 0x0 0 x6 0xffffffbb 4294967227 x7 0x0 0 x8 0x40 64 x9 0x0 0 x10 0xffffffff 4294967295 x11 0x1 1 x12 0x7fb4591428 548486583336 x13 0x12 18 x14 0x7fb3a09fff 548474494975 x15 0x2 2 x16 0x7fb3dc0250 548478386768 x17 0x7fb3c329f4 548476758516 x18 0x7fffffa790 549755791248 x19 0x7fb3dc4998 548478405016 x20 0x7fb3a051c8 548474474952 x21 0x7fb3a092b0 548474491568 x22 0x7fb3dc4998 548478405016 x23 0x7fb3a09291 548474491537 x24 0x7fb3a051d8 548474474968 x25 0x7fb3dc4578 548478403960 x26 0x0 0 x27 0x0 0 x28 0x7fb3a050c0 548474474688 x29 0x7fffffead0 549755808464 x30 0x7fb3dac244 548478304836 sp 0x7fffffaa30 0x7fffffaa30 pc 0x7fb3dac244 0x7fb3dac244 <stg_ap_p_fast$def+108> cpsr 0x60000000 1610612736 fpsr 0x0 0 fpcr 0x0 0 }}} and register `x26` is `0x0`. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10383#comment:9> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler