Andrew Gerrand | 7cb21a7 | 2012-01-19 11:24:54 +1100 | [diff] [blame] | 1 | <!--{ |
| 2 | "Title": "Contributing to the gccgo frontend" |
| 3 | }--> |
Ian Lance Taylor | 2528f33 | 2009-11-06 14:15:41 -0800 | [diff] [blame] | 4 | |
| 5 | <h2>Introduction</h2> |
| 6 | |
| 7 | <p> |
Ian Lance Taylor | 253c139 | 2012-02-18 11:15:52 -0800 | [diff] [blame] | 8 | These are some notes on contributing to the gccgo frontend for GCC. |
| 9 | For information on contributing to parts of Go other than gccgo, |
Andrew Gerrand | f78d50c | 2012-03-05 14:31:27 +1100 | [diff] [blame] | 10 | see <a href="/doc/contribute.html">Contributing to the Go project</a>. For |
Ian Lance Taylor | 253c139 | 2012-02-18 11:15:52 -0800 | [diff] [blame] | 11 | information on building gccgo for yourself, |
Andrew Gerrand | f78d50c | 2012-03-05 14:31:27 +1100 | [diff] [blame] | 12 | see <a href="/doc/gccgo_install.html">Setting up and using gccgo</a>. |
Ian Lance Taylor | ffde497 | 2013-06-20 14:49:15 -0700 | [diff] [blame] | 13 | For more of the gritty details on the process of doing development |
| 14 | with the gccgo frontend, |
| 15 | see <a href="https://code.google.com/p/gofrontend/source/browse/HACKING">the |
| 16 | file HACKING</a> in the gofrontend repository. |
Ian Lance Taylor | 2528f33 | 2009-11-06 14:15:41 -0800 | [diff] [blame] | 17 | </p> |
| 18 | |
| 19 | <h2>Legal Prerequisites</h2> |
| 20 | |
| 21 | <p> |
Andrew Gerrand | f78d50c | 2012-03-05 14:31:27 +1100 | [diff] [blame] | 22 | You must follow the <a href="/doc/contribute.html#copyright">Go copyright |
Ian Lance Taylor | 253c139 | 2012-02-18 11:15:52 -0800 | [diff] [blame] | 23 | rules</a> for all changes to the gccgo frontend and the associated |
| 24 | libgo library. Code that is part of GCC rather than gccgo must follow |
| 25 | the general <a href="http://gcc.gnu.org/contribute.html">GCC |
| 26 | contribution rules</a>. |
Ian Lance Taylor | 2528f33 | 2009-11-06 14:15:41 -0800 | [diff] [blame] | 27 | </p> |
| 28 | |
| 29 | <h2>Code</h2> |
| 30 | |
| 31 | <p> |
Ian Lance Taylor | 253c139 | 2012-02-18 11:15:52 -0800 | [diff] [blame] | 32 | The master sources for the gccgo frontend may be found at |
Ian Lance Taylor | 8668ac0 | 2015-06-15 11:13:57 -0700 | [diff] [blame] | 33 | <a href="http://go.googlesource.com/gofrontend">http://go.googlesource.com/gofrontend</a>. |
| 34 | They are mirrored |
| 35 | at <a href="http://github.com/golang/gofrontend">http://github.com/golang/gofrontend</a>. |
Ian Lance Taylor | 253c139 | 2012-02-18 11:15:52 -0800 | [diff] [blame] | 36 | The master sources are not buildable by themselves, but only in |
| 37 | conjunction with GCC (in the future, other compilers may be |
| 38 | supported). Changes made to the gccgo frontend are also applied to |
| 39 | the GCC source code repository hosted at <code>gcc.gnu.org</code>. In |
| 40 | the <code>gofrontend</code> repository, the <code>go</code> directory |
| 41 | is mirrored to the <code>gcc/go/gofrontend</code> directory in the GCC |
| 42 | repository, and the <code>gofrontend</code> <code>libgo</code> |
| 43 | directory is mirrored to the GCC <code>libgo</code> directory. In |
| 44 | addition, the <code>test</code> directory |
Péter Surányi | 9b6ccb1 | 2015-02-06 21:44:39 +0900 | [diff] [blame] | 45 | from <a href="//go.googlesource.com/go">the main Go repository</a> |
Ian Lance Taylor | 253c139 | 2012-02-18 11:15:52 -0800 | [diff] [blame] | 46 | is mirrored to the <code>gcc/testsuite/go.test/test</code> directory |
| 47 | in the GCC repository. |
Ian Lance Taylor | 2528f33 | 2009-11-06 14:15:41 -0800 | [diff] [blame] | 48 | </p> |
| 49 | |
| 50 | <p> |
Ian Lance Taylor | 253c139 | 2012-02-18 11:15:52 -0800 | [diff] [blame] | 51 | Changes to these directories always flow from the master sources to |
| 52 | the GCC repository. The files should never be changed in the GCC |
| 53 | repository except by changing them in the master sources and mirroring |
| 54 | them. |
| 55 | </p> |
| 56 | |
| 57 | <p> |
Ian Lance Taylor | 8668ac0 | 2015-06-15 11:13:57 -0700 | [diff] [blame] | 58 | The gccgo frontend is written in C++. |
| 59 | It follows the GNU and GCC coding standards for C++. |
| 60 | In writing code for the frontend, follow the formatting of the |
| 61 | surrounding code. |
| 62 | Almost all GCC-specific code is not in the frontend proper and is |
| 63 | instead in the GCC sources in the <code>gcc/go</code> directory. |
Ian Lance Taylor | 253c139 | 2012-02-18 11:15:52 -0800 | [diff] [blame] | 64 | </p> |
| 65 | |
| 66 | <p> |
| 67 | The run-time library for gccgo is mostly the same as the library |
Péter Surányi | 9b6ccb1 | 2015-02-06 21:44:39 +0900 | [diff] [blame] | 68 | in <a href="//go.googlesource.com/go">the main Go repository</a>. |
Ian Lance Taylor | 253c139 | 2012-02-18 11:15:52 -0800 | [diff] [blame] | 69 | The library code in the Go repository is periodically merged into |
| 70 | the <code>libgo/go</code> directory of the <code>gofrontend</code> and |
| 71 | then the GCC repositories, using the shell |
| 72 | script <code>libgo/merge.sh</code>. Accordingly, most library changes |
| 73 | should be made in the main Go repository. The files outside |
| 74 | of <code>libgo/go</code> are gccgo-specific; that said, some of the |
| 75 | files in <code>libgo/runtime</code> are based on files |
Russ Cox | 220a6de | 2014-09-08 00:06:45 -0400 | [diff] [blame] | 76 | in <code>src/runtime</code> in the main Go repository. |
Ian Lance Taylor | 2528f33 | 2009-11-06 14:15:41 -0800 | [diff] [blame] | 77 | </p> |
| 78 | |
| 79 | <h2>Testing</h2> |
| 80 | |
| 81 | <p> |
Ian Lance Taylor | 253c139 | 2012-02-18 11:15:52 -0800 | [diff] [blame] | 82 | All patches must be tested. A patch that introduces new failures is |
| 83 | not acceptable. |
Ian Lance Taylor | 2528f33 | 2009-11-06 14:15:41 -0800 | [diff] [blame] | 84 | </p> |
| 85 | |
| 86 | <p> |
Ian Lance Taylor | 253c139 | 2012-02-18 11:15:52 -0800 | [diff] [blame] | 87 | To run the gccgo test suite, run <code>make check-go</code> in your |
| 88 | build directory. This will run various tests |
| 89 | under <code>gcc/testsuite/go.*</code> and will also run |
| 90 | the <code>libgo</code> testsuite. This copy of the tests from the |
Rob Pike | a9c6952 | 2013-04-16 14:20:06 -0700 | [diff] [blame] | 91 | main Go repository is run using the DejaGNU script found |
Ian Lance Taylor | 253c139 | 2012-02-18 11:15:52 -0800 | [diff] [blame] | 92 | in <code>gcc/testsuite/go.test/go-test.exp</code>. |
Ian Lance Taylor | 2528f33 | 2009-11-06 14:15:41 -0800 | [diff] [blame] | 93 | </p> |
| 94 | |
| 95 | <p> |
Ian Lance Taylor | 253c139 | 2012-02-18 11:15:52 -0800 | [diff] [blame] | 96 | Most new tests should be submitted to the main Go repository for later |
| 97 | mirroring into the GCC repository. If there is a need for specific |
| 98 | tests for gccgo, they should go in |
Ian Lance Taylor | 2528f33 | 2009-11-06 14:15:41 -0800 | [diff] [blame] | 99 | the <code>gcc/testsuite/go.go-torture</code> |
Ian Lance Taylor | 253c139 | 2012-02-18 11:15:52 -0800 | [diff] [blame] | 100 | or <code>gcc/testsuite/go.dg</code> directories in the GCC repository. |
Ian Lance Taylor | 2528f33 | 2009-11-06 14:15:41 -0800 | [diff] [blame] | 101 | </p> |
| 102 | |
| 103 | <h2>Submitting Changes</h2> |
| 104 | |
| 105 | <p> |
Ian Lance Taylor | 8653acb | 2010-01-29 16:37:20 -0800 | [diff] [blame] | 106 | Changes to the Go frontend should follow the same process as for the |
Shenghou Ma | d251fc3 | 2013-02-19 19:20:44 +0800 | [diff] [blame] | 107 | main Go repository, only for the <code>gofrontend</code> project and |
Emil Hessman | ddb24da | 2014-12-19 08:37:52 +0100 | [diff] [blame] | 108 | the <code>gofrontend-dev@googlegroups.com</code> mailing list |
Shenghou Ma | d251fc3 | 2013-02-19 19:20:44 +0800 | [diff] [blame] | 109 | rather than the <code>go</code> project and the |
| 110 | <code>golang-dev@googlegroups.com</code> mailing list. Those changes |
| 111 | will then be merged into the GCC sources. |
Ian Lance Taylor | 2528f33 | 2009-11-06 14:15:41 -0800 | [diff] [blame] | 112 | </p> |