[GHC] #10383: AArch64: get GHC Calling convention working
GHC
ghc-devs at haskell.org
Wed Jun 3 09:09:11 UTC 2015
#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):
Had a further (at least 3rd or 4th) look at the Aarch64 version of the
`StgRun` function in `rts/StgCRun.c`. I noticed that some some of the
registers that are pushed and popped on/off the stack were not listed in
the "clobbered registers" part of the `__asm__` definition.
Came up with this patch:
{{{
commit 5f75cbcea67cbb587a7d640f6241469744ab026f
Author: Erik de Castro Lopo <erikd at mega-nerd.com>
Date: Wed Jun 3 05:54:23 2015 +0000
rts: Fix clobbered registers list in aarch64 StgRun
diff --git a/rts/StgCRun.c b/rts/StgCRun.c
index 02ec532..46d7f11 100644
--- a/rts/StgCRun.c
+++ b/rts/StgCRun.c
@@ -820,8 +820,14 @@ StgRun(StgFunPtr f, StgRegTable *basereg) {
: "=r" (r)
: "r" (f), "r" (basereg), "i" (RESERVED_C_STACK_BYTES)
- : "%x19", "%x20", "%x21", "%x22", "%x23", "%x24", "%x25", "%x26",
"%x27", "%x28",
- "%x16", "%x17", "%x30"
+
+ : "%x16", "%x17", /* Exclude %r18 (platform/temporary register) */
+ "%x19", "%x20", "%x21", "%x22", "%x23", "%x24", "%x25",
+ "%x26", "%x27", "%x28", /* Exclude %x29 (frame pointer) */
+ "%x30",
+ "%d8", "%d9", "%d10", "%d11", "%d12", "%d13", "%d14"
+
+
);
return r;
}
}}}
The stage2 compiler still segfaults, but comparing the `inplace/bin/ghc-
stage2 +RTS -Da` output showed that with the above patch the program got a
lot further before segfaulting.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10383#comment:11>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list