The gccgo command is a frontend to gcc and supports many of the same options. See Option Summary. This manual only documents the options specific to gccgo.
The gccgo command may be used to compile Go source code into an object file, link a collection of object files together, or do both in sequence.
Go source code is compiled as packages. A package consists of one or more Go source files. All the files in a single package must be compiled together, by passing all the files as arguments to gccgo. A single invocation of gccgo may only compile a single package.
One Go package may import
a different Go package. The imported
package must have already been compiled; gccgo will read
the import data directly from the compiled package. When this package
is later linked, the compiled form of the package must be included in
the link command.
Go programs must generally be compiled with debugging information, and -g1 is the default as described below. Stripping a Go program will generally cause it to misbehave or fail.
-I
dir-L
dir-fgo-pkgpath=
string-fgo-prefix=
stringGo permits a single program to include more than one package with the
same name in the package
clause in the source file, though
obviously the two packages must be imported using different pathnames.
In order for this to work with gccgo, either
-fgo-pkgpath or -fgo-prefix must be specified when
compiling a package.
Using either -fgo-pkgpath or -fgo-prefix disables
the special treatment of the main
package and permits that
package to be imported like any other.
-fgo-relative-import-path=
dir-frequire-return-statement
-fno-require-return-statement
return
statement.
This warning may be disabled using
-fno-require-return-statement.
-fgo-check-divide-zero
SIGFPE
signal. Some processors,
such as PowerPC, do not generate a SIGFPE on division by zero. Some
runtimes do not generate a signal that can be caught. On those
systems, this option may be used. Or the checks may be removed via
-fno-go-check-divide-zero. This option is currently on by
default, but in the future may be off by default on systems that do
not require it.
-fgo-check-divide-overflow
INT_MIN / -1
. In Go this should
be wrapped, to produce INT_MIN
. Some processors, such as x86,
generate a trap on division overflow. On those systems, this option
may be used. Or the checks may be removed via
-fno-go-check-divide-overflow. This option is currently on
by default, but in the future may be off by default on systems that do
not require it.
-g
runtime.Callers
, will not operate correctly.