3

I know that the linux kernel specifies minimal compilation requirements, but I haven't found any source of information regarding how distros/vendors choose which version of GCC to use when compiling the linux kernel.

For example how do Debian maintainers decide which version of GCC to use? Or how do mobile chipset vendors such as Qualcomm or Samsung choose when building Linux for a chipset that supports Android?

  • Well... don't expect too much from them. They have a build system, which is developed with their main product concurrently, and its latest stable gcc is the one used for the kernel build. – peterh Jan 14 at 19:30
  • @peterh many distributions track the version of GCC used for the kernel independently of the version of GCC used for the rest of the system (although ideally they’re identical). For example, Debian switched its default GCC to 8 in July, but the kernel only switched to 8 on all architectures in September. – Stephen Kitt Jan 14 at 20:01
4

I'm not a kernel developer, and don't have an authoritative answer, but here's my take on this:

  • New distributions are likely to incorporate the latest stable GCC version available, since it usually provides the most value (in terms of language support, features, diagnostics and optimizations).
  • Maintainers are likely to use the distribution default GCC for building packages, which is to the best interest of the distribution since it's provides uniformity and stability (all use the same, tried and tested default GCC version).
  • Chip vendors will usually rely on their properitary or ported GCC compilers. It doesn't make sense to maintain more than one compiler in-house (effort and cost wise), and the same compiler is probably used by the customers of the chip vendors (SoC vendors, or software houses that build S/W for these chips), so it's the best interest of the company to use the highest GCC version supported by the kernel.
  • Compilers are backward compatible, and very rarely GCC would introduce a breaking interface change (leave aside ABI changes such as C++98 to C++11), so it is almost always desirable to use the latest compiler version available. However, there are compiler bugs, too, and newer compiler versions may introduce performance regressions, so upgrading the compiler version may be a big thing and could cause companies to advance their GCC version in a very slow pace (and for chip vendors developing their own compilers, very costly too).

To summarize my two cents: I think Linux maintainers will tend to use the distribution default GCC version, while chip vendors will tend to use the latest GCC version available supporting their target (and that plays well with other components of their system, such as drivers). Hope this makes sense.

On the same issue, I came across this very interesting article from Linux Journal, on the decision making behind which GCC version to use for the kernel, which is well worth a read:
Minimum GCC Version Likely to Jump from 3.2 to 4.8

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.