diff mbox

Use static chain and libffi for Go closures

Message ID 54BAE53A.2080308@redhat.com
State New
Headers show

Commit Message

Richard Henderson Jan. 17, 2015, 10:42 p.m. UTC
On 01/17/2015 02:07 PM, Andrew Pinski wrote:
> On Sat, Jan 17, 2015 at 2:02 PM, Andreas Schwab <schwab@linux-m68k.org> wrote:
>> Andrew Pinski <pinskia@gmail.com> writes:
>>
>>> On Sat, Jan 17, 2015 at 1:26 PM, Richard Henderson <rth@redhat.com> wrote:
>>>> On 01/17/2015 11:07 AM, Andreas Schwab wrote:
>>>>> Richard Henderson <rth@redhat.com> writes:
>>>>>
>>>>>> On 01/17/2015 01:52 AM, Andreas Schwab wrote:
>>>>>>> ../../../libgo/go/reflect/makefunc_ffi_c.c:21:53: error: unknown type name 'ffi_go_closure'
>>>>>>>  void makeFuncFFI(const struct __go_func_type *ftyp, ffi_go_closure *impl)
>>>>>>>                                                      ^
>>>>>>> ../../../libgo/go/reflect/makefunc_ffi_c.c:86:48: error: unknown type name 'ffi_go_closure'
>>>>>>>  makeFuncFFI(const struct __go_func_type *ftyp, ffi_go_closure *impl)
>>>>>>>                                                 ^
>>>>>>> make[4]: *** [reflect/makefunc_ffi_c.lo] Error 1
>>>>>>
>>>>>> What target?
>>>>>
>>>>> Why does it matter?
>>>>
>>>> Because I don't see that error here, obviously.
>>>
>>>
>>> It fails for me with mips64-linux-gnu.
>>
>> It fails almost everywhere.
> 
> 
> Well it is working for aarch64-linux-gnu and x86_64-linux-gnu (the two
> other targets I care about).

I tested non-support of libffi go closures before applying the patches
for them for ppc, but I guess I busted something in the meantime.

Please try this.


r~
diff mbox

Patch

diff --git a/libgo/go/reflect/makefunc_ffi_c.c b/libgo/go/reflect/makefunc_ffi_c.c
index 727ae81..e708c93 100644
--- a/libgo/go/reflect/makefunc_ffi_c.c
+++ b/libgo/go/reflect/makefunc_ffi_c.c
@@ -5,17 +5,12 @@ 
 #include "runtime.h"
 #include "go-type.h"
 #include "go-panic.h"
-
-#ifdef USE_LIBFFI
-
 #include "go-ffi.h"
 
-#if FFI_GO_CLOSURES
+#if defined(USE_LIBFFI) && defined(FFI_GO_CLOSURES)
 #define USE_LIBFFI_CLOSURES
 #endif
 
-#endif /* defined(USE_LIBFFI) */
-
 /* Declare C functions with the names used to call from Go.  */
 
 void makeFuncFFI(const struct __go_func_type *ftyp, ffi_go_closure *impl)
diff --git a/libgo/runtime/go-ffi.h b/libgo/runtime/go-ffi.h
index afae4b6..a69da26 100644
--- a/libgo/runtime/go-ffi.h
+++ b/libgo/runtime/go-ffi.h
@@ -6,11 +6,8 @@ 
 
 #include "config.h"
 #include "go-type.h"
-
-#ifdef USE_LIBFFI
-
 #include "ffi.h"
 
+#ifdef USE_LIBFFI
 void __go_func_to_cif (const struct __go_func_type *, _Bool, _Bool, ffi_cif *);
-
 #endif