diff options
author | Ian Lance Taylor <iant@golang.org> | 2019-09-17 20:26:21 +0000 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2019-09-17 20:26:21 +0000 |
commit | 70cc7c9562db17cbfc371eb7412ea903b581c976 (patch) | |
tree | a3536079b339f8dd68bb024a5a888f82bee3b328 /libgo | |
parent | a0f856562dcac0020d7e28d02c53502d2c0f67c2 (diff) |
runtime: for FFI, treat directIface types as pointers
This only matters on systems that pass a struct with a single pointer
field differently than passing a single pointer. I noticed it on
32-bit PPC, where the reflect package TestDirectIfaceMethod failed.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/195878
git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@275814 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo')
-rw-r--r-- | libgo/go/runtime/ffi.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libgo/go/runtime/ffi.go b/libgo/go/runtime/ffi.go index be79224a4fb..cd8479ef551 100644 --- a/libgo/go/runtime/ffi.go +++ b/libgo/go/runtime/ffi.go @@ -224,6 +224,9 @@ func structToFFI(typ *structtype) *__ffi_type { if c == 0 { return emptyStructToFFI() } + if typ.typ.kind&kindDirectIface != 0 { + return ffi_type_pointer() + } fields := make([]*__ffi_type, 0, c+1) checkPad := false @@ -307,6 +310,9 @@ func arrayToFFI(typ *arraytype) *__ffi_type { if typ.len == 0 { return emptyStructToFFI() } + if typ.typ.kind&kindDirectIface != 0 { + return ffi_type_pointer() + } elements := make([]*__ffi_type, typ.len+1) et := typeToFFI(typ.elem) for i := uintptr(0); i < typ.len; i++ { |