mirror of
https://github.com/golang/go.git
synced 2025-05-05 15:43:04 +00:00
Fix several out of date references to 4g/5g/6g/8g/9g.
Change-Id: Ifb8e4e13c7778a7c0113190051415e096f5db94f Reviewed-on: https://go-review.googlesource.com/11390 Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Andrew Gerrand <adg@golang.org>
This commit is contained in:
parent
a4ec50bd0b
commit
8628688304
@ -7,7 +7,7 @@
|
||||
|
||||
<p>
|
||||
This document is a quick outline of the unusual form of assembly language used by the <code>gc</code>
|
||||
suite of Go compilers (<code>6g</code>, <code>8g</code>, etc.).
|
||||
Go compiler.
|
||||
The document is not comprehensive.
|
||||
</p>
|
||||
|
||||
@ -52,7 +52,7 @@ package main
|
||||
func main() {
|
||||
println(3)
|
||||
}
|
||||
$ go tool 6g -S x.go # or: go build -gcflags -S x.go
|
||||
$ go tool compile -S x.go # or: go build -gcflags -S x.go
|
||||
|
||||
--- prog list "main" ---
|
||||
0000 (x.go:3) TEXT main+0(SB),$8-0
|
||||
|
@ -239,7 +239,7 @@ Do Go programs link with C/C++ programs?</h3>
|
||||
|
||||
<p>
|
||||
There are two Go compiler implementations, <code>gc</code>
|
||||
(the <code>6g</code> program and friends) and <code>gccgo</code>.
|
||||
and <code>gccgo</code>.
|
||||
<code>Gc</code> uses a different calling convention and linker and can
|
||||
therefore only be linked with C programs using the same convention.
|
||||
There is such a C compiler but no C++ compiler.
|
||||
|
@ -26,7 +26,7 @@ packages, though, read on.
|
||||
<p>
|
||||
There are two official Go compiler tool chains.
|
||||
This document focuses on the <code>gc</code> Go
|
||||
compiler and tools (<code>6g</code>, <code>8g</code> etc.).
|
||||
compiler and tools.
|
||||
For information on how to work on <code>gccgo</code>, a more traditional
|
||||
compiler using the GCC back end, see
|
||||
<a href="/doc/install/gccgo">Setting up and using gccgo</a>.
|
||||
@ -516,7 +516,7 @@ installs all commands there.
|
||||
<li><code>$GO386</code> (for <code>386</code> only, default is auto-detected
|
||||
if built on either <code>386</code> or <code>amd64</code>, <code>387</code> otherwise)
|
||||
<p>
|
||||
This controls the code generated by 8g to use either the 387 floating-point unit
|
||||
This controls the code generated by gc to use either the 387 floating-point unit
|
||||
(set to <code>387</code>) or SSE2 instructions (set to <code>sse2</code>) for
|
||||
floating point computations.
|
||||
</p>
|
||||
|
@ -8,7 +8,7 @@ multiprecision library gmp's integer type mpz_t wrapped to look like
|
||||
the Go package big's integer type Int.
|
||||
|
||||
This is a syntactically valid Go program—it can be parsed with the Go
|
||||
parser and processed by godoc—but it is not compiled directly by 6g.
|
||||
parser and processed by godoc—but it is not compiled directly by gc.
|
||||
Instead, a separate tool, cgo, processes it to produce three output
|
||||
files. The first two, 6g.go and 6c.c, are a Go source file for 6g and
|
||||
a C source file for 6c; both compile as part of the named package
|
||||
|
@ -530,7 +530,7 @@ func TestTwoGopathShlibsGccgo(t *testing.T) {
|
||||
|
||||
// Testing rebuilding of shared libraries when they are stale is a bit more
|
||||
// complicated that it seems like it should be. First, we make everything "old": but
|
||||
// only a few seconds old, or it might be older than 6g (or the runtime source) and
|
||||
// only a few seconds old, or it might be older than gc (or the runtime source) and
|
||||
// everything will get rebuilt. Then define a timestamp slightly newer than this
|
||||
// time, which is what we set the mtime to of a file to cause it to be seen as new,
|
||||
// and finally another slightly even newer one that we can compare files against to
|
||||
|
@ -1551,7 +1551,7 @@ func (c *typeConv) pad(fld []*ast.Field, size int64) []*ast.Field {
|
||||
return fld
|
||||
}
|
||||
|
||||
// Struct conversion: return Go and (6g) C syntax for type.
|
||||
// Struct conversion: return Go and (gc) C syntax for type.
|
||||
func (c *typeConv) Struct(dt *dwarf.StructType, pos token.Pos) (expr *ast.StructType, csyntax string, align int64) {
|
||||
// Minimum alignment for a struct is 1 byte.
|
||||
align = 1
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
// TODO(rsc):
|
||||
// Emit correct line number annotations.
|
||||
// Make 6g understand the annotations.
|
||||
// Make gc understand the annotations.
|
||||
|
||||
package main
|
||||
|
||||
|
@ -21,8 +21,7 @@ import (
|
||||
|
||||
var conf = printer.Config{Mode: printer.SourcePos, Tabwidth: 8}
|
||||
|
||||
// writeDefs creates output files to be compiled by 6g and gcc.
|
||||
// (The comments here say 6g but the code applies to the 8 and 5 tools too.)
|
||||
// writeDefs creates output files to be compiled by gc and gcc.
|
||||
func (p *Package) writeDefs() {
|
||||
var fgo2, fc io.Writer
|
||||
f := creat(*objDir + "_cgo_gotypes.go")
|
||||
@ -291,10 +290,10 @@ func dynimport(obj string) {
|
||||
fatalf("cannot parse %s as ELF, Mach-O or PE", obj)
|
||||
}
|
||||
|
||||
// Construct a gcc struct matching the 6g argument frame.
|
||||
// Construct a gcc struct matching the gc argument frame.
|
||||
// Assumes that in gcc, char is 1 byte, short 2 bytes, int 4 bytes, long long 8 bytes.
|
||||
// These assumptions are checked by the gccProlog.
|
||||
// Also assumes that 6g convention is to word-align the
|
||||
// Also assumes that gc convention is to word-align the
|
||||
// input and output parameters.
|
||||
func (p *Package) structType(n *Name) (string, int64) {
|
||||
var buf bytes.Buffer
|
||||
@ -479,8 +478,7 @@ func (p *Package) writeDefsFunc(fgo2 io.Writer, n *Name) {
|
||||
fmt.Fprintf(fgo2, "}\n")
|
||||
}
|
||||
|
||||
// writeOutput creates stubs for a specific source file to be compiled by 6g
|
||||
// (The comments here say 6g but the code applies to the 8 and 5 tools too.)
|
||||
// writeOutput creates stubs for a specific source file to be compiled by gc
|
||||
func (p *Package) writeOutput(f *File, srcfile string) {
|
||||
base := srcfile
|
||||
if strings.HasSuffix(base, ".go") {
|
||||
@ -559,7 +557,7 @@ func (p *Package) writeOutputFunc(fgcc *os.File, n *Name) {
|
||||
if n.AddError {
|
||||
fmt.Fprintf(fgcc, "\terrno = 0;\n")
|
||||
}
|
||||
// We're trying to write a gcc struct that matches 6g's layout.
|
||||
// We're trying to write a gcc struct that matches gc's layout.
|
||||
// Use packed attribute to force no padding in this struct in case
|
||||
// gcc has different packing requirements.
|
||||
fmt.Fprintf(fgcc, "\t%s %v *a = v;\n", ctype, p.packedAttribute())
|
||||
@ -655,8 +653,8 @@ func (p *Package) writeGccgoOutputFunc(fgcc *os.File, n *Name) {
|
||||
}
|
||||
|
||||
// packedAttribute returns host compiler struct attribute that will be
|
||||
// used to match 6g's struct layout. For example, on 386 Windows,
|
||||
// gcc wants to 8-align int64s, but 8g does not.
|
||||
// used to match gc's struct layout. For example, on 386 Windows,
|
||||
// gcc wants to 8-align int64s, but gc does not.
|
||||
// Use __gcc_struct__ to work around http://gcc.gnu.org/PR52991 on x86,
|
||||
// and http://golang.org/issue/5603.
|
||||
func (p *Package) packedAttribute() string {
|
||||
@ -681,7 +679,7 @@ func (p *Package) writeExports(fgo2, fm, fgcc, fgcch io.Writer) {
|
||||
for _, exp := range p.ExpFunc {
|
||||
fn := exp.Func
|
||||
|
||||
// Construct a gcc struct matching the 6g argument and
|
||||
// Construct a gcc struct matching the gc argument and
|
||||
// result frame. The gcc struct will be compiled with
|
||||
// __attribute__((packed)) so all padding must be accounted
|
||||
// for explicitly.
|
||||
@ -802,7 +800,7 @@ func (p *Package) writeExports(fgo2, fm, fgcc, fgcch io.Writer) {
|
||||
}
|
||||
fmt.Fprintf(fgcc, "}\n")
|
||||
|
||||
// Build the wrapper function compiled by 6g.
|
||||
// Build the wrapper function compiled by gc.
|
||||
goname := exp.Func.Name.Name
|
||||
if fn.Recv != nil {
|
||||
goname = "_cgoexpwrap" + cPrefix + "_" + fn.Recv.List[0].Names[0].Name + "_" + goname
|
||||
|
2
src/cmd/dist/buildruntime.go
vendored
2
src/cmd/dist/buildruntime.go
vendored
@ -56,7 +56,7 @@ func mkzversion(dir, file string) {
|
||||
// a cross-compiled compiler expects to compile for its own target
|
||||
// system. That is, if on a Mac you do:
|
||||
//
|
||||
// GOOS=linux GOARCH=ppc64 go build cmd/9g
|
||||
// GOOS=linux GOARCH=ppc64 go build cmd/compile
|
||||
//
|
||||
// the resulting compiler will default to generating linux/ppc64 object files.
|
||||
// This is more useful than having it default to generating objects for the
|
||||
|
@ -2110,7 +2110,7 @@ func (gcToolchain) gc(b *builder, p *Package, archive, obj string, asmhdr bool,
|
||||
gcargs[1] = "main"
|
||||
}
|
||||
if p.Standard && p.ImportPath == "runtime" {
|
||||
// runtime compiles with a special 6g flag to emit
|
||||
// runtime compiles with a special gc flag to emit
|
||||
// additional reflect type data.
|
||||
gcargs = append(gcargs, "-+")
|
||||
}
|
||||
|
@ -223,7 +223,7 @@ func Getgoarm() string {
|
||||
}
|
||||
|
||||
func Getgo386() string {
|
||||
// Validated by cmd/8g.
|
||||
// Validated by cmd/compile.
|
||||
return envOr("GO386", defaultGO386)
|
||||
}
|
||||
|
||||
|
@ -527,7 +527,7 @@ func (t *uncommonType) MethodByName(name string) (m Method, ok bool) {
|
||||
return
|
||||
}
|
||||
|
||||
// TODO(rsc): 6g supplies these, but they are not
|
||||
// TODO(rsc): gc supplies these, but they are not
|
||||
// as efficient as they could be: they have commonType
|
||||
// as the receiver instead of *rtype.
|
||||
func (t *rtype) NumMethod() int {
|
||||
|
@ -12,7 +12,7 @@ TEXT crosscall2(SB),NOSPLIT,$-4
|
||||
/*
|
||||
* We still need to save all callee save register as before, and then
|
||||
* push 2 args for fn (R1 and R2).
|
||||
* Also note that at procedure entry in 5c/5g world, 4(R13) will be the
|
||||
* Also note that at procedure entry in gc world, 4(R13) will be the
|
||||
* first arg, so we must push another dummy reg (R0) for 0(R13).
|
||||
* Additionally, runtime·load_g will clobber R0, so we need to save R0
|
||||
* nevertheless.
|
||||
|
@ -12,7 +12,7 @@ TEXT crosscall2(SB),NOSPLIT,$-8
|
||||
/*
|
||||
* We still need to save all callee save register as before, and then
|
||||
* push 2 args for fn (R1 and R2).
|
||||
* Also note that at procedure entry in 7g world, 8(RSP) will be the
|
||||
* Also note that at procedure entry in gc world, 8(RSP) will be the
|
||||
* first arg.
|
||||
* TODO(minux): use LDP/STP here if it matters.
|
||||
*/
|
||||
|
@ -18,7 +18,7 @@
|
||||
/*
|
||||
* void crosscall1(void (*fn)(void), void (*setg_gcc)(void *g), void *g)
|
||||
*
|
||||
* Calling into the 7g tool chain, where all registers are caller save.
|
||||
* Calling into the gc tool chain, where all registers are caller save.
|
||||
* Called from standard ARM EABI, where x19-x29 are callee-save, so they
|
||||
* must be saved explicitly, along with x30 (LR).
|
||||
*/
|
||||
|
@ -16,7 +16,7 @@
|
||||
/*
|
||||
* void crosscall_ppc64(void (*fn)(void), void *g)
|
||||
*
|
||||
* Calling into the 9g tool chain, where all registers are caller save.
|
||||
* Calling into the gc tool chain, where all registers are caller save.
|
||||
* Called from standard ppc64 C ABI, where r2, r14-r31, f14-f31 are
|
||||
* callee-save, so they must be saved explicitly.
|
||||
*/
|
||||
|
@ -7,7 +7,7 @@ package runtime
|
||||
// Compiler is the name of the compiler toolchain that built the
|
||||
// running binary. Known toolchains are:
|
||||
//
|
||||
// gc The 5g/6g/8g compiler suite at go.googlesource.com/go.
|
||||
// gc Also known as cmd/compile.
|
||||
// gccgo The gccgo front end, part of the GCC compiler suite.
|
||||
//
|
||||
const Compiler = "gc"
|
||||
|
@ -28,7 +28,7 @@ func main() {
|
||||
a := new(arg)
|
||||
|
||||
// Generate each test as a separate function to avoid
|
||||
// hitting the 6g optimizer with one enormous function.
|
||||
// hitting the gc optimizer with one enormous function.
|
||||
// If we name all the functions init we don't have to
|
||||
// maintain a list of which ones to run.
|
||||
do := func(t *template.Template) {
|
||||
|
@ -115,7 +115,7 @@ func main() {
|
||||
isfalse(ic != d)
|
||||
isfalse(ie != e)
|
||||
|
||||
// 6g used to let this go through as true.
|
||||
// gc used to let this go through as true.
|
||||
var g uint64 = 123
|
||||
var h int64 = 123
|
||||
var ig interface{} = g
|
||||
|
@ -47,7 +47,7 @@ foreach $file (@file) {
|
||||
$cmd = join(' ', @ARGV);
|
||||
open(CMD, "exec $cmd </dev/null 2>&1 |") || die "BUG: errchk: run $cmd: $!";
|
||||
|
||||
# 6g error messages continue onto additional lines with leading tabs.
|
||||
# gc error messages continue onto additional lines with leading tabs.
|
||||
# Split the output at the beginning of each line that doesn't begin with a tab.
|
||||
$out = join('', <CMD>);
|
||||
@out = split(/^(?!\t)/m, $out);
|
||||
|
@ -9,7 +9,7 @@
|
||||
package main
|
||||
|
||||
func main() {
|
||||
if func() bool { return true }() {} // 6g used to say this was a syntax error
|
||||
if func() bool { return true }() {} // gc used to say this was a syntax error
|
||||
if (func() bool { return true })() {}
|
||||
if (func() bool { return true }()) {}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ func g() int {
|
||||
}
|
||||
|
||||
func main() {
|
||||
// 6g, 8g, 5g all used to evaluate g() before f().
|
||||
// gc used to evaluate g() before f().
|
||||
if f() < g() {
|
||||
panic("wrong answer")
|
||||
}
|
||||
|
@ -216,7 +216,7 @@ func main() {
|
||||
thisPass := 0
|
||||
if c == "c" && (a == "a" || a == "pa" || n == "n" || i == "i64big" || i == "i64bigger" || i == "huge" || i == "fbad") {
|
||||
if i == "huge" {
|
||||
// Due to a detail of 6g's internals,
|
||||
// Due to a detail of gc's internals,
|
||||
// the huge constant errors happen in an
|
||||
// earlier pass than the others and inhibits
|
||||
// the next pass from running.
|
||||
|
@ -727,7 +727,7 @@ func (t *test) expectedOutput() string {
|
||||
}
|
||||
|
||||
func splitOutput(out string) []string {
|
||||
// 6g error messages continue onto additional lines with leading tabs.
|
||||
// gc error messages continue onto additional lines with leading tabs.
|
||||
// Split the output at the beginning of each line that doesn't begin with a tab.
|
||||
// <autogenerated> lines are impossible to match so those are filtered out.
|
||||
var res []string
|
||||
|
Loading…
x
Reference in New Issue
Block a user