gcc/libgo
Ian Lance Taylor cb054b6341 runtime: Use a struct, not void, for an empty struct for libffi.
A recent libffi upgrade caused the reflect test to fail on
386.  The problem case is a function that returns an empty
struct--a struct with no fields.  The libffi library does not
recognize the existence of empty structs, presumably since
they can't happen in C.  To work around this, the Go interface
to the libffi library changes an empty struct to void.  This
normally works fine, but with the new libffi upgrade it fails
for a function that returns an empty struct.  On 386 a
function that returns a struct is expected to pop the hidden
pointer when it returns.  So when we convert an empty struct
to void, libffi is calling a function that pops the hidden
pointer but does not expect that to happen.

In the older version of libffi, this didn't matter, because
the libffi code for 386 used a frame pointer, so the fact that
the stack pointer was wonky when the function returned was
ignored as the stack pointer was immediately replaced by the
saved frame pointer.  In the newer version of libffi, the 386
code is more efficient and does not use a frame pointer, and
therefore it matters whether libffi expects the function to
pop the hidden pointer or not.

This patch changes libgo to convert an empty to a struct with
a single field of type void.  This seems to be enough to get
the test cases working again.

Of course the real fix would be to change libffi to handle
empty types, but as libffi uses size == 0 as a marker for an
uninitialized type, that would be a non-trivial change.

From-SVN: r219701
2015-01-16 02:54:13 +00:00
..
config
go go/build: cgo works on linux/alpha. 2015-01-15 22:06:54 +00:00
runtime runtime: Use a struct, not void, for an empty struct for libffi. 2015-01-16 02:54:13 +00:00
testsuite libgo, compiler: Upgrade libgo to Go 1.4, except for runtime. 2015-01-15 00:27:56 +00:00
aclocal.m4
config.h.in libgo, compiler: Upgrade libgo to Go 1.4, except for runtime. 2015-01-15 00:27:56 +00:00
configure libgo: Bump version number in libgo configure script. 2015-01-15 00:52:38 +00:00
configure.ac libgo: Bump version number in libgo configure script. 2015-01-15 00:52:38 +00:00
godeps.sh
LICENSE
Makefile.am libgo, compiler: Upgrade libgo to Go 1.4, except for runtime. 2015-01-15 00:27:56 +00:00
Makefile.in libgo, compiler: Upgrade libgo to Go 1.4, except for runtime. 2015-01-15 00:27:56 +00:00
MERGE libgo, compiler: Upgrade libgo to Go 1.4, except for runtime. 2015-01-15 00:27:56 +00:00
merge.sh libgo, compiler: Upgrade libgo to Go 1.4, except for runtime. 2015-01-15 00:27:56 +00:00
mksysinfo.sh
mvifdiff.sh
PATENTS
README
README.gcc

See ../README.

This is the runtime support library for the Go programming language.
This library is intended for use with the Go frontend.

The library has only been tested on GNU/Linux using glibc.  It should
not be difficult to port to other operating systems.

The library has only been tested on x86/x86_64 systems.  It should not
be difficult to port to other architectures.

Directories:

go
  A copy of the Go library from http://golang.org/, with a few
  changes for gccgo.  Notably, the reflection interface is different.

runtime
  Runtime functions, written in C, which are called directly by the
  compiler or by the library.

syscalls
  System call support.

Contributing
============

To contribute patches to the files in this directory, please see
http://golang.org/doc/gccgo_contribute.html .

The master copy of these files is hosted at
http://code.google.com/p/gofrontend .  Changes to these files require
signing a Google contributor license agreement.  If you are the
copyright holder, you will need to agree to the individual contributor
license agreement at
http://code.google.com/legal/individual-cla-v1.0.html.  This agreement
can be completed online.

If your organization is the copyright holder, the organization will
need to agree to the corporate contributor license agreement at
http://code.google.com/legal/corporate-cla-v1.0.html.

If the copyright holder for your code has already completed the
agreement in connection with another Google open source project, it
does not need to be completed again.