How To Contribute To The GNU Binutils
Everyone is free to contribute to the GNU Binutils project. You do not need to be a coder to contribute. There are lots of ways to help:
- Documentation
- The GNU Binutils documentation is intended to helpful and complete. But it does not always achieve this goal. So pointing out places where the text is incomplete, confusing or just plain wrong are welcome. Providing replacement or new text is even more welcome!
- Translations
The Translation Project is always looking for volunteers to help translate the messages in open source programs into other languages. The GNU Binutils uses this project to generate the translations for its warning and error messages, so help here is always appreciated.
- Questions
Asking questions about the Binutils is always encouraged. There is no such thing as a bad question. So please ask any question you like by sending emails to the binutils@sourceware.org mailing list.
- Patch Reviews
- Patch submissions are public and anyone can post reviews of patches if they want to do so. It is also totally OK to ask questions about a patch - how it works, what it does in special circumstances, and so on.
Please note that the GNU Binutils does have a Code of Conduct which amongst other things covers the tone of language used in emails.
- Patch submissions are public and anyone can post reviews of patches if they want to do so. It is also totally OK to ask questions about a patch - how it works, what it does in special circumstances, and so on.
- Bug Reports
It is the nature of software to contain bugs, and the GNU Binutils is no exception. If you do encounter a bug, please do report it. Bugs can be reported by email, but it is preferred if they are entered into the Bug Reporting System. When submitting a bug report please include as much information as possible. In particular a way to reproduce the bug, the version of the binutils that was tested and shown to contain the bug and the target(s) for which the binutils were built. If you have a proposed fix for the problem please include that as well.
Please note that the GNU Binutils has a SECURITY.txt file which describes the criteria used for determining if a bug report is serious enough to be considered to be a security issue.
- Bug Fixes
- Even better than reporting bugs is fixing the ones that have already been found. The bug reporting system mentioned above can be queried to find open binutils bugs. Alternatively if you find a bug then creating a fix for it before reporting it is a greatly appreciated. See the section on 'Writing Patches and New Code' below for more details on creating bug fixes.
- Feature Requests
The Bug Reporting System can also be used to post requests for new features to be added to the binutils. Alternatively requests can be made on the binutils mailing list, if that is easier.
- New Features
- The GNU Binutils is a living system and new features are being added all the time. The sections below describe in some detail the steps that need to be followed in order to contribute new code to the binutils.
Writing Patches and New Code
Possibly the most important thing to know about submitting patches and new code is that it is ok to be wrong. Do not let the fear of making a mistake put you off from contributing. We would much rather receive a patch with a few problems to fix than not receive any patch at all.
Please try to follow the GNU Coding Standards when writing your patch. Keeping to a uniform standard helps make the code easier to read. The binutils sources include a .editorconfig file which, if used, should help to follow these guidelines whilst editing your code.
Please test your patch before submitting it. See 'Testing Patches' below.
Patches must be submitted by email to the binutils@sourceware.org mailing list. Whilst this might seem old fashioned, it is the way that the project has evolved. We are working on allowing web based merge requests, but this feature is not yet ready for use.
All patches should be accompanied by a Developers Certificate of Origin unless the author already has a copyright assignment to the FSF in place. See the section on 'Copyright' below for more details.
''Many eyes make better code.''
Please be aware that patch submissions are public and that they will be reviewed by one or more people. It is also likely that reviewers will suggest changes to the patch, or point out bugs or problems that need to be fixed. This is normal. It happens to all patch submissions and it does not mean that the patch is bad or that the writer does not know what they are doing. It is just the nature of open source code. This is also why including a version number with a patch submission is a good idea.
What To Include
The patch should include everything you are changing, including regenerated files.
Changed files should be named in the accompanying email, and if ChangeLog files are being updated, then there too.
A patch which adds a new feature should an entry in the relevant NEWS file(s) as well as documentation in the appropriate texi files.
New testcases to verify that a feature or patch continues to work properly are highly encouraged.
Large patches should ideally be split up into a patch series and submitted as a series of emails.
Including the word [PATCH] in the subject line of the email(s) helps to identify the submission as a patch awaiting review. Including the word RFC in the subject line identifies the submission as a request for comments, indicating that it is intended for discussion and not necessarily submission. Including a version number in the subject line helps to identify patches that are revisions of previous patch submissions.
Testing Patches
There is a pre-commit checking system for patches sent to the binutils mailing list. This can help detect problems before they are checked in.
There is also a post-commit building system that checks that the tools build on various different architectures. See the Buildbot page for more information about this system.
All patches should be tested before they are contributed. At the very least build a version of the binutils with the patch applied and run the assembler, linker and binutils testsuites to verify that nothing has broken.
Committing Patches
With the exception of 'Obvious Fixes' (see below), patches must be approved before they are committed to the repository. The file binutils/MAINTAINERS file in the binutils sources contains a list of maintainers who allowed to approve patches. Target specific maintainers can review and approve patches for their target(s). Global maintainers can approve patches for any part of the binutils.
Once approved a patch must be committed. Anyone with write permission on the git repository can do this.
Write permission on the repository can be granted at the discretion of the global maintainers. If you would like write permission please contact them directly.
Obvious Fixes
Fixes for obvious mistakes do not need approval, and can be checked in right away, but the patch should still be sent to the binutils list. The definition of obvious is a bit hazy, and if you are not sure, then you should seek approval first. Obvious fixes include fixes for spelling mistakes, blatantly incorrect code (where the correct code is also blatantly obvious), and so on. Obvious fixes must always be small as the larger they are, the more likely it is that they contain some un-obvious side effect or consequence.
Obvious fixes should not be ''legally significant''.
Copyright
If a patch is non-obvious, its copyright must be considered. There are two ways to handle this. The first is to assign the copyright of the FSF. This ensures that if problems with the authorship of the patch arise, the FSF will be able to deal with them.
The list of already assigned copyrights can be obtained from fencepost.gnu.org in the file: /gd/gnuorg/copyright.list.
New copyright assignments can be obtained by completing one of these forms and sending it off to the FSF.
The alternative is to sign off the contribution by agreeing to the Developer's Certificate of Origin (version 1.1 or later) and adding a line to the end of the contribution that looks something like this:
Signed-off-by: Random J Developer <random@developer.example.org>
Note - when possible we prefer to have a copyright assignment in place as this means that, if necessary, we can update the license under which the code is distributed. With DCO, the license covering a piece of code can only be updated if the all of the DCO contributors agree.
If a patch is contributed under a DCO and that patch contains a license then that license must be compatible with the licence(s) of the file(s) which are being changed. (Typically this will mean the GPLv3 or the GFDL). The licence will be honored, but the change must include adding the license text to the header at the start of the file(s) affected.
Branch Commits
If a patch is approved for check in to the mainline sources, it can also be checked into the current release branch. Normally however only bug fixes should be applied to the branch. New features, new ports, etc, should be restricted to the mainline. (Otherwise the burden of maintaining the branch in sync with the mainline becomes too great). If you are uncertain as to whether a patch is appropriate for the branch, ask the branch maintainer.
Testsuites
In general patches to any of the binutils testsuites should be considered generic and sent to the binutils mailing list for approval. Patches to target specific tests are the responsibility the relevant port maintainer(s), and can be approved/checked in by them. Other testsuite patches need the approval of a blanket-write-priveleges person.
When adding a new feature to the binutils it is always a good idea to include one or more new tests to check the behaviour of the feature and to make sure that it continues to work in the future. The Binutils use the expect, tcl and dejagnu tools in their testsuite harnesses and writing a new test using them can be daunting at first. There are a couple of online documents that can help, including the Writing a Test Case section of the DejaGNU manual and An introduction to writing DejaGNU tests but as is often the case, the easiest way is to copy and already existing test and modify it for the new circumstances.
Configure patches
Patches to the top level configure files (config.sub & config.guess) are not the domain of the binutils project and they cannot be approved by the binutils group. Instead they should be submitted to the config maintainer at: config-patches@gnu.org
Libiberty patches
The libiberty sources are maintained by the GCC project not the Binutils. Patches for this library should therefore be sent to the gcc-patches@gcc.gnu.org mailing list.
Creating Branches
Anyone with at least write-after-approval access may create a branch to use for their own development purposes. In keeping with FSF policies, all patches applied to such a branch must come from people with appropriate copyright assignments on file. All legal requirements that would apply to any other contribution apply equally to contributions on a branch.
Before creating the branch, you should select a name for the branch of the form:
binutils-<org>-<name>
where "org" is the initials of your organization, or your own initials if you are acting as an individual. For example, for a branch created by The GNUDist Company, "tgc" would be an appropriate choice for "org". It's up to each organization to select an appropriate choice for "name"; some organizations may use more structure than others, so "name" may contain additional hyphens.
Suppose that The GNUDist Company was creating a branch to develop a port of Binutils to the FullMonty processor. Then, an appropriate choice of branch name would be:
binutils-tgc-fm
A date stamp is not required as part of the name field, but some organizations like to have one. If you do include the date, you should follow these rules:
1. The date should be the date that the branch was created.
2. The date should be numerical and in the form YYYYMMDD.
For example:
binutils-tgc-fm_20050101
would be appropriate if the branch was created on January 1st, 2005.
Having selected the branch name, create the branch as follows:
1. Check out binutils, so that you have a git checkout corresponding
- to the initial state of your branch.
2. Create a tag:
git tag binutils-<org>-<name>-branchpoint
- That tag will allow you, and others, to easily determine what's changed on the branch relative to the initial state.
3. Create and push the branch:
git checkout -b binutils-<org>-<name>-branch git push origin HEAD
4. Document the branch:
- Add a description of the branch to binutils/BRANCHES, and check that file in. All branch descriptions should be added to the HEAD revision of the file; it doesn't help to modify binutils/BRANCHES on a branch!
Please do not commit any patches to a branch you did not create without the explicit permission of the person who created the branch.