From f476bb7d4db30e4c5b03c88aa64783f7872ebf7c Mon Sep 17 00:00:00 2001 From: ian Date: Tue, 14 Feb 2012 20:47:35 +0000 Subject: [PATCH 1/1] PR go/48407 runtime: Permit building libgo without libffi. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@184234 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgo/runtime/go-reflect-call.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/libgo/runtime/go-reflect-call.c b/libgo/runtime/go-reflect-call.c index a818dba438e..688c68e581e 100644 --- a/libgo/runtime/go-reflect-call.c +++ b/libgo/runtime/go-reflect-call.c @@ -8,13 +8,17 @@ #include #include -#include "ffi.h" +#include "config.h" #include "go-alloc.h" #include "go-assert.h" #include "go-type.h" #include "runtime.h" +#ifdef USE_LIBFFI + +#include "ffi.h" + /* The functions in this file are only called from reflect_call. As reflect_call calls a libffi function, which will be compiled without -fsplit-stack, it will always run with a large stack. */ @@ -500,3 +504,20 @@ reflect_call (const struct __go_func_type *func_type, const void *func_addr, free (call_result); } + +#else /* !defined(USE_LIBFFI) */ + +void +reflect_call (const struct __go_func_type *func_type __attribute__ ((unused)), + const void *func_addr __attribute__ ((unused)), + _Bool is_interface __attribute__ ((unused)), + _Bool is_method __attribute__ ((unused)), + void **params __attribute__ ((unused)), + void **results __attribute__ ((unused))) +{ + /* Without FFI there is nothing we can do. */ + runtime_throw("libgo built without FFI does not support " + "reflect.Call or runtime.SetFinalizer"); +} + +#endif /* !defined(USE_LIBFFI) */ -- 2.11.0