Home | History | Annotate | Download | only in doc
      1 <!--{
      2 	"Title": "Contributing to the gccgo frontend"
      3 }-->
      4 
      5 <h2>Introduction</h2>
      6 
      7 <p>
      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,
     10 see <a href="/doc/contribute.html">Contributing to the Go project</a>.  For
     11 information on building gccgo for yourself,
     12 see <a href="/doc/gccgo_install.html">Setting up and using gccgo</a>.
     13 For more of the gritty details on the process of doing development
     14 with the gccgo frontend,
     15 see <a href="https://go.googlesource.com/gofrontend/+/master/HACKING">the
     16 file HACKING</a> in the gofrontend repository.
     17 </p>
     18 
     19 <h2>Legal Prerequisites</h2>
     20 
     21 <p>
     22 You must follow the <a href="/doc/contribute.html#copyright">Go copyright
     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>.
     27 </p>
     28 
     29 <h2>Code</h2>
     30 
     31 <p>
     32 The master sources for the gccgo frontend may be found at
     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>.
     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
     45 from <a href="//go.googlesource.com/go">the main Go repository</a>
     46 is mirrored to the <code>gcc/testsuite/go.test/test</code> directory
     47 in the GCC repository.
     48 </p>
     49 
     50 <p>
     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>
     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.
     64 </p>
     65 
     66 <p>
     67 The run-time library for gccgo is mostly the same as the library
     68 in <a href="//go.googlesource.com/go">the main Go repository</a>.
     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
     76 in <code>src/runtime</code> in the main Go repository.
     77 </p>
     78 
     79 <h2>Testing</h2>
     80 
     81 <p>
     82 All patches must be tested.  A patch that introduces new failures is
     83 not acceptable.
     84 </p>
     85 
     86 <p>
     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
     91 main Go repository is run using the DejaGNU script found
     92 in <code>gcc/testsuite/go.test/go-test.exp</code>.
     93 </p>
     94 
     95 <p>
     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
     99 the <code>gcc/testsuite/go.go-torture</code>
    100 or <code>gcc/testsuite/go.dg</code> directories in the GCC repository.
    101 </p>
    102 
    103 <h2>Submitting Changes</h2>
    104 
    105 <p>
    106 Changes to the Go frontend should follow the same process as for the
    107 main Go repository, only for the <code>gofrontend</code> project and
    108 the <code>gofrontend-dev (a] googlegroups.com</code> mailing list 
    109 rather than the <code>go</code> project and the
    110 <code>golang-dev (a] googlegroups.com</code> mailing list.  Those changes
    111 will then be merged into the GCC sources.
    112 </p>
    113