Custom Search

Tuesday, March 27, 2012

The Compiler That Changed the World Turns 25

Last year, Linux celebrated its 20th anniversary. The kernel that Linus Torvalds started as a hobby project helped the Internet bloom, challenged proprietary operating system dominance, and powers hundreds of millions of devices. From hacker toys like the dirt-cheap Raspberry Pi to most of the Top 500 Supercomputers, Linux dominates the computing industry. But it wouldn't have been possible without GCC, which turns 25 today.

Before Torvalds started hacking away on Linux, Richard Stallman and started the GNU (GNU's Not UNIX) project and part of that was the GNU C Compiler (GCC). Eventually that became the GNU Compiler Collection (also GCC) but we're getting a little ahead of the story.

A Short History of GCC and Linux

The origin of GCC actually started in the free C compiler that Stallman started in 1984, based on a multi-platform compiler developed at Lawrence Livermore Lab. Says Stallman, "It supported, and was written in, an extended version of Pascal, designed to be a system-programming language. I added a C front end, and began porting it to the Motorola 68000 computer. But I had to give that up when I discovered that the compiler needed many megabytes of stack space, and the available 68000 Unix system would only allow 64k.

"I then realized that the Pastel compiler functioned by parsing the entire input file into a syntax tree, converting the whole syntax tree into a chain of "instructions", and then generating the whole output file, without ever freeing any storage. At this point, I concluded I would have to write a new compiler from scratch. That new compiler is now known as GCC; none of the Pastel compiler is used in it, but I managed to adapt and use the C front end that I had written."

For many Linux enthusiasts, GCC has always just been. It's part of the landscape, and kind of taken for granted. But it wasn't always this way. Michael Tiemann, now vice president of open source affairs at Red Hat and the founder of Cygnus Solutions, called GCC's intro in 1987 a "bombshell."

"I downloaded it immediately, and I used all the tricks I'd read about in the Emacs and GDB manuals to quickly learn its 110,000 lines of code. Stallman's compiler supported two platforms in its first release: the venerable VAX and the new Sun3 workstation. It handily generated better code on these platforms than the respective vendors' compilers could muster... Compilers, Debuggers, and Editors are the Big 3 tools that programmers use on a day-to-day basis. GCC, GDB, and Emacs were so profoundly better than the proprietary alternatives, I could not help but think about how much money (not to mention economic benefit) there would be in replacing proprietary technology with technology that was not only better, but also getting better faster."

By the time Torvalds started working on Linux, GCC had quite a history of releases. The first release was 0.9, the first beta release, on March 22, 1987. It had 48 releases between the 0.9 release and 1.40, which came out on June 1, 1991. Torvalds announced that he was working on Linux in July 1991, using Minix and GCC 1.40.

The EGCS Years

As Tiemann notes later, GCC development started falling behind a bit. Some folks got a bit impatient with the GCC development process and speed of getting features to users. GCC had a number of forks in the wild with patches that hadn't made it into GCC. That led to the EGCS project, a fork of a GCC development snapshot from August 1997.

Eventually, in April 1999, EGCS became the official GCC, and GCC took on the "GNU Compiler Collection" moniker.

New in GCC 4.7

I won't try to summarize all of the development and features that have been part of GCC from 1999 to now. Suffice it to say, a lot has happened and GCC has been at the heart of more than Linux.

GCC has also been used by FreeBSD, NetBSD, and OpenBSD as well as part of Apple's XCode tools until very recently. (That's another story for another day...) If it's hard to imagine a world without Linux, it's even harder to imagine a world without the compiler that's been used to build Linux for more than 20 years.

So it's appropriate that the 25th anniversary release of GCC brings quite a bit of goodies for developers. According to Richard Guenther, 4.7 is a "major release, containing substantial new functionality not available in GCC 4.6.x or previous GCC releases."

Says Guenther, GCC 4.7 picks up support for newer standards for C++, C, and Fortran. "The C++ compiler supports a bigger subset of the new ISO C++11 standard such as support for atomics and the C++11 memory model, non-static data member initializers, user-defined literals, alias-declarations, delegating constructors, explicit override and extended friend syntax. The C compiler adds support for more features from the new ISO C11 standard. GCC now supports version 3.1 of the OpenMP specification for C, C++ and Fortran."

GCC also expands its hardware support, with new support for Intel's Haswell and AMD's Piledriver (both x86) architectures. It also adds support for the Cortex-A7 (ARM) line of processors, and for a number of others. Check out the full list of change for 4.7 if you're interested.

For fun and added points, check out this video on YouTube that visualizes 20 years of GCC development. It uses Gource to visualize the history of GCC development.

A big tip of the hat to the GCC team, present, past, and future. Without it, where would we be now?


This post was made using the Auto Blogging Software from WebMagnates.org This line will not appear when posts are made after activating the software to full version.

No comments:

Post a Comment