Linked by Thom Holwerda on Tue 26th Oct 2010 20:36 UTC, submitted by tyrione
Linux Clang can build a kernel now. "The kernel can successfully boot to runlevel 5 (aka X + networking) on the Macbook, both on bare metal and in Qemu. The kernel can successfully boot to runlevel 3 on a secondary test machine, a microATX desktop box (Intel Atom). I haven't tried to start X on this box yet. The kernel can self-host; I am currently running a 'fourth generation' self-hosted Linux kernel built by a 'fourth generation' Clang."
Thread beginning with comment 447260
To read all comments associated with this story, please click here.
What is Clang?
by John Blink on Tue 26th Oct 2010 23:06 UTC
John Blink
Member since:
2005-10-11

http://clang.llvm.org/index.html

What is LLVM? Why does it exist? What technology can it be compared to? What benefit does this have to the linux kernel?

Okay I started this post as an idiot. But I would like to know what this LLVM business is.

Reply Score: 4

RE: What is Clang?
by ChoK on Wed 27th Oct 2010 00:50 in reply to "What is Clang?"
ChoK Member since:
2010-06-02

LLVM is part of a compiler infrastructure which works like that

front-end (llvm-gcc, dragonegg, clang) --> Intermediate form (LLVM optimize this) --> Assembly code (x86, arm ..)

LLVM was started as a university research project, Apple then funded this because the switch from GPLv2 to GPLv3 in the gcc project.

The main benefits of llvm for now is the very fast compilation speed (15min for the kernel) and the error reporting which is excellent.

Reply Parent Score: 3

RE[2]: What is Clang?
by kaiwai on Wed 27th Oct 2010 07:55 in reply to "RE: What is Clang?"
kaiwai Member since:
2005-07-06

LLVM is part of a compiler infrastructure which works like that

front-end (llvm-gcc, dragonegg, clang) --> Intermediate form (LLVM optimize this) --> Assembly code (x86, arm ..)

LLVM was started as a university research project, Apple then funded this because the switch from GPLv2 to GPLv3 in the gcc project.

The main benefits of llvm for now is the very fast compilation speed (15min for the kernel) and the error reporting which is excellent.


It had less to do with the move from GPL2 to GPL3, it had to do with Apple wanting heavier integration between the compiler and the IDE so that they could provide the sort of debugging that one see's in the likes of Visual Studio. That sort of debugging needs heavy integration between the two and unfortunately it would be a violation of the GPL licence to which GCC is licenced under if Apple linked their proprietary application to GCC.

There are a load of other benefits that have been mentioned in previous conferences they've held - so it is more than just a matter of simply a response to GCC moving from GPL2 to GPL3. On a side note, there has always been a matter of friction between GCC maintainers and Apple in regards to how changes were merged back in. Now that Apple controls the development of LLVM it means it gives them more freedom or when and how they merge changes.

Reply Parent Score: 2

RE: What is Clang?
by bebop on Wed 27th Oct 2010 00:54 in reply to "What is Clang?"
bebop Member since:
2009-05-12

LLVM is a low level virtual machine (hence the name), it is in the simplest form a compiler back-end. This means that it takes code that is parsed from a language (C, C++, whatever) and converts it to a program the computer can read (or an interpreter for that matter).

Clang is the front-end for the c, c++ and objective-c/c++ languages. The combination of LLVM and Clang is equivalent to GCC with the various front-ends for the languages stated above.

Why it exists? Why does anything exist? philosophy aside, basically LLVM is supposed to be more modular than GCC, and LLVM is licensed under the BSD, while GCC is GLP.

The reason that this is interesting is because the Linux kernel has been written with the GCC compiler from the start. Being able to compile, not to mention have the code run somewhat correctly, is a milestone because software like kernels ask a lot out of compilers. Also different compilers may be able to point out problems that were not seen before.

The last thing is that because both compilers conform to an ansi spec, making sure that the kernel builds with both compilers gives better assurance that the kernel code complies with the ansi standard, which cannot hurt.

Reply Parent Score: 5

RE: What is Clang?
by thavith_osn on Wed 27th Oct 2010 00:54 in reply to "What is Clang?"
thavith_osn Member since:
2005-07-11

This is a great starting point
http://llvm.org/

I really want to have a go at creating my own little language for the hang of it, but time does not permit right now. Basically I could write a compiler for a new language that could be built on any number of platforms.

Nice...

Clang is an example of an app build using LLVM...

Reply Parent Score: 2

RE[2]: What is Clang?
by GeneralZod on Wed 27th Oct 2010 07:37 in reply to "RE: What is Clang?"
GeneralZod Member since:
2007-08-03

There's an awesome little example of this here:

http://llvm.org/docs/tutorial/

Reply Parent Score: 2

RE: What is Clang?
by draethus on Wed 27th Oct 2010 07:25 in reply to "What is Clang?"
draethus Member since:
2006-08-02

It can be compared to a JVM for C. Just like Java code runs on any platform with a JVM, C/C++ code can be compiled (with clang or others) into LLVM bytecode that can be run on any platform.

Reply Parent Score: 1