mirror of
https://github.com/golang/go.git
synced 2025-05-19 06:14:40 +00:00
document the gc go compilers.
fix the usage message. R=rsc CC=go-dev http://go/go-review/1016033
This commit is contained in:
parent
b9ec2adfc7
commit
3fa379e797
15
src/cmd/5g/doc.go
Normal file
15
src/cmd/5g/doc.go
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
// Copyright 2009 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
5g is the version of the gc compiler for the ARM,
|
||||||
|
referred to by these tools as arm.
|
||||||
|
|
||||||
|
It reads .go files and outputs .5 files. The flags are documented in ../gc/doc.go.
|
||||||
|
|
||||||
|
There is no instruction optimizer, so the -N flag is a no-op.
|
||||||
|
|
||||||
|
*/
|
||||||
|
package documentation
|
@ -9,6 +9,8 @@
|
|||||||
http://plan9.bell-labs.com/magic/man2html/1/2l
|
http://plan9.bell-labs.com/magic/man2html/1/2l
|
||||||
|
|
||||||
Its target architecture is the ARM, referred to by these tools as arm.
|
Its target architecture is the ARM, referred to by these tools as arm.
|
||||||
|
It reads files in .5 format generated by 5g, 5c, and 5a and emits
|
||||||
|
a binary called 5.out by default.
|
||||||
|
|
||||||
Major changes include:
|
Major changes include:
|
||||||
- support for segmented stacks (this feature is implemented here, not in the compilers).
|
- support for segmented stacks (this feature is implemented here, not in the compilers).
|
||||||
|
13
src/cmd/6g/doc.go
Normal file
13
src/cmd/6g/doc.go
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
// Copyright 2009 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
6g is the version of the gc compiler for the x86-64,
|
||||||
|
referred to by these tools as amd64.
|
||||||
|
|
||||||
|
It reads .go files and outputs .6 files. The flags are documented in ../gc/doc.go.
|
||||||
|
|
||||||
|
*/
|
||||||
|
package documentation
|
@ -9,6 +9,8 @@
|
|||||||
http://plan9.bell-labs.com/magic/man2html/1/2l
|
http://plan9.bell-labs.com/magic/man2html/1/2l
|
||||||
|
|
||||||
Its target architecture is the x86-64, referred to by these tools as amd64.
|
Its target architecture is the x86-64, referred to by these tools as amd64.
|
||||||
|
It reads files in .6 format generated by 6g, 6c, and 6a and emits
|
||||||
|
a binary called 6.out by default.
|
||||||
|
|
||||||
Major changes include:
|
Major changes include:
|
||||||
- support for ELF and Mach-O binary files
|
- support for ELF and Mach-O binary files
|
||||||
|
15
src/cmd/8g/doc.go
Normal file
15
src/cmd/8g/doc.go
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
// Copyright 2009 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
8g is the version of the gc compiler for the x86,
|
||||||
|
referred to by these tools for historical reasons as 386.
|
||||||
|
|
||||||
|
It reads .go files and outputs .8 files. The flags are documented in ../gc/doc.go.
|
||||||
|
|
||||||
|
There is no instruction optimizer, so the -N flag is a no-op.
|
||||||
|
|
||||||
|
*/
|
||||||
|
package documentation
|
@ -9,6 +9,8 @@
|
|||||||
http://plan9.bell-labs.com/magic/man2html/1/2l
|
http://plan9.bell-labs.com/magic/man2html/1/2l
|
||||||
|
|
||||||
Its target architecture is the x86, referred to by these tools for historical reasons as 386.
|
Its target architecture is the x86, referred to by these tools for historical reasons as 386.
|
||||||
|
It reads files in .8 format generated by 8g, 8c, and 8a and emits
|
||||||
|
a binary called 8.out by default.
|
||||||
|
|
||||||
Major changes include:
|
Major changes include:
|
||||||
- support for ELF and Mach-O binary files
|
- support for ELF and Mach-O binary files
|
||||||
|
46
src/cmd/gc/doc.go
Normal file
46
src/cmd/gc/doc.go
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
// Copyright 2009 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
The name gc is the generic label given to the family of Go compilers
|
||||||
|
that function as part of the (modified) Plan 9 tool chain. The C compiler
|
||||||
|
documentation at
|
||||||
|
|
||||||
|
http://plan9.bell-labs.com/sys/doc/comp.pdf (Tools overview)
|
||||||
|
http://plan9.bell-labs.com/sys/doc/compiler.pdf (C compiler architecture)
|
||||||
|
|
||||||
|
gives the overall design of the tool chain. Aside from a few adapted pieces,
|
||||||
|
such as the optimizer, the Go compilers are wholly new programs.
|
||||||
|
|
||||||
|
The compiler reads in a set of Go files, typically suffixed ".go". They
|
||||||
|
must all be part of one package. The output is a single intermediate file
|
||||||
|
representing the "binary assembly" of the compiled package, ready as input
|
||||||
|
for the linker (6l, etc.).
|
||||||
|
|
||||||
|
The generated files contain type information about the symbols exported by
|
||||||
|
the package and about types used by symbols imported by the package from
|
||||||
|
other packages. It is therefore not necessary when compiling client C of
|
||||||
|
package P to read the files of P's dependencies, only the compiled output
|
||||||
|
of P.
|
||||||
|
|
||||||
|
Usage: 6g [flags] *.go (or 8g or 5g)
|
||||||
|
|
||||||
|
Flags:
|
||||||
|
-o file
|
||||||
|
output file, default 6.out for 6g, etc.
|
||||||
|
-e
|
||||||
|
normally the compiler quits after 10 errors; -e prints all errors
|
||||||
|
-I dir1 -I dir2
|
||||||
|
add dir1 and dir2 to the list of paths to check for imported packages
|
||||||
|
-N
|
||||||
|
disable optimization
|
||||||
|
-S
|
||||||
|
write assembly language text to standard output
|
||||||
|
|
||||||
|
There are also a number of debugging flags; run the command with no arguments
|
||||||
|
to get a usage message.
|
||||||
|
|
||||||
|
*/
|
||||||
|
package documentation
|
@ -141,7 +141,7 @@ usage:
|
|||||||
print(" -h panic on an error\n");
|
print(" -h panic on an error\n");
|
||||||
print(" -k name specify package name\n");
|
print(" -k name specify package name\n");
|
||||||
print(" -o file specify output file\n");
|
print(" -o file specify output file\n");
|
||||||
print(" -p print the assembly language\n");
|
print(" -S print the assembly language\n");
|
||||||
print(" -w print the parse tree after typing\n");
|
print(" -w print the parse tree after typing\n");
|
||||||
print(" -x print lex tokens\n");
|
print(" -x print lex tokens\n");
|
||||||
exit(0);
|
exit(0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user