This is a creation in Article, where the information may have evolved or changed.
English Original: http://blog.golang.org/2012/07/gccgo-in-gcc-471.html
The go language is initially defined by a language specification and is not dependent on a specific implementation. The Go development team implemented two different versions of compilers for the language specification: GC and GCCGO. There are two different implementations that help maintain the integrity and integrity of the language specification: When two implementations collide, we modify the language specification, or modify the implementation to maintain and conform to the specification. The GC is the default compiler, written specifically for go. Gccgo is another different implementation (with different focus targets), which we'll cover in detail below.
Gccgo is released as a part of GCC, which belongs to the GCC compiler collection. The GCC front-end can support many different programming languages: GCCGO is a front-end implementation for the go language. While the go front side remains relatively independent of GCC, one of its design goals is to connect to a different compiler backend, which of course currently supports only GCC.
The GCCGO is slower to compile than the GC, but it can generate better code, so the program executes more quickly. GCC's optimization technology has been perfected for many years, covering all aspects of cycle optimization and instruction. Although GCCGO does not always produce the best code, in some cases it compiles programs that can be run more efficiently up to 30%.
The GC compiler only supports mainstream processors: X86 (32/64-bit) and arm. The GCCGO can support most types of processors supported by GCC. The types of processors currently tested by GCCGO include: X86 (32/64), SPARC, MIPS, PowerPC, and Alpha. GCCGO also tested operating systems not supported by the GC compiler, especially the Solaris system.
GCCGO also offers a standard and complete standard library of Go languages. The GCCGO and GC features of the Go runtime are also as consistent as possible: Goroutine scheduling, channels, memory allocation, and garbage collection. Gccgo X86 already supports the Goroutine dynamic stack and requires the use of a gold connector (in other processors, each goroutine will also allocate a large stack, and if a function nested call with depth will cause a stack overflow).
The GCCGO currently released does not include the GO command. However, the Go command, which is installed through the go version, can already support GCCGO and needs to use the-compiler option: go build -compiler gccgo myprog
. The CGO and Swig tools used to connect go and C + + also support GCCGO.
We've released the Go front end for GCC with the same BSD license as go. You can download the code from Gofrontend Google code project. It is important to note that when the go front end and the GCC backend connection, the GPL license is used (the reason why BSD is infected by the GPL).
The newest GCC 4.7.1, including the gccgo perfectly supports GO1. For users, Gccgo may be a better choice if you need better compilation optimizations, or if you are using a processor or operating system that is not supported by GC.
by Ian Lance Taylor