[cfe-dev] Clang builds a working Linux Kernel (Boots to RL5 with SMP, networking and X, self hosts)

Bryce Lelbach admin at thefireflyproject.us
Tue Oct 26 09:35:28 CDT 2010

Hash: SHA1

>   * 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.

Tested this box with the latest changes, everything's working well :). 

>   * SELinux, Posix ACLs, IPSec, eCrypt, anything that uses the crypto API -
> None of these will compile, due to either an ICE or variable-length arrays in
>     structures (don't remember which, it's in my notes somewhere). If it's
>     variable-length arrays or another intentionally unsupported GNUtension,
> I'm hoping it's just used in some isolated implementation detail (or details),
>     and not a fundamental part of the crypto API (honestly just haven't had a
>     chance to dive into the crypto source yet). I'm really hoping it's an
> issue in Clang, though, as it's easier for me to hack Clang and I'm trying to
>     avoid kernel patches as much as possible.

Most of SELinux compiles. POSIX ACLs, IPSec and eCrypt are all fully functional.

>   * IPv6 and Netfilters/Router stuff - Some of this is tied to the above
> issues with the crypto API, but IPv6 and Netfilters each have their own fatal
>     errors. 

Clang can now compile the complete Linux network stack.

>   * VDSO - VDSO breaks in strange ways with clang, at least, it did a week ago
>     when I put some time into investigating this. ATM, building VDSO with GCC
>     works, but I believe that this is still causing issues. I think the issue
>     here is similiar in nature to the issue with LKMs. 

VDSO compiles with Clang.
>   * Boot - The very early kernel boot code breaks with clang, because of
> obscure inline assembly GNUtensions (.code16gcc stuff). I have no clue what
> needs to be done to fix this, but as I actually know where this problem is,
> it should be (relatively) easy to fix.

The boot subsystem can be built with Clang.

>   * Modules - Module loading is totally broken. I'm pretty sure I just figured
>     out why, though (I'd elaborate, but this is pretty lengthy, and I might as
>     well just go implement it).

Loadable kernel modules are functional.

Also, SMP issues have been dealt with. I've found a number of suitable unit-/
conformance-/functionality-/performance-/stress- tests which I intend to run on
the latest Clang-compiled kernel, and GCC-compiled kernel with the same

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.

Question: Are there any open source linkers out there aside from GNU ld, that
aren't derived from GNU ld? I don't have anything against GNU ld, I'm just
curious about other options. 

- -- 
Bryce Lelbach aka wash
Version: GnuPG v1.4.9 (GNU/Linux)


More information about the cfe-dev mailing list