Hi Wilco, > On 23 Dec 2018, at 12:09, Olivier Hainque <hain...@adacore.com> wrote: > >> Remember these are just temporaries for use in the prolog and epilog - >> there is no need to save/restore the static base. Setting static chain >> to x9 and the temporaries to x10/x11 is the simplest solution. We >> can separately look at why the prolog uses more than a single >> temporary. > > Ok, I'm happy to test that :-) > > With local adjustments to libffi for starters.
Finally back on this after a Christmas break, some time away on travel, then an oversight in the patch which required extra adjustment & testing cycles. The attached path works fine for our gcc-8 based Ada toolchains on VxWorks, and bootstraps + regression tests fine with a recent mainline on aarch64-linux configured with --enable-languages=all. I understand that this is not stage 4 material and whatever we want to do in this area will probably have to wait until stage 1 reopens. I also understand that the libffi parts are to be proposed to the libffi project, so some synchronization will be needed on this part at least. So, keeping the ball rolling ... Thanks in advance for your input! With Kind Regards, Olivier 2019-01-22 Olivier Hainque <hain...@adacore.com> Change static chain from r18 to r9 on aarch64 gcc/ * config/aarch64/aarch64.h (STATIC_CHAIN_REGNUM): Use r9 instead of r18. * config/aarch64/aarch64.c (PROBE_STACK_FIRST_REG, PROBE_STACK_SECOND_REG): Use r10/r11 instead r9/r10. gcc/testsuite/ * gcc.dg/cwsc1.c: Expect r9 as the static chain on aarch64. libffi/ * src/aarch64/sysv.S (ffi_call_SYSV): Expect r9 as the static chain. (ffi_go_closure_SYSV): Likewise. * testsuite/libffi.go/static-chain.h: Likewise.
aarch64-static-chain.diff
Description: Binary data