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 libgo: Update libtool support to files in current GCC trunk. 2014-11-12 03:51:36 +00:00
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
LICENSE LICENSE: separate, change PATENTS text. 2010-12-06 22:27:47 +00:00
MERGE libgo, compiler: Upgrade libgo to Go 1.4, except for runtime. 2015-01-15 00:27:56 +00:00
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
PATENTS LICENSE: separate, change PATENTS text. 2010-12-06 22:27:47 +00:00
README It's a contributor license agreement, not a copyright LA. 2010-12-03 20:41:15 +00:00
README.gcc libgo/README.gcc: Mention GCCGO_RUN_ALL_TESTS. 2011-03-09 19:17:56 +00:00
aclocal.m4 Add Go frontend, libgo library, and Go testsuite. 2010-12-03 04:34:57 +00:00
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 libgo: Generate dependencies automatically. 2011-12-03 00:16:12 +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 mksysinfo: Tolerate missing structures in upcase_fields. 2014-11-06 16:44:32 +00:00
mvifdiff.sh runtime: introduce mvifdiff.sh script to replace GCC's move-if-change 2014-12-01 01:06:29 +00:00

README

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.