1
0
mirror of https://github.com/golang/go synced 2024-10-01 05:28:33 -06:00
The Go programming language
Go to file
Russ Cox 25f6b02ab0 cmd/cc, runtime: convert C compilers to use Go calling convention
To date, the C compilers and Go compilers differed only in how
values were returned from functions. This made it difficult to call
Go from C or C from Go if return values were involved. It also made
assembly called from Go and assembly called from C different.

This CL changes the C compiler to use the Go conventions, passing
results on the stack, after the arguments.
[Exception: this does not apply to C ... functions, because you can't
know where on the stack the arguments end.]

By doing this, the CL makes it possible to rewrite C functions into Go
one at a time, without worrying about which languages call that
function or which languages it calls.

This CL also updates all the assembly files in package runtime to use
the new conventions. Argument references of the form 40(SP) have
been rewritten to the form name+10(FP) instead, and there are now
Go func prototypes for every assembly function called from C or Go.
This means that 'go vet runtime' checks effectively every assembly
function, and go vet's output was used to automate the bulk of the
conversion.

Some functions, like seek and nsec on Plan 9, needed to be rewritten.

Many assembly routines called from C were reading arguments
incorrectly, using MOVL instead of MOVQ or vice versa, especially on
the less used systems like openbsd.
These were found by go vet and have been corrected too.
If we're lucky, this may reduce flakiness on those systems.

Tested on:
        darwin/386
        darwin/amd64
        linux/arm
        linux/386
        linux/amd64
If this breaks another system, the bug is almost certainly in the
sys_$GOOS_$GOARCH.s file, since the rest of the CL is tested
by the combination of the above systems.

LGTM=dvyukov, iant
R=golang-codereviews, 0intro, dave, alex.brainman, dvyukov, iant
CC=golang-codereviews, josharian, r
https://golang.org/cl/135830043
2014-08-27 11:32:17 -04:00
api unicode: strconv: regexp: Upgrade to Unicode 7.0.0. 2014-08-18 20:26:10 +02:00
doc doc/cmd.html: close a tag. 2014-08-26 05:26:48 -07:00
include liblink, cmd/dist, cmd/5l: introduce %^ and move C_* constants. 2014-08-06 00:31:22 -04:00
lib codereview: do not hit upload_complete on first patch 2014-08-06 16:12:24 -04:00
misc misc/nacl: fix build 2014-08-22 18:36:01 +10:00
src cmd/cc, runtime: convert C compilers to use Go calling convention 2014-08-27 11:32:17 -04:00
test cmd/gc, runtime: treat slices and strings like pointers in garbage collection 2014-08-25 14:38:19 -04:00
.hgignore lib9: enable on Plan 9 2014-02-13 20:06:41 +01:00
.hgtags tag go1.3.1 2014-08-13 14:54:54 +10:00
AUTHORS A+C: Joe Shaw (individual CLA) 2014-08-26 14:24:04 -07:00
CONTRIBUTORS CONTRIBUTORS: add Rick Hudson (Google CLA) 2014-08-27 11:10:01 -04:00
favicon.ico godoc: update favicon 2012-10-11 17:02:36 +11:00
LICENSE doc: update licensing text one more time 2012-03-27 15:09:13 +11:00
PATENTS
README README: Fix installation instructions 2013-11-20 13:47:37 -08:00
robots.txt godoc: serve robots.txt raw 2011-02-19 05:46:20 +11:00

This is the source code repository for the Go programming language.  

For documentation about how to install and use Go,
visit http://golang.org/ or load doc/install-source.html
in your web browser.

After installing Go, you can view a nicely formatted
doc/install-source.html by running godoc --http=:6060
and then visiting http://localhost:6060/doc/install/source.

Unless otherwise noted, the Go source files are distributed
under the BSD-style license found in the LICENSE file.

--

Binary Distribution Notes

If you have just untarred a binary Go distribution, you need to set
the environment variable $GOROOT to the full path of the go
directory (the one containing this README).  You can omit the
variable if you unpack it into /usr/local/go, or if you rebuild
from sources by running all.bash (see doc/install.html).
You should also add the Go binary directory $GOROOT/bin
to your shell's path.

For example, if you extracted the tar file into $HOME/go, you might
put the following in your .profile:

    export GOROOT=$HOME/go
    export PATH=$PATH:$GOROOT/bin

See doc/install.html for more details.