Navegación de entradas

Minimum GCC Version Likely to Jump from 3.2 to 4.8

The question of the earliest GCC compiler version to support for building the
Linux kernel comes up periodically. The ideal would be for Linux to compile
under all GCC versions, because you never know what kind of system someone is
running. Maybe their company's security team has to approve all software
upgrades for their highly sensitive devices, and GCC is low on that list.
Maybe they need to save as much space as possible, and recent versions of GCC
are too big. There are all sorts of reasons why someone might be stuck with
old software. But, they may need the latest Linux kernel because it's the
foundation of their entire product, so they're stuck trying to compile it
with an old compiler.

However, Linux can't really support every single GCC version. Sometimes the GCC
people and the kernel people have disagreed on the manner in which GCC should
produce code. Sometimes this means that the kernel really doesn't compile
well on a particular version of GCC. So, there are the occasional project wars
emerging from those conflicts. The GCC people will say the compiler is doing
the best thing possible, and the kernel people will say the compiler is messing up
their code. Sometimes the GCC people change the behavior in a later release,
but that still leaves a particular GCC version that makes bad Linux code.

So, the kernel people will decide programmatically to exclude a particular
version of GCC from being used to compile the kernel. Any attempt to use that
compiler on kernel code will produce an error.

But, sometimes the GCC people will add a new language feature that is so
useful, the kernel will people decide to rely heavily on it in their source code.
In that case, there may be a period of time where the kernel people maintain
one branch of code for the newer, better compiler, and a separate, less-fast
or more-complex branch of code for the older, worse compiler. In that case,
the kernel people—or really Linus
Torvalds—eventually may decide to
stop supporting compilers older than a certain version, so they can rip out
all those less-fast and more-complex branches of code.

For similar reasons, it's also just an easier maintenance task for the kernel
folks to drop support for older compilers; so this is something they would
always prefer to do, if possible.

But, it's a big decision, typically weighed against the estimated number of
users that are unable to upgrade their compilers. Linus really does not want
even one regular (that is, non-kernel-developer) user to be unable
to build Linux because of this sort of decision. He's willing to let the
kernel carry a lot of fairly dead and/or hard-to-maintain code in order to
keep that from happening.