Andrew Gerrand | 7cb21a7 | 2012-01-19 11:24:54 +1100 | [diff] [blame] | 1 | <!--{ |
Andrew Gerrand | e07f089 | 2012-02-14 17:02:28 +1100 | [diff] [blame] | 2 | "Title": "Setting up and using gccgo", |
Andrew Gerrand | f78d50c | 2012-03-05 14:31:27 +1100 | [diff] [blame] | 3 | "Path": "/doc/install/gccgo" |
Andrew Gerrand | 7cb21a7 | 2012-01-19 11:24:54 +1100 | [diff] [blame] | 4 | }--> |
Ian Lance Taylor | 4262ff0 | 2009-10-14 15:49:20 -0700 | [diff] [blame] | 5 | |
| 6 | <p> |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 7 | This document explains how to use gccgo, a compiler for |
Alberto Donizetti | 77aea69 | 2019-09-07 16:31:36 +0200 | [diff] [blame] | 8 | the Go language. The gccgo compiler is a new frontend |
| 9 | for GCC, the widely used GNU compiler. Although the |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 10 | frontend itself is under a BSD-style license, gccgo is |
| 11 | normally used as part of GCC and is then covered by |
Suriyaa Sundararuban | 1041ac8 | 2018-06-13 07:06:04 +0000 | [diff] [blame] | 12 | the <a href="https://www.gnu.org/licenses/gpl.html">GNU General Public |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 13 | License</a> (the license covers gccgo itself as part of GCC; it |
| 14 | does not cover code generated by gccgo). |
Ian Lance Taylor | 8c40900 | 2009-11-06 14:16:47 -0800 | [diff] [blame] | 15 | </p> |
Ian Lance Taylor | 4262ff0 | 2009-10-14 15:49:20 -0700 | [diff] [blame] | 16 | |
Ian Lance Taylor | 8c40900 | 2009-11-06 14:16:47 -0800 | [diff] [blame] | 17 | <p> |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 18 | Note that gccgo is not the <code>gc</code> compiler; see |
| 19 | the <a href="/doc/install.html">Installing Go</a> instructions for that |
Ian Lance Taylor | 8c40900 | 2009-11-06 14:16:47 -0800 | [diff] [blame] | 20 | compiler. |
| 21 | </p> |
Ian Lance Taylor | 4262ff0 | 2009-10-14 15:49:20 -0700 | [diff] [blame] | 22 | |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 23 | <h2 id="Releases">Releases</h2> |
| 24 | |
| 25 | <p> |
| 26 | The simplest way to install gccgo is to install a GCC binary release |
Alberto Donizetti | 77aea69 | 2019-09-07 16:31:36 +0200 | [diff] [blame] | 27 | built to include Go support. GCC binary releases are available from |
Suriyaa Sundararuban | 1041ac8 | 2018-06-13 07:06:04 +0000 | [diff] [blame] | 28 | <a href="https://gcc.gnu.org/install/binaries.html">various |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 29 | websites</a> and are typically included as part of GNU/Linux |
Alberto Donizetti | 77aea69 | 2019-09-07 16:31:36 +0200 | [diff] [blame] | 30 | distributions. We expect that most people who build these binaries |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 31 | will include Go support. |
| 32 | </p> |
| 33 | |
| 34 | <p> |
Ian Lance Taylor | ffde497 | 2013-06-20 14:49:15 -0700 | [diff] [blame] | 35 | The GCC 4.7.1 release and all later 4.7 releases include a complete |
| 36 | <a href="/doc/go1.html">Go 1</a> compiler and libraries. |
| 37 | </p> |
| 38 | |
| 39 | <p> |
| 40 | Due to timing, the GCC 4.8.0 and 4.8.1 releases are close to but not |
Alberto Donizetti | 77aea69 | 2019-09-07 16:31:36 +0200 | [diff] [blame] | 41 | identical to Go 1.1. The GCC 4.8.2 release includes a complete Go |
Ian Lance Taylor | 8d206d9 | 2013-11-06 13:58:35 -0800 | [diff] [blame] | 42 | 1.1.2 implementation. |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 43 | </p> |
| 44 | |
Ian Lance Taylor | b511230 | 2014-10-22 20:41:13 -0700 | [diff] [blame] | 45 | <p> |
| 46 | The GCC 4.9 releases include a complete Go 1.2 implementation. |
| 47 | </p> |
| 48 | |
Ian Lance Taylor | 8668ac0 | 2015-06-15 11:13:57 -0700 | [diff] [blame] | 49 | <p> |
| 50 | The GCC 5 releases include a complete implementation of the Go 1.4 |
Alberto Donizetti | 77aea69 | 2019-09-07 16:31:36 +0200 | [diff] [blame] | 51 | user libraries. The Go 1.4 runtime is not fully merged, but that |
Ian Lance Taylor | 8668ac0 | 2015-06-15 11:13:57 -0700 | [diff] [blame] | 52 | should not be visible to Go programs. |
| 53 | </p> |
| 54 | |
Ian Lance Taylor | ea73649 | 2017-01-24 09:32:29 -0800 | [diff] [blame] | 55 | <p> |
| 56 | The GCC 6 releases include a complete implementation of the Go 1.6.1 |
Alberto Donizetti | 77aea69 | 2019-09-07 16:31:36 +0200 | [diff] [blame] | 57 | user libraries. The Go 1.6 runtime is not fully merged, but that |
Ian Lance Taylor | ea73649 | 2017-01-24 09:32:29 -0800 | [diff] [blame] | 58 | should not be visible to Go programs. |
| 59 | </p> |
| 60 | |
| 61 | <p> |
Ian Lance Taylor | a934530 | 2017-09-28 09:49:46 -0700 | [diff] [blame] | 62 | The GCC 7 releases include a complete implementation of the Go 1.8.1 |
Alberto Donizetti | 77aea69 | 2019-09-07 16:31:36 +0200 | [diff] [blame] | 63 | user libraries. As with earlier releases, the Go 1.8 runtime is not |
Ian Lance Taylor | a934530 | 2017-09-28 09:49:46 -0700 | [diff] [blame] | 64 | fully merged, but that should not be visible to Go programs. |
| 65 | </p> |
| 66 | |
| 67 | <p> |
Alberto Donizetti | 77aea69 | 2019-09-07 16:31:36 +0200 | [diff] [blame] | 68 | The GCC 8 releases include a complete implementation of the Go 1.10.1 |
| 69 | release. The Go 1.10 runtime has now been fully merged into the GCC |
| 70 | development sources, and concurrent garbage collection is fully |
| 71 | supported. |
| 72 | </p> |
| 73 | |
| 74 | <p> |
| 75 | The GCC 9 releases include a complete implementation of the Go 1.12.2 |
| 76 | release. |
Ian Lance Taylor | ea73649 | 2017-01-24 09:32:29 -0800 | [diff] [blame] | 77 | </p> |
| 78 | |
Ian Lance Taylor | 4262ff0 | 2009-10-14 15:49:20 -0700 | [diff] [blame] | 79 | <h2 id="Source_code">Source code</h2> |
| 80 | |
| 81 | <p> |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 82 | If you cannot use a release, or prefer to build gccgo for |
Daniel Martà | e70e0a6 | 2019-09-18 17:13:46 +0100 | [diff] [blame^] | 83 | yourself, |
Alberto Donizetti | 77aea69 | 2019-09-07 16:31:36 +0200 | [diff] [blame] | 84 | the gccgo source code is accessible via Subversion. The |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 85 | GCC web site |
Suriyaa Sundararuban | 1041ac8 | 2018-06-13 07:06:04 +0000 | [diff] [blame] | 86 | has <a href="https://gcc.gnu.org/svn.html">instructions for getting the |
Alberto Donizetti | 77aea69 | 2019-09-07 16:31:36 +0200 | [diff] [blame] | 87 | GCC source code</a>. The gccgo source code is included. As a |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 88 | convenience, a stable version of the Go support is available in |
| 89 | a branch of the main GCC code |
Ian Lance Taylor | 4262ff0 | 2009-10-14 15:49:20 -0700 | [diff] [blame] | 90 | repository: <code>svn://gcc.gnu.org/svn/gcc/branches/gccgo</code>. |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 91 | This branch is periodically updated with stable Go compiler sources. |
Ian Lance Taylor | 8c40900 | 2009-11-06 14:16:47 -0800 | [diff] [blame] | 92 | </p> |
Ian Lance Taylor | 4262ff0 | 2009-10-14 15:49:20 -0700 | [diff] [blame] | 93 | |
Ian Lance Taylor | 8653acb | 2010-01-29 16:37:20 -0800 | [diff] [blame] | 94 | <p> |
| 95 | Note that although <code>gcc.gnu.org</code> is the most convenient way |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 96 | to get the source code for the Go frontend, it is not where the master |
Alberto Donizetti | 77aea69 | 2019-09-07 16:31:36 +0200 | [diff] [blame] | 97 | sources live. If you want to contribute changes to the Go frontend |
Andrew Gerrand | f78d50c | 2012-03-05 14:31:27 +1100 | [diff] [blame] | 98 | compiler, see <a href="/doc/gccgo_contribute.html">Contributing to |
Ian Lance Taylor | 8653acb | 2010-01-29 16:37:20 -0800 | [diff] [blame] | 99 | gccgo</a>. |
| 100 | </p> |
| 101 | |
| 102 | |
Ian Lance Taylor | 4262ff0 | 2009-10-14 15:49:20 -0700 | [diff] [blame] | 103 | <h2 id="Building">Building</h2> |
| 104 | |
| 105 | <p> |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 106 | Building gccgo is just like building GCC |
Alberto Donizetti | 77aea69 | 2019-09-07 16:31:36 +0200 | [diff] [blame] | 107 | with one or two additional options. See |
Suriyaa Sundararuban | 1041ac8 | 2018-06-13 07:06:04 +0000 | [diff] [blame] | 108 | the <a href="https://gcc.gnu.org/install/">instructions on the gcc web |
Alberto Donizetti | 77aea69 | 2019-09-07 16:31:36 +0200 | [diff] [blame] | 109 | site</a>. When you run <code>configure</code>, add the |
Ian Lance Taylor | 9e8d136 | 2009-11-18 12:48:48 -0800 | [diff] [blame] | 110 | option <code>--enable-languages=c,c++,go</code> (along with other |
Alberto Donizetti | 77aea69 | 2019-09-07 16:31:36 +0200 | [diff] [blame] | 111 | languages you may want to build). If you are targeting a 32-bit x86, |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 112 | then you will want to build gccgo to default to |
Ian Lance Taylor | 9e8d136 | 2009-11-18 12:48:48 -0800 | [diff] [blame] | 113 | supporting locked compare and exchange instructions; do this by also |
| 114 | using the <code>configure</code> option <code>--with-arch=i586</code> |
| 115 | (or a newer architecture, depending on where you need your programs to |
Alberto Donizetti | 77aea69 | 2019-09-07 16:31:36 +0200 | [diff] [blame] | 116 | run). If you are targeting a 64-bit x86, but sometimes want to use |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 117 | the <code>-m32</code> option, then use the <code>configure</code> |
| 118 | option <code>--with-arch-32=i586</code>. |
| 119 | </p> |
| 120 | |
| 121 | <h3 id="Gold">Gold</h3> |
| 122 | |
| 123 | <p> |
| 124 | On x86 GNU/Linux systems the gccgo compiler is able to |
Alberto Donizetti | 77aea69 | 2019-09-07 16:31:36 +0200 | [diff] [blame] | 125 | use a small discontiguous stack for goroutines. This permits programs |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 126 | to run many more goroutines, since each goroutine can use a relatively |
Alberto Donizetti | 77aea69 | 2019-09-07 16:31:36 +0200 | [diff] [blame] | 127 | small stack. Doing this requires using the gold linker version 2.22 |
| 128 | or later. You can either install GNU binutils 2.22 or later, or you |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 129 | can build gold yourself. |
Ian Lance Taylor | 8c40900 | 2009-11-06 14:16:47 -0800 | [diff] [blame] | 130 | </p> |
| 131 | |
| 132 | <p> |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 133 | To build gold yourself, build the GNU binutils, |
| 134 | using <code>--enable-gold=default</code> when you run |
Alberto Donizetti | 77aea69 | 2019-09-07 16:31:36 +0200 | [diff] [blame] | 135 | the <code>configure</code> script. Before building, you must install |
| 136 | the flex and bison packages. A typical sequence would look like |
Ian Lance Taylor | 1d5e1f5 | 2009-12-29 14:59:08 -0800 | [diff] [blame] | 137 | this (you can replace <code>/opt/gold</code> with any directory to |
| 138 | which you have write access): |
| 139 | </p> |
| 140 | |
| 141 | <pre> |
| 142 | cvs -z 9 -d :pserver:anoncvs@sourceware.org:/cvs/src login |
| 143 | [password is "anoncvs"] |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 144 | [The next command will create a directory named src, not binutils] |
Ian Lance Taylor | 1d5e1f5 | 2009-12-29 14:59:08 -0800 | [diff] [blame] | 145 | cvs -z 9 -d :pserver:anoncvs@sourceware.org:/cvs/src co binutils |
| 146 | mkdir binutils-objdir |
| 147 | cd binutils-objdir |
Ian Lance Taylor | 5d1d040 | 2011-09-19 11:54:07 -0700 | [diff] [blame] | 148 | ../src/configure --enable-gold=default --prefix=/opt/gold |
Ian Lance Taylor | 1d5e1f5 | 2009-12-29 14:59:08 -0800 | [diff] [blame] | 149 | make |
| 150 | make install |
| 151 | </pre> |
| 152 | |
| 153 | <p> |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 154 | However you install gold, when you configure gccgo, use the |
| 155 | option <code>--with-ld=<var>GOLD_BINARY</var></code>. |
| 156 | </p> |
| 157 | |
| 158 | <h3 id="Prerequisites">Prerequisites</h3> |
| 159 | |
| 160 | <p> |
| 161 | A number of prerequisites are required to build GCC, as |
| 162 | described on |
Suriyaa Sundararuban | 1041ac8 | 2018-06-13 07:06:04 +0000 | [diff] [blame] | 163 | the <a href="https://gcc.gnu.org/install/prerequisites.html">gcc web |
Alberto Donizetti | 77aea69 | 2019-09-07 16:31:36 +0200 | [diff] [blame] | 164 | site</a>. It is important to install all the prerequisites before |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 165 | running the gcc <code>configure</code> script. |
Ian Lance Taylor | ffde497 | 2013-06-20 14:49:15 -0700 | [diff] [blame] | 166 | The prerequisite libraries can be conveniently downloaded using the |
| 167 | script <code>contrib/download_prerequisites</code> in the GCC sources. |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 168 | |
| 169 | <h3 id="Build_commands">Build commands</h3> |
| 170 | |
| 171 | <p> |
| 172 | Once all the prerequisites are installed, then a typical build and |
| 173 | install sequence would look like this (only use |
| 174 | the <code>--with-ld</code> option if you are using the gold linker as |
| 175 | described above): |
Ian Lance Taylor | 1d5e1f5 | 2009-12-29 14:59:08 -0800 | [diff] [blame] | 176 | </p> |
Ian Lance Taylor | 8c40900 | 2009-11-06 14:16:47 -0800 | [diff] [blame] | 177 | |
| 178 | <pre> |
| 179 | svn checkout svn://gcc.gnu.org/svn/gcc/branches/gccgo gccgo |
| 180 | mkdir objdir |
| 181 | cd objdir |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 182 | ../gccgo/configure --prefix=/opt/gccgo --enable-languages=c,c++,go --with-ld=/opt/gold/bin/ld |
Ian Lance Taylor | 8c40900 | 2009-11-06 14:16:47 -0800 | [diff] [blame] | 183 | make |
| 184 | make install |
| 185 | </pre> |
Ian Lance Taylor | 4262ff0 | 2009-10-14 15:49:20 -0700 | [diff] [blame] | 186 | |
| 187 | <h2 id="Using_gccgo">Using gccgo</h2> |
| 188 | |
| 189 | <p> |
Alberto Donizetti | 77aea69 | 2019-09-07 16:31:36 +0200 | [diff] [blame] | 190 | The gccgo compiler works like other gcc frontends. As of GCC 5 the gccgo |
Ian Lance Taylor | 8668ac0 | 2015-06-15 11:13:57 -0700 | [diff] [blame] | 191 | installation also includes a version of the <code>go</code> command, |
| 192 | which may be used to build Go programs as described at |
Brad Fitzpatrick | 2ae7737 | 2015-07-10 17:17:11 -0600 | [diff] [blame] | 193 | <a href="https://golang.org/cmd/go">https://golang.org/cmd/go</a>. |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 194 | </p> |
Ian Lance Taylor | 4262ff0 | 2009-10-14 15:49:20 -0700 | [diff] [blame] | 195 | |
| 196 | <p> |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 197 | To compile a file without using the <code>go</code> command: |
| 198 | </p> |
Ian Lance Taylor | 4262ff0 | 2009-10-14 15:49:20 -0700 | [diff] [blame] | 199 | |
| 200 | <pre> |
| 201 | gccgo -c file.go |
| 202 | </pre> |
| 203 | |
| 204 | <p> |
| 205 | That produces <code>file.o</code>. To link files together to form an |
| 206 | executable: |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 207 | </p> |
Ian Lance Taylor | 4262ff0 | 2009-10-14 15:49:20 -0700 | [diff] [blame] | 208 | |
| 209 | <pre> |
| 210 | gccgo -o file file.o |
| 211 | </pre> |
| 212 | |
| 213 | <p> |
| 214 | To run the resulting file, you will need to tell the program where to |
Alberto Donizetti | 77aea69 | 2019-09-07 16:31:36 +0200 | [diff] [blame] | 215 | find the compiled Go packages. There are a few ways to do this: |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 216 | </p> |
| 217 | |
| 218 | <ul> |
| 219 | <li> |
| 220 | <p> |
| 221 | Set the <code>LD_LIBRARY_PATH</code> environment variable: |
| 222 | </p> |
Ian Lance Taylor | 4262ff0 | 2009-10-14 15:49:20 -0700 | [diff] [blame] | 223 | |
| 224 | <pre> |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 225 | LD_LIBRARY_PATH=${prefix}/lib/gcc/MACHINE/VERSION |
| 226 | [or] |
| 227 | LD_LIBRARY_PATH=${prefix}/lib64/gcc/MACHINE/VERSION |
| 228 | export LD_LIBRARY_PATH |
Ian Lance Taylor | 4262ff0 | 2009-10-14 15:49:20 -0700 | [diff] [blame] | 229 | </pre> |
| 230 | |
| 231 | <p> |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 232 | Here <code>${prefix}</code> is the <code>--prefix</code> option used |
Alberto Donizetti | 77aea69 | 2019-09-07 16:31:36 +0200 | [diff] [blame] | 233 | when building gccgo. For a binary install this is |
| 234 | normally <code>/usr</code>. Whether to use <code>lib</code> |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 235 | or <code>lib64</code> depends on the target. |
| 236 | Typically <code>lib64</code> is correct for x86_64 systems, |
Alberto Donizetti | 77aea69 | 2019-09-07 16:31:36 +0200 | [diff] [blame] | 237 | and <code>lib</code> is correct for other systems. The idea is to |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 238 | name the directory where <code>libgo.so</code> is found. |
| 239 | </p> |
| 240 | |
| 241 | </li> |
| 242 | |
| 243 | <li> |
| 244 | <p> |
Ian Lance Taylor | 8668ac0 | 2015-06-15 11:13:57 -0700 | [diff] [blame] | 245 | Passing a <code>-Wl,-R</code> option when you link (replace lib with |
| 246 | lib64 if appropriate for your system): |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 247 | </p> |
Ian Lance Taylor | 4262ff0 | 2009-10-14 15:49:20 -0700 | [diff] [blame] | 248 | |
| 249 | <pre> |
Ian Lance Taylor | 8668ac0 | 2015-06-15 11:13:57 -0700 | [diff] [blame] | 250 | go build -gccgoflags -Wl,-R,${prefix}/lib/gcc/MACHINE/VERSION |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 251 | [or] |
Ian Lance Taylor | 8668ac0 | 2015-06-15 11:13:57 -0700 | [diff] [blame] | 252 | gccgo -o file file.o -Wl,-R,${prefix}/lib/gcc/MACHINE/VERSION |
Ian Lance Taylor | 4262ff0 | 2009-10-14 15:49:20 -0700 | [diff] [blame] | 253 | </pre> |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 254 | </li> |
Ian Lance Taylor | 4262ff0 | 2009-10-14 15:49:20 -0700 | [diff] [blame] | 255 | |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 256 | <li> |
Ian Lance Taylor | 4262ff0 | 2009-10-14 15:49:20 -0700 | [diff] [blame] | 257 | <p> |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 258 | Use the <code>-static-libgo</code> option to link statically against |
| 259 | the compiled packages. |
| 260 | </p> |
| 261 | </li> |
Ian Lance Taylor | 4262ff0 | 2009-10-14 15:49:20 -0700 | [diff] [blame] | 262 | |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 263 | <li> |
Ian Lance Taylor | 4262ff0 | 2009-10-14 15:49:20 -0700 | [diff] [blame] | 264 | <p> |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 265 | Use the <code>-static</code> option to do a fully static link (the |
| 266 | default for the <code>gc</code> compiler). |
| 267 | </p> |
| 268 | </li> |
| 269 | </ul> |
Ian Lance Taylor | 4262ff0 | 2009-10-14 15:49:20 -0700 | [diff] [blame] | 270 | |
Ian Lance Taylor | 8653acb | 2010-01-29 16:37:20 -0800 | [diff] [blame] | 271 | <h2 id="Options">Options</h2> |
| 272 | |
| 273 | <p> |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 274 | The gccgo compiler supports all GCC options |
Ian Lance Taylor | 8653acb | 2010-01-29 16:37:20 -0800 | [diff] [blame] | 275 | that are language independent, notably the <code>-O</code> |
| 276 | and <code>-g</code> options. |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 277 | </p> |
Ian Lance Taylor | 8653acb | 2010-01-29 16:37:20 -0800 | [diff] [blame] | 278 | |
| 279 | <p> |
Ian Lance Taylor | 8668ac0 | 2015-06-15 11:13:57 -0700 | [diff] [blame] | 280 | The <code>-fgo-pkgpath=PKGPATH</code> option may be used to set a |
| 281 | unique prefix for the package being compiled. |
| 282 | This option is automatically used by the go command, but you may want |
| 283 | to use it if you invoke gccgo directly. |
| 284 | This option is intended for use with large |
| 285 | programs that contain many packages, in order to allow multiple |
| 286 | packages to use the same identifier as the package name. |
| 287 | The <code>PKGPATH</code> may be any string; a good choice for the |
| 288 | string is the path used to import the package. |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 289 | </p> |
Ian Lance Taylor | 8653acb | 2010-01-29 16:37:20 -0800 | [diff] [blame] | 290 | |
| 291 | <p> |
| 292 | The <code>-I</code> and <code>-L</code> options, which are synonyms |
| 293 | for the compiler, may be used to set the search path for finding |
| 294 | imports. |
Ian Lance Taylor | 8668ac0 | 2015-06-15 11:13:57 -0700 | [diff] [blame] | 295 | These options are not needed if you build with the go command. |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 296 | </p> |
Ian Lance Taylor | 8653acb | 2010-01-29 16:37:20 -0800 | [diff] [blame] | 297 | |
Ian Lance Taylor | 4262ff0 | 2009-10-14 15:49:20 -0700 | [diff] [blame] | 298 | <h2 id="Imports">Imports</h2> |
| 299 | |
| 300 | <p> |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 301 | When you compile a file that exports something, the export |
Ian Lance Taylor | 8668ac0 | 2015-06-15 11:13:57 -0700 | [diff] [blame] | 302 | information will be stored directly in the object file. |
| 303 | If you build with gccgo directly, rather than with the go command, |
| 304 | then when you import a package, you must tell gccgo how to find the |
| 305 | file. |
| 306 | </p> |
Ian Lance Taylor | 4262ff0 | 2009-10-14 15:49:20 -0700 | [diff] [blame] | 307 | |
| 308 | <p> |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 309 | When you import the package <var>FILE</var> with gccgo, |
Ian Lance Taylor | 4262ff0 | 2009-10-14 15:49:20 -0700 | [diff] [blame] | 310 | it will look for the import data in the following files, and use the |
| 311 | first one that it finds. |
| 312 | |
| 313 | <ul> |
| 314 | <li><code><var>FILE</var>.gox</code> |
Ian Lance Taylor | 4262ff0 | 2009-10-14 15:49:20 -0700 | [diff] [blame] | 315 | <li><code>lib<var>FILE</var>.so</code> |
| 316 | <li><code>lib<var>FILE</var>.a</code> |
Peter Collingbourne | a5cc5ba | 2013-12-06 13:33:10 -0800 | [diff] [blame] | 317 | <li><code><var>FILE</var>.o</code> |
Ian Lance Taylor | 4262ff0 | 2009-10-14 15:49:20 -0700 | [diff] [blame] | 318 | </ul> |
| 319 | |
| 320 | <p> |
| 321 | <code><var>FILE</var>.gox</code>, when used, will typically contain |
| 322 | nothing but export data. This can be generated from |
| 323 | <code><var>FILE</var>.o</code> via |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 324 | </p> |
Ian Lance Taylor | 4262ff0 | 2009-10-14 15:49:20 -0700 | [diff] [blame] | 325 | |
| 326 | <pre> |
| 327 | objcopy -j .go_export FILE.o FILE.gox |
| 328 | </pre> |
| 329 | |
| 330 | <p> |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 331 | The gccgo compiler will look in the current |
Alberto Donizetti | 77aea69 | 2019-09-07 16:31:36 +0200 | [diff] [blame] | 332 | directory for import files. In more complex scenarios you |
Ian Lance Taylor | 4262ff0 | 2009-10-14 15:49:20 -0700 | [diff] [blame] | 333 | may pass the <code>-I</code> or <code>-L</code> option to |
Alberto Donizetti | 77aea69 | 2019-09-07 16:31:36 +0200 | [diff] [blame] | 334 | gccgo. Both options take directories to search. The |
Ian Lance Taylor | 4262ff0 | 2009-10-14 15:49:20 -0700 | [diff] [blame] | 335 | <code>-L</code> option is also passed to the linker. |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 336 | </p> |
Ian Lance Taylor | 4262ff0 | 2009-10-14 15:49:20 -0700 | [diff] [blame] | 337 | |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 338 | <p> |
Ian Lance Taylor | 8668ac0 | 2015-06-15 11:13:57 -0700 | [diff] [blame] | 339 | The gccgo compiler does not currently (2015-06-15) record |
Ian Lance Taylor | 4262ff0 | 2009-10-14 15:49:20 -0700 | [diff] [blame] | 340 | the file name of imported packages in the object file. You must |
| 341 | arrange for the imported data to be linked into the program. |
Ian Lance Taylor | 8668ac0 | 2015-06-15 11:13:57 -0700 | [diff] [blame] | 342 | Again, this is not necessary when building with the go command. |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 343 | </p> |
Ian Lance Taylor | 4262ff0 | 2009-10-14 15:49:20 -0700 | [diff] [blame] | 344 | |
| 345 | <pre> |
| 346 | gccgo -c mypackage.go # Exports mypackage |
| 347 | gccgo -c main.go # Imports mypackage |
| 348 | gccgo -o main main.o mypackage.o # Explicitly links with mypackage.o |
| 349 | </pre> |
| 350 | |
Ian Lance Taylor | 4262ff0 | 2009-10-14 15:49:20 -0700 | [diff] [blame] | 351 | <h2 id="Debugging">Debugging</h2> |
| 352 | |
| 353 | <p> |
| 354 | If you use the <code>-g</code> option when you compile, you can run |
Alberto Donizetti | 77aea69 | 2019-09-07 16:31:36 +0200 | [diff] [blame] | 355 | <code>gdb</code> on your executable. The debugger has only limited |
| 356 | knowledge about Go. You can set breakpoints, single-step, |
| 357 | etc. You can print variables, but they will be printed as though they |
| 358 | had C/C++ types. For numeric types this doesn't matter. Go strings |
| 359 | and interfaces will show up as two-element structures. Go |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 360 | maps and channels are always represented as C pointers to run-time |
| 361 | structures. |
| 362 | </p> |
Ian Lance Taylor | 4262ff0 | 2009-10-14 15:49:20 -0700 | [diff] [blame] | 363 | |
| 364 | <h2 id="C_Interoperability">C Interoperability</h2> |
| 365 | |
| 366 | <p> |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 367 | When using gccgo there is limited interoperability with C, |
Ian Lance Taylor | 4262ff0 | 2009-10-14 15:49:20 -0700 | [diff] [blame] | 368 | or with C++ code compiled using <code>extern "C"</code>. |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 369 | </p> |
Ian Lance Taylor | 4262ff0 | 2009-10-14 15:49:20 -0700 | [diff] [blame] | 370 | |
| 371 | <h3 id="Types">Types</h3> |
| 372 | |
| 373 | <p> |
Ian Lance Taylor | ea73649 | 2017-01-24 09:32:29 -0800 | [diff] [blame] | 374 | Basic types map directly: an <code>int32</code> in Go is |
| 375 | an <code>int32_t</code> in C, an <code>int64</code> is |
| 376 | an <code>int64_t</code>, etc. |
| 377 | The Go type <code>int</code> is an integer that is the same size as a |
| 378 | pointer, and as such corresponds to the C type <code>intptr_t</code>. |
| 379 | Go <code>byte</code> is equivalent to C <code>unsigned char</code>. |
| 380 | Pointers in Go are pointers in C. |
| 381 | A Go <code>struct</code> is the same as C <code>struct</code> with the |
| 382 | same fields and types. |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 383 | </p> |
Ian Lance Taylor | 4262ff0 | 2009-10-14 15:49:20 -0700 | [diff] [blame] | 384 | |
| 385 | <p> |
Ian Lance Taylor | 659966a | 2010-08-23 17:50:30 -0700 | [diff] [blame] | 386 | The Go <code>string</code> type is currently defined as a two-element |
| 387 | structure (this is <b style="color: red;">subject to change</b>): |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 388 | </p> |
Ian Lance Taylor | 4262ff0 | 2009-10-14 15:49:20 -0700 | [diff] [blame] | 389 | |
| 390 | <pre> |
| 391 | struct __go_string { |
Ian Lance Taylor | 659966a | 2010-08-23 17:50:30 -0700 | [diff] [blame] | 392 | const unsigned char *__data; |
Ian Lance Taylor | ea73649 | 2017-01-24 09:32:29 -0800 | [diff] [blame] | 393 | intptr_t __length; |
Ian Lance Taylor | 4262ff0 | 2009-10-14 15:49:20 -0700 | [diff] [blame] | 394 | }; |
| 395 | </pre> |
| 396 | |
| 397 | <p> |
| 398 | You can't pass arrays between C and Go. However, a pointer to an |
| 399 | array in Go is equivalent to a C pointer to the |
| 400 | equivalent of the element type. |
| 401 | For example, Go <code>*[10]int</code> is equivalent to C <code>int*</code>, |
| 402 | assuming that the C pointer does point to 10 elements. |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 403 | </p> |
Ian Lance Taylor | 4262ff0 | 2009-10-14 15:49:20 -0700 | [diff] [blame] | 404 | |
| 405 | <p> |
Alberto Donizetti | 77aea69 | 2019-09-07 16:31:36 +0200 | [diff] [blame] | 406 | A slice in Go is a structure. The current definition is |
Ian Lance Taylor | 4262ff0 | 2009-10-14 15:49:20 -0700 | [diff] [blame] | 407 | (this is <b style="color: red;">subject to change</b>): |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 408 | </p> |
Ian Lance Taylor | 4262ff0 | 2009-10-14 15:49:20 -0700 | [diff] [blame] | 409 | |
| 410 | <pre> |
| 411 | struct __go_slice { |
| 412 | void *__values; |
Ian Lance Taylor | ea73649 | 2017-01-24 09:32:29 -0800 | [diff] [blame] | 413 | intptr_t __count; |
| 414 | intptr_t __capacity; |
Ian Lance Taylor | 4262ff0 | 2009-10-14 15:49:20 -0700 | [diff] [blame] | 415 | }; |
| 416 | </pre> |
| 417 | |
| 418 | <p> |
Ian Lance Taylor | ffde497 | 2013-06-20 14:49:15 -0700 | [diff] [blame] | 419 | The type of a Go function is a pointer to a struct (this is |
Alberto Donizetti | 77aea69 | 2019-09-07 16:31:36 +0200 | [diff] [blame] | 420 | <b style="color: red;">subject to change</b>). The first field in the |
Ian Lance Taylor | ffde497 | 2013-06-20 14:49:15 -0700 | [diff] [blame] | 421 | struct points to the code of the function, which will be equivalent to |
| 422 | a pointer to a C function whose parameter types are equivalent, with |
Alberto Donizetti | 77aea69 | 2019-09-07 16:31:36 +0200 | [diff] [blame] | 423 | an additional trailing parameter. The trailing parameter is the |
Ian Lance Taylor | ffde497 | 2013-06-20 14:49:15 -0700 | [diff] [blame] | 424 | closure, and the argument to pass is a pointer to the Go function |
| 425 | struct. |
| 426 | |
| 427 | When a Go function returns more than one value, the C function returns |
Alberto Donizetti | 77aea69 | 2019-09-07 16:31:36 +0200 | [diff] [blame] | 428 | a struct. For example, these functions are roughly equivalent: |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 429 | </p> |
Ian Lance Taylor | 4262ff0 | 2009-10-14 15:49:20 -0700 | [diff] [blame] | 430 | |
| 431 | <pre> |
Rob Pike | 80e25fc | 2011-01-19 23:07:38 -0500 | [diff] [blame] | 432 | func GoFunction(int) (int, float64) |
Ian Lance Taylor | ffde497 | 2013-06-20 14:49:15 -0700 | [diff] [blame] | 433 | struct { int i; float64 f; } CFunction(int, void*) |
Ian Lance Taylor | 4262ff0 | 2009-10-14 15:49:20 -0700 | [diff] [blame] | 434 | </pre> |
| 435 | |
| 436 | <p> |
Ian Lance Taylor | 4262ff0 | 2009-10-14 15:49:20 -0700 | [diff] [blame] | 437 | Go <code>interface</code>, <code>channel</code>, and <code>map</code> |
Ian Lance Taylor | 659966a | 2010-08-23 17:50:30 -0700 | [diff] [blame] | 438 | types have no corresponding C type (<code>interface</code> is a |
| 439 | two-element struct and <code>channel</code> and <code>map</code> are |
| 440 | pointers to structs in C, but the structs are deliberately undocumented). C |
| 441 | <code>enum</code> types correspond to some integer type, but precisely |
Ian Lance Taylor | 4262ff0 | 2009-10-14 15:49:20 -0700 | [diff] [blame] | 442 | which one is difficult to predict in general; use a cast. C <code>union</code> |
| 443 | types have no corresponding Go type. C <code>struct</code> types containing |
| 444 | bitfields have no corresponding Go type. C++ <code>class</code> types have |
| 445 | no corresponding Go type. |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 446 | </p> |
Ian Lance Taylor | 4262ff0 | 2009-10-14 15:49:20 -0700 | [diff] [blame] | 447 | |
| 448 | <p> |
| 449 | Memory allocation is completely different between C and Go, as Go uses |
| 450 | garbage collection. The exact guidelines in this area are undetermined, |
| 451 | but it is likely that it will be permitted to pass a pointer to allocated |
| 452 | memory from C to Go. The responsibility of eventually freeing the pointer |
| 453 | will remain with C side, and of course if the C side frees the pointer |
| 454 | while the Go side still has a copy the program will fail. When passing a |
| 455 | pointer from Go to C, the Go function must retain a visible copy of it in |
| 456 | some Go variable. Otherwise the Go garbage collector may delete the |
| 457 | pointer while the C function is still using it. |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 458 | </p> |
Ian Lance Taylor | 4262ff0 | 2009-10-14 15:49:20 -0700 | [diff] [blame] | 459 | |
| 460 | <h3 id="Function_names">Function names</h3> |
| 461 | |
| 462 | <p> |
| 463 | Go code can call C functions directly using a Go extension implemented |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 464 | in gccgo: a function declaration may be preceded by |
Alberto Donizetti | 77aea69 | 2019-09-07 16:31:36 +0200 | [diff] [blame] | 465 | <code>//extern NAME</code>. For example, here is how the C function |
Ian Lance Taylor | 4262ff0 | 2009-10-14 15:49:20 -0700 | [diff] [blame] | 466 | <code>open</code> can be declared in Go: |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 467 | </p> |
Ian Lance Taylor | 4262ff0 | 2009-10-14 15:49:20 -0700 | [diff] [blame] | 468 | |
| 469 | <pre> |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 470 | //extern open |
| 471 | func c_open(name *byte, mode int, perm int) int |
Ian Lance Taylor | 4262ff0 | 2009-10-14 15:49:20 -0700 | [diff] [blame] | 472 | </pre> |
| 473 | |
| 474 | <p> |
Jeremy Jackins | 7e05426 | 2012-03-19 08:26:36 +1100 | [diff] [blame] | 475 | The C function naturally expects a NUL-terminated string, which in |
Ian Lance Taylor | 4262ff0 | 2009-10-14 15:49:20 -0700 | [diff] [blame] | 476 | Go is equivalent to a pointer to an array (not a slice!) of |
| 477 | <code>byte</code> with a terminating zero byte. So a sample call |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 478 | from Go would look like (after importing the <code>syscall</code> package): |
| 479 | </p> |
Ian Lance Taylor | 4262ff0 | 2009-10-14 15:49:20 -0700 | [diff] [blame] | 480 | |
| 481 | <pre> |
| 482 | var name = [4]byte{'f', 'o', 'o', 0}; |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 483 | i := c_open(&name[0], syscall.O_RDONLY, 0); |
Ian Lance Taylor | 4262ff0 | 2009-10-14 15:49:20 -0700 | [diff] [blame] | 484 | </pre> |
| 485 | |
| 486 | <p> |
| 487 | (this serves as an example only, to open a file in Go please use Go's |
| 488 | <code>os.Open</code> function instead). |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 489 | </p> |
Ian Lance Taylor | 4262ff0 | 2009-10-14 15:49:20 -0700 | [diff] [blame] | 490 | |
| 491 | <p> |
Ian Lance Taylor | ffde497 | 2013-06-20 14:49:15 -0700 | [diff] [blame] | 492 | Note that if the C function can block, such as in a call |
| 493 | to <code>read</code>, calling the C function may block the Go program. |
| 494 | Unless you have a clear understanding of what you are doing, all calls |
| 495 | between C and Go should be implemented through cgo or SWIG, as for |
| 496 | the <code>gc</code> compiler. |
| 497 | </p> |
| 498 | |
| 499 | <p> |
Ian Lance Taylor | 4262ff0 | 2009-10-14 15:49:20 -0700 | [diff] [blame] | 500 | The name of Go functions accessed from C is subject to change. At present |
| 501 | the name of a Go function that does not have a receiver is |
Ian Lance Taylor | 659966a | 2010-08-23 17:50:30 -0700 | [diff] [blame] | 502 | <code>prefix.package.Functionname</code>. The prefix is set by |
| 503 | the <code>-fgo-prefix</code> option used when the package is compiled; |
Russ Cox | ae7497b | 2012-02-06 13:34:35 -0500 | [diff] [blame] | 504 | if the option is not used, the default is <code>go</code>. |
Ian Lance Taylor | 659966a | 2010-08-23 17:50:30 -0700 | [diff] [blame] | 505 | To call the function from C you must set the name using |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 506 | a GCC extension. |
| 507 | </p> |
Ian Lance Taylor | 4262ff0 | 2009-10-14 15:49:20 -0700 | [diff] [blame] | 508 | |
| 509 | <pre> |
Ian Lance Taylor | 659966a | 2010-08-23 17:50:30 -0700 | [diff] [blame] | 510 | extern int go_function(int) __asm__ ("myprefix.mypackage.Function"); |
Ian Lance Taylor | 4262ff0 | 2009-10-14 15:49:20 -0700 | [diff] [blame] | 511 | </pre> |
| 512 | |
| 513 | <h3 id="Automatic_generation_of_Go_declarations_from_C_source_code"> |
| 514 | Automatic generation of Go declarations from C source code</h3> |
| 515 | |
| 516 | <p> |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 517 | The Go version of GCC supports automatically generating |
| 518 | Go declarations from C code. The facility is rather awkward, and most |
| 519 | users should use the <a href="/cmd/cgo">cgo</a> program with |
| 520 | the <code>-gccgo</code> option instead. |
| 521 | </p> |
Ian Lance Taylor | 4262ff0 | 2009-10-14 15:49:20 -0700 | [diff] [blame] | 522 | |
| 523 | <p> |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 524 | Compile your C code as usual, and add the option |
Alberto Donizetti | 77aea69 | 2019-09-07 16:31:36 +0200 | [diff] [blame] | 525 | <code>-fdump-go-spec=<var>FILENAME</var></code>. This will create the |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 526 | file <code><var>FILENAME</var></code> as a side effect of the |
Alberto Donizetti | 77aea69 | 2019-09-07 16:31:36 +0200 | [diff] [blame] | 527 | compilation. This file will contain Go declarations for the types, |
| 528 | variables and functions declared in the C code. C types that can not |
| 529 | be represented in Go will be recorded as comments in the Go code. The |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 530 | generated file will not have a <code>package</code> declaration, but |
| 531 | can otherwise be compiled directly by gccgo. |
| 532 | </p> |
Ian Lance Taylor | 4262ff0 | 2009-10-14 15:49:20 -0700 | [diff] [blame] | 533 | |
| 534 | <p> |
| 535 | This procedure is full of unstated caveats and restrictions and we make no |
| 536 | guarantee that it will not change in the future. It is more useful as a |
| 537 | starting point for real Go code than as a regular procedure. |
Ian Lance Taylor | a84e3ba | 2012-03-20 14:16:34 -0700 | [diff] [blame] | 538 | </p> |