The trials and tribulations of adding a new port to GCC: Free software at its very best

Jeremy Bennett
gcc

My colleague, Jörn Rennecke, has just had his port of the GNU Compiler Collection for the Synopsys ARC processor family reviewed and accepted into the FSF mainline.

Actually, to describe it as “Jörn’s port” is unfair. This is a free and open source project which is the culmination of more than a decade’s work by many engineers, including the late Brendan Kehoe. Jörn Rennecke, while probably now the largest contributor, is just the latest to work on the project, and the port maintainer who saw the project into the FSF mainline.

But it is not just the people who wrote the code we have to thank. GCC is a huge and very old program. Around 5 million lines of code, written over 26 years and supporting approximately 40 different architectures in its official release. Compiler development is one of the most complex branches of computer science, and GCC is one of the most complex (the most complex?) compilers out there.

Keeping such a venerable body of code working is not easy. GCC has to impose a strict discipline, not just on the coding standards, but on the algorithmic approaches used in any new port. Anything else and the project would just collapse in a big smelly heap of unmaintainable code. So, when a new port is submitted it has to be reviewed by someone. That’s hard. The number of people with the detailed knowledge of GCC capable of reviewing a new port is very small. In fact it is currently a team of just 16 people, and most of them, being some of the world’s top compiler experts, also have demanding day jobs. The Synopsys ARC is a configurable processor, which makes its compiler more complex than the average. So in this case there was a megabyte of source code to be gone through by the reviewer.

The GCC community regularly beats itself up over this bottleneck. There is a strong aspiration to encourage new participants in this project, and a recognition that reviewing is a bottleneck. Jörn first submitted his work in October 2012, and an initial review led to some significant changes and resubmissions. That’s the point of review: to improve the code. But then things languished, as GCC went through the release cycle for version 4.8 in the spring of 2013, and the port had to be updated to fit with what will become the GCC 4.9 code base.

Had Jörn’s code continued to sit there without being reviewed, this would have not been a happy story. But this week we saw how a robust engineering community works. On Monday, I emailed the mailing list — I’m not usually a GCC contributor — pointing out that Jörn’s code was languishing waiting for review so it could be accepted, and asking for help. The response was quick. Within 48 hours one of the global reviewers had been able to complete a review and the ARC port is now part of the FSF mainline and will be part of the future 4.9 release.

It is a sign of a strong free and open source project that its members can react like this. In this case, even in a 30-year old project, they had the flexibility to recongize that this was a port that had been through initial review, was being submitted by a very experienced contributor (Jörn Rennecke) and had also been partly written by a very highly regarded engineer (Brendan Kehoe). The senior members of the project also recognize the importance of their active participation, so that one of their number was willing to make time to carry out the final review. The result: GCC now has yet another architecture in the distribution.

GCC is certainly not the easiest free and open source project to contribute to. It is big and it is complex and to succeed you will need patience and determination. But if you supply those, you will be rewarded.

signature-jeremy-blog

Leave a Reply