aboutsummaryrefslogtreecommitdiff
path: root/libgo/runtime/go-reflect-call.c
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2013-11-06 19:49:01 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2013-11-06 19:49:01 +0000
commitf038dae646bac2b31be98ab592c0e5206d2d96f5 (patch)
tree39530b071991b2326f881b2a30a2d82d6c133fd6 /libgo/runtime/go-reflect-call.c
parentf20f261304993444741e0f0a14d3147e591bc660 (diff)
downloadgcc-f038dae646bac2b31be98ab592c0e5206d2d96f5.zip
gcc-f038dae646bac2b31be98ab592c0e5206d2d96f5.tar.gz
gcc-f038dae646bac2b31be98ab592c0e5206d2d96f5.tar.bz2
libgo: Update to October 24 version of master library.
From-SVN: r204466
Diffstat (limited to 'libgo/runtime/go-reflect-call.c')
-rw-r--r--libgo/runtime/go-reflect-call.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/libgo/runtime/go-reflect-call.c b/libgo/runtime/go-reflect-call.c
index 5cf3707..0fed68a 100644
--- a/libgo/runtime/go-reflect-call.c
+++ b/libgo/runtime/go-reflect-call.c
@@ -271,7 +271,21 @@ go_func_return_ffi (const struct __go_func_type *func)
types = (const struct __go_type_descriptor **) func->__out.__values;
if (count == 1)
- return go_type_to_ffi (types[0]);
+ {
+
+#if defined (__i386__) && !defined (__x86_64__)
+ /* FFI does not support complex types. On 32-bit x86, a
+ complex64 will be returned in %eax/%edx. We normally tell
+ FFI that a complex64 is a struct of two floats. On 32-bit
+ x86 a struct of two floats is returned via a hidden first
+ pointer parameter. Fortunately we can make everything work
+ by pretending that complex64 is int64. */
+ if ((types[0]->__code & GO_CODE_MASK) == GO_COMPLEX64)
+ return &ffi_type_sint64;
+#endif
+
+ return go_type_to_ffi (types[0]);
+ }
ret = (ffi_type *) __go_alloc (sizeof (ffi_type));
ret->type = FFI_TYPE_STRUCT;