On related note, how much progress has been on LLVM to compile Linux?
I remember hearing attempts to make LLVM compile Linux before.
I know GCC is much faster than LLVM.
But what is the status of Linux on LLVM?
Phoronix: Link-Time Optimization To Speed Up The Linux Kernel
An extensive set of patches have been published that allow the Linux kernel to be built with GCC's LTO (Link-Time Optimization) support for generating a faster Linux kernel binary but at the cost of much greater compile times...
http://www.phoronix.com/vr.php?view=MTE2MzY
On related note, how much progress has been on LLVM to compile Linux?
I remember hearing attempts to make LLVM compile Linux before.
I know GCC is much faster than LLVM.
But what is the status of Linux on LLVM?
Very nice, I'd like to see this in.
OTOH, I recall Denys Vlasenko's similar patchset earlier to enable the kernel to build with -ffunction-sections -fdata-sections (resulting in 10-15% smaller binary) was not merged.
Afaik LLVM is mostly driven by Apple and Apple has no interest in making LLVM build the Linux kernel.
Since Linux uses GCC specific behavior I'd expect LLVM to take several years (if ever) until it's good enough to be used by default mainstream.
The need for a new compiler for Linux is exaggerated and over-appreciated (like Facebook hehe), GCC is good enough and improving (being cleaned up, moving to C++, LTO).
Well, that's interesting. Once this gets implemented, it will be awesome news for slow devices on Gentoo using distcc. Also, you could compile a kernel normally, see if it works out right, and then in spare time compile it with the optimizations. I just wonder how much difference they'll make.
https://aur.archlinux.org/packages.php?ID=45733
People have been messing around with the LLVM + linux kernel combo for a long time via the work done at the University of Illinois...
There also happens to be this project, that consolidates that work (the lll work) and others;
http://llvm.linuxfoundation.org/index.php/Main_Page
it doesn't require Apple's blessing, nor them to do the work in order for LLVM to build the kernel. They also don't happen to be the only company/party using LLVM, nor the only company/party contributing to CLang/LLVM. What it actually requires is people hacking on code (both Linux kernel and Clang/LLVM code), fixing issues and then submitting their patches upstream to both projects,
Last edited by ninez; 08-19-2012 at 12:23 PM.
But there have been attempts to make Linux compile under LLVM (or was it Intel C Compiler?).
Someone managed to compile parts of it, not all, and maybe with some patches.
Some people in the Linux community are interested in seeing Linux compile under LLVM, because it is argued that having Linux compile under many compilers will improve code quality.
Isn't GCC-specific behavior bad?
Shouldn't it be ANSI/ISO-compatible?
Yeah, I know. GCC is much faster than LLVM.
But would be nice if Linux compiled cleanly with several compilers.
I'd like to see someone try compile Linux with;
* GCC
* Microsoft Compiler
* LLVM / Clang / DragonEgg
* PCC, TCC
* Intel C Compiler
* Open64
Out of those, i personally have used GCC (obviously), ICC (intel C compiler) and Clang/LLVM (using the lll-project listed above) to successfully compile the linux kernel.
I think i may have also tried Open64 5.0 but it failed. The rest i have not tried but would assume they would all fail OOTB.
Hi,
Debian already have plans to switch to LLVM and Gentoo is talking about. The big isssue seems the GNU useland.
Gentoo Forum
Gentoo BugTracker
Debian Package Rebuild
![]()
For portability between compilers, yes. However this is the result of the kernel using compiler extensions which allow a much higher degree of control regarding the generated code, resulting in much better efficiency than letting the compiler do it's guess-work.
Also since many of these GCC compiler extensions were added at the direct request of the kernel developers there's little chance they would decide to suddenly go without them. Also the Linux kernel devs are very performance oriented and I doubt they would forego any efficiency in order to ease porting to other compiler toolchains.
While perfect portability between compilers would be nice, it's really not much of a practical problem since GCC is ported to everything. Also giving up efficiency of generated code in order to have it compiling with compiler X is likely not something end-users would find attractive either.
And then there's nothing preventing other compilers from supporting said extensions, and for the record all compilers supports a variety of compiler extensions, some are cross-supported and some are exclusive.