1GCCGO(1) GNU GCCGO(1)
2
3
4
6 gccgo - A GCC-based compiler for the Go language
7
9 gccgo [-c|-S]
10 [-g] [-pg] [-Olevel]
11 [-Idir...] [-Ldir...]
12 [-o outfile] infile...
13
14 Only the most useful options are listed here; see below for the
15 remainder.
16
18 The gccgo command is a frontend to gcc and supports many of the same
19 options. This manual only documents the options specific to gccgo.
20
21 The gccgo command may be used to compile Go source code into an object
22 file, link a collection of object files together, or do both in
23 sequence.
24
25 Go source code is compiled as packages. A package consists of one or
26 more Go source files. All the files in a single package must be
27 compiled together, by passing all the files as arguments to gccgo. A
28 single invocation of gccgo may only compile a single package.
29
30 One Go package may "import" a different Go package. The imported
31 package must have already been compiled; gccgo will read the import
32 data directly from the compiled package. When this package is later
33 linked, the compiled form of the package must be included in the link
34 command.
35
37 -Idir
38 Specify a directory to use when searching for an import package at
39 compile time.
40
41 -Ldir
42 When linking, specify a library search directory, as with gcc.
43
44 -fgo-pkgpath=string
45 Set the package path to use. This sets the value returned by the
46 PkgPath method of reflect.Type objects. It is also used for the
47 names of globally visible symbols. The argument to this option
48 should normally be the string that will be used to import this
49 package after it has been installed; in other words, a pathname
50 within the directories specified by the -I option.
51
52 -fgo-prefix=string
53 An alternative to -fgo-pkgpath. The argument will be combined with
54 the package name from the source file to produce the package path.
55 If -fgo-pkgpath is used, -fgo-prefix will be ignored.
56
57 Go permits a single program to include more than one package with
58 the same name in the "package" clause in the source file, though
59 obviously the two packages must be imported using different
60 pathnames. In order for this to work with gccgo, either
61 -fgo-pkgpath or -fgo-prefix must be specified when compiling a
62 package.
63
64 Using either -fgo-pkgpath or -fgo-prefix disables the special
65 treatment of the "main" package and permits that package to be
66 imported like any other.
67
68 -fgo-relative-import-path=dir
69 A relative import is an import that starts with ./ or ../. If this
70 option is used, gccgo will use dir as a prefix for the relative
71 import when searching for it.
72
73 -frequire-return-statement
74 -fno-require-return-statement
75 By default gccgo will warn about functions which have one or more
76 return parameters but lack an explicit "return" statement. This
77 warning may be disabled using -fno-require-return-statement.
78
79 -fgo-check-divide-zero
80 Add explicit checks for division by zero. In Go a division (or
81 modulos) by zero causes a panic. On Unix systems this is detected
82 in the runtime by catching the "SIGFPE" signal. Some processors,
83 such as PowerPC, do not generate a SIGFPE on division by zero.
84 Some runtimes do not generate a signal that can be caught. On
85 those systems, this option may be used. Or the checks may be
86 removed via -fno-go-check-divide-zero. This option is currently on
87 by default, but in the future may be off by default on systems that
88 do not require it.
89
90 -fgo-check-divide-overflow
91 Add explicit checks for division overflow. For example, division
92 overflow occurs when computing "INT_MIN / -1". In Go this should
93 be wrapped, to produce "INT_MIN". Some processors, such as x86,
94 generate a trap on division overflow. On those systems, this
95 option may be used. Or the checks may be removed via
96 -fno-go-check-divide-overflow. This option is currently on by
97 default, but in the future may be off by default on systems that do
98 not require it.
99
101 gpl(7), gfdl(7), fsf-funding(7), gcc(1) and the Info entries for gccgo
102 and gcc.
103
105 Copyright (c) 2010-2013 Free Software Foundation, Inc.
106
107 Permission is granted to copy, distribute and/or modify this document
108 under the terms of the GNU Free Documentation License, Version 1.3 or
109 any later version published by the Free Software Foundation; with no
110 Invariant Sections, the Front-Cover Texts being (a) (see below), and
111 with the Back-Cover Texts being (b) (see below). A copy of the license
112 is included in the man page gfdl(7).
113
114 (a) The FSF's Front-Cover Text is:
115
116 A GNU Manual
117
118 (b) The FSF's Back-Cover Text is:
119
120 You have freedom to copy and modify this GNU Manual, like GNU
121 software. Copies published by the Free Software Foundation raise
122 funds for GNU development.
123
124
125
126gcc-4.8.5 2015-06-23 GCCGO(1)