This libgo patch tweaks the libffi interface to treat direct-iface 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. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Bootstrapped and ran some Go tests on sparc-sun-solaris2.11 and powerpc64-linux-gnu. Committed to mainline.
Ian
Index: gcc/go/gofrontend/MERGE =================================================================== --- gcc/go/gofrontend/MERGE (revision 275813) +++ gcc/go/gofrontend/MERGE (working copy) @@ -1,4 +1,4 @@ -7aabaf8623cf88e2378057476a034093abbe5aab +09ca3c1ea8a52b5d3d6c4331c59d44e0b6bfab57 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. Index: libgo/go/runtime/ffi.go =================================================================== --- libgo/go/runtime/ffi.go (revision 275698) +++ libgo/go/runtime/ffi.go (working copy) @@ -224,6 +224,9 @@ func structToFFI(typ *structtype) *__ffi 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_t 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++ {