1
0

gccgo_contribute.html 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <!--{
  2. "Title": "Contributing to the gccgo frontend"
  3. }-->
  4. <h2>Introduction</h2>
  5. <p>
  6. These are some notes on contributing to the gccgo frontend for GCC.
  7. For information on contributing to parts of Go other than gccgo,
  8. see <a href="/doc/contribute.html">Contributing to the Go project</a>. For
  9. information on building gccgo for yourself,
  10. see <a href="/doc/gccgo_install.html">Setting up and using gccgo</a>.
  11. For more of the gritty details on the process of doing development
  12. with the gccgo frontend,
  13. see <a href="https://go.googlesource.com/gofrontend/+/master/HACKING">the
  14. file HACKING</a> in the gofrontend repository.
  15. </p>
  16. <h2>Legal Prerequisites</h2>
  17. <p>
  18. You must follow the <a href="/doc/contribute.html#copyright">Go copyright
  19. rules</a> for all changes to the gccgo frontend and the associated
  20. libgo library. Code that is part of GCC rather than gccgo must follow
  21. the general <a href="http://gcc.gnu.org/contribute.html">GCC
  22. contribution rules</a>.
  23. </p>
  24. <h2>Code</h2>
  25. <p>
  26. The master sources for the gccgo frontend may be found at
  27. <a href="http://go.googlesource.com/gofrontend">http://go.googlesource.com/gofrontend</a>.
  28. They are mirrored
  29. at <a href="http://github.com/golang/gofrontend">http://github.com/golang/gofrontend</a>.
  30. The master sources are not buildable by themselves, but only in
  31. conjunction with GCC (in the future, other compilers may be
  32. supported). Changes made to the gccgo frontend are also applied to
  33. the GCC source code repository hosted at <code>gcc.gnu.org</code>. In
  34. the <code>gofrontend</code> repository, the <code>go</code> directory
  35. is mirrored to the <code>gcc/go/gofrontend</code> directory in the GCC
  36. repository, and the <code>gofrontend</code> <code>libgo</code>
  37. directory is mirrored to the GCC <code>libgo</code> directory. In
  38. addition, the <code>test</code> directory
  39. from <a href="//go.googlesource.com/go">the main Go repository</a>
  40. is mirrored to the <code>gcc/testsuite/go.test/test</code> directory
  41. in the GCC repository.
  42. </p>
  43. <p>
  44. Changes to these directories always flow from the master sources to
  45. the GCC repository. The files should never be changed in the GCC
  46. repository except by changing them in the master sources and mirroring
  47. them.
  48. </p>
  49. <p>
  50. The gccgo frontend is written in C++.
  51. It follows the GNU and GCC coding standards for C++.
  52. In writing code for the frontend, follow the formatting of the
  53. surrounding code.
  54. Almost all GCC-specific code is not in the frontend proper and is
  55. instead in the GCC sources in the <code>gcc/go</code> directory.
  56. </p>
  57. <p>
  58. The run-time library for gccgo is mostly the same as the library
  59. in <a href="//go.googlesource.com/go">the main Go repository</a>.
  60. The library code in the Go repository is periodically merged into
  61. the <code>libgo/go</code> directory of the <code>gofrontend</code> and
  62. then the GCC repositories, using the shell
  63. script <code>libgo/merge.sh</code>. Accordingly, most library changes
  64. should be made in the main Go repository. The files outside
  65. of <code>libgo/go</code> are gccgo-specific; that said, some of the
  66. files in <code>libgo/runtime</code> are based on files
  67. in <code>src/runtime</code> in the main Go repository.
  68. </p>
  69. <h2>Testing</h2>
  70. <p>
  71. All patches must be tested. A patch that introduces new failures is
  72. not acceptable.
  73. </p>
  74. <p>
  75. To run the gccgo test suite, run <code>make check-go</code> in your
  76. build directory. This will run various tests
  77. under <code>gcc/testsuite/go.*</code> and will also run
  78. the <code>libgo</code> testsuite. This copy of the tests from the
  79. main Go repository is run using the DejaGNU script found
  80. in <code>gcc/testsuite/go.test/go-test.exp</code>.
  81. </p>
  82. <p>
  83. Most new tests should be submitted to the main Go repository for later
  84. mirroring into the GCC repository. If there is a need for specific
  85. tests for gccgo, they should go in
  86. the <code>gcc/testsuite/go.go-torture</code>
  87. or <code>gcc/testsuite/go.dg</code> directories in the GCC repository.
  88. </p>
  89. <h2>Submitting Changes</h2>
  90. <p>
  91. Changes to the Go frontend should follow the same process as for the
  92. main Go repository, only for the <code>gofrontend</code> project and
  93. the <code>gofrontend-dev@googlegroups.com</code> mailing list
  94. rather than the <code>go</code> project and the
  95. <code>golang-dev@googlegroups.com</code> mailing list. Those changes
  96. will then be merged into the GCC sources.
  97. </p>