This is the mail archive of the
libffi-discuss@sourceware.org
mailing list for the libffi project.
Re: [gofrontend-dev] Re: [PATCH 00/13] Go closures, libffi, and the static chain
- From: Dominik Vogt <vogt at linux dot vnet dot ibm dot com>
- To: libffi-discuss at sourceware dot org, gcc-patches at gcc dot gnu dot org, gofrontend-dev at googlegroups dot com
- Cc: Andreas Krebbel <krebbel at linux dot vnet dot ibm dot com>
- Date: Thu, 11 Dec 2014 11:31:06 +0100
- Subject: Re: [gofrontend-dev] Re: [PATCH 00/13] Go closures, libffi, and the static chain
- Authentication-results: sourceware.org; auth=none
- References: <1412973773-3942-1-git-send-email-rth at redhat dot com> <20141211090623 dot GA30484 at linux dot vnet dot ibm dot com> <20141211092144 dot GE4283 at bubble dot grove dot modra dot org>
- Reply-to: libffi-discuss at sourceware dot org
On Thu, Dec 11, 2014 at 07:51:44PM +1030, Alan Modra wrote:
> On Thu, Dec 11, 2014 at 10:06:23AM +0100, Dominik Vogt wrote:
> > On s390x, the static chain register cannot be used for passing the
> > Go closure pointer to a function: According to the Abi, the
> > dynamic linker is allowed to destroy the contents of r0 (static
> > chain register) eventually causing a crash if libgo is linked
> > dynamically. The assumption that the static chain register can be
> > used to pass information to a function is wrong for s390x.
>
> I was worried about exactly the same "problem" on powerpc with r11
> being used for the static chain and also destroyed in linkage stubs.
> It turns out we don't traverse any linkage stubs.
Just to make this clear: It's not something that *might* happen.
It *does* happen on s390[x] which does not use libffi but the hand
written code in makefunc_s390.S and makefuncgo_s390[x].go.
The same may not happen when calling functions through libffi
(which may be dynamically linked) because ffi_call_go() is passed
the closure pointer as an argument and not in the static chain
register.
> See https://gcc.gnu.org/ml/gcc-patches/2014-11/msg00446.html.
Thanks for the link.
Ciao
Dominik ^_^ ^_^
--
Dominik Vogt
IBM Germany