gcc/libgo
Ian Lance Taylor abd471378c runtime: fix 32-bit malloc for pointers >= 0x80000000
The spans array is allocated in runtime_mallocinit.  On a
32-bit system the number of entries in the spans array is
MaxArena32 / PageSize, which (2U << 30) / (1 << 12) == (1 << 19).
So we are allocating an array that can hold 19 bits for an
index that can hold 20 bits.  According to the comment in the
function, this is intentional: we only allocate enough spans
(and bitmaps) for a 2G arena, because allocating more would
probably be wasteful.

But since the span index is simply the upper 20 bits of the
memory address, this scheme only works if memory addresses are
limited to the low 2G of memory.  That would be OK if we were
careful to enforce it, but we're not.  What we are careful to
enforce, in functions like runtime_MHeap_SysAlloc, is that we
always return addresses between the heap's arena_start and
arena_start + MaxArena32.

We generally get away with it because we start allocating just
after the program end, so we only run into trouble with
programs that allocate a lot of memory, enough to get past
address 0x80000000.

This changes the code that computes a span index to subtract
arena_start on 32-bit systems just as we currently do on
64-bit systems.

From-SVN: r206501
2014-01-09 23:16:56 +00:00
..
config libgo: Update libtool support for powerpc64le-linux-gnu. 2013-11-22 20:39:46 +00:00
go re PR go/59430 (os/user FAILs on Solaris) 2014-01-08 01:08:29 +00:00
runtime runtime: fix 32-bit malloc for pointers >= 0x80000000 2014-01-09 23:16:56 +00:00
testsuite gotest: Recognize PPC ELF v2 function pointers in text section. 2013-11-19 02:14:40 +00:00
LICENSE LICENSE: separate, change PATENTS text. 2010-12-06 22:27:47 +00:00
MERGE libgo: Update to current Go library. 2013-11-27 01:05:38 +00:00
Makefile.am re PR go/59430 (os/user FAILs on Solaris) 2014-01-08 01:08:29 +00:00
Makefile.in re PR go/59430 (os/user FAILs on Solaris) 2014-01-08 01:08:29 +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
config.h.in syscall: Only call varargs libc functions from C code. 2013-11-24 02:38:28 +00:00
configure go/build: Set GOARCH on arm64 systems. 2014-01-06 19:24:23 +00:00
configure.ac go/build: Set GOARCH on arm64 systems. 2014-01-06 19:24:23 +00:00
godeps.sh libgo: Generate dependencies automatically. 2011-12-03 00:16:12 +00:00
merge.sh libgo: Update to Go 1.1.1. 2013-07-16 06:54:42 +00:00
mksysinfo.sh mksysinfo, net: Always define F_DUPFD_CLOEXEC. 2013-11-11 21:21:50 +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.