LWN.net Logo

Clang builds a working 2.6.36 Kernel

Clang builds a working 2.6.36 Kernel

Posted Oct 26, 2010 12:54 UTC (Tue) by clugstj (subscriber, #4020)
Parent article: Clang builds a working 2.6.36 Kernel

Seems like a strange goal. The Linux kernel is not what I'd call standards-compliant code. I would think that standards-compliance would be a useful goal for a compiler. And I fail to see why it is so important. And why it warrants at the very least, extreme exaggeration. The title of the message is false:

"Clang can now compile a functional Linux Kernel (version 2.6.36, SMP)."

No, it cannot, if you need to compile certain modules w/ GCC in order to get it to boot. Unless you don't consider booting to be something a kernel must do to be "functional".


(Log in to post comments)

Clang builds a working 2.6.36 Kernel

Posted Oct 26, 2010 14:27 UTC (Tue) by mpr22 (subscriber, #60784) [Link]

It seems to me that a compiler that won't build the Linux kernel probably wouldn't even get considered as the default compiler for a Linux distribution, while a compiler that will build the kernel might.

Clang builds a working 2.6.36 Kernel

Posted Oct 26, 2010 14:58 UTC (Tue) by oak (subscriber, #2786) [Link]

According to latest mail by Bryce this morning:
http://lists.cs.uiuc.edu/pipermail/cfe-dev/2010-October/0...

Many of the issues listed in above article are already handled, and GCC isn't anymore needed:
"GCC is no longer needed at all during the build process. GNU ld is still needed; GNU's assembler is not. Linux successfully compiles with the integrated-assembler."

Clang builds a working 2.6.36 Kernel

Posted Oct 26, 2010 16:02 UTC (Tue) by ewan (subscriber, #5533) [Link]

Yup. Can't imagine anyone ever shipping a distribution that requires a special copy of GCC just for the kernel, I mean, what would you call it- 'kgcc' or something?

Hard to see if it was sarcasm or not...

Posted Oct 26, 2010 22:22 UTC (Tue) by khim (subscriber, #9252) [Link]

If you are being sarcastic then please use "<sarcasm>" tag in the future...

And if it was not sarcasm then I want to remind you that RedHat did exactly that in version 7.x (and yes, package was called kgcc).

Hard to see if it was sarcasm or not...

Posted Oct 27, 2010 17:03 UTC (Wed) by chad.netzer (✭ supporter ✭, #4257) [Link]

Maybe for sarcasm, we should instead use the <blink> tag. :)

Hard to see if it was sarcasm or not...

Posted Nov 6, 2010 3:12 UTC (Sat) by efexis (guest, #26355) [Link]

Surely if it's sarcasm it should just be a <wink> tag rather than a <blink> tag? ;-)

Clang builds a working 2.6.36 Kernel

Posted Oct 26, 2010 14:57 UTC (Tue) by wash (guest, #70825) [Link]

No offense, but I'm not really interested in your opinion. This is a project I am working on in my spare time; I made a post about it to a development list. Parties unknown to me (who obviously felt it was of some significance - note that I do not particularly agree with them, as this is just one of many milestones Clang has recently passed) decided to publicize this.

A lot of people have put many hours of work into getting Clang to this stage. I am not one of them; I'm relatively new to the Clang community. In particular, Alp Toker from Nuanti and his team should be recognized for all the work they've been doing on this.

Anyways, the Linux Kernel can now be built entirely by Clang. Loadable modules work, the crypto and network stacks are fully functional, and SELinux is supported. I am now building with the Clang integrated assembler; the only part of the GNU toolchain still involved in the process is the GNU linker. I have been unable to find any other linker (which is not derived from GNU's), so for now, this toolchain will use ld.

The version source code for my local copies of Clang/LLVM and Linux will be put up on Github later this week, as well as instructions for building.

Clang builds a working 2.6.36 Kernel

Posted Oct 26, 2010 15:33 UTC (Tue) by loevborg (guest, #51779) [Link]

FWIW I thought this piece was newsworthy and interesting. Thanks for your impressive work with clang!

Clang builds a working 2.6.36 Kernel

Posted Oct 26, 2010 15:55 UTC (Tue) by jwakely (subscriber, #60262) [Link]

the obvious other linker to try is gold, although of course that's part of GNU binutils too ... there is a reason why people call it GNU/Linux, y'know ;)

Clang builds a working 2.6.36 Kernel

Posted Oct 26, 2010 16:53 UTC (Tue) by MisterIO (guest, #36192) [Link]

Isn't gold still unable to link usable kernels? Or is it just something that debian folks have fun writing?:)

Clang builds a working 2.6.36 Kernel

Posted Oct 26, 2010 18:34 UTC (Tue) by rriggs (subscriber, #11598) [Link]

Clang builds a working 2.6.36 Kernel

Posted Oct 26, 2010 17:05 UTC (Tue) by nteon (subscriber, #53899) [Link]

As of a couple of months ago, gold was unable to link a working kernel for me. Seems to still be the case: http://fedoraproject.org/wiki/Features/GoldLinkerDefault

Clang builds a working 2.6.36 Kernel

Posted Oct 27, 2010 4:29 UTC (Wed) by Lefty (guest, #51528) [Link]

I agree that this is both interesting and newsworthy. Clang is making excellent progress, and this is a very significant milestone.

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds