[go: up one dir, main page]

|
|
Log in / Subscribe / Register

C considered dangerous

C considered dangerous

Posted Aug 30, 2018 13:38 UTC (Thu) by cyrus (subscriber, #36858)
Parent article: C considered dangerous

Clang was frequently mentioned in this article. If I followed the discussions correctly, Clang can successfully compile the kernel for various ARM flavors. The Chromebook Pixel, for instance, is shipped with a Clang-compiled kernel. What's the situation for x86, though? Last I heard the kernel now requires asm-goto for x86 which Clang does not support. What's the status of asm-goto support for Clang? When can we expect that the kernel will "just compile" and the compiled kernel will "just run" on x86?


to post comments

C considered dangerous

Posted Aug 30, 2018 14:33 UTC (Thu) by cesarb (subscriber, #6266) [Link] (1 responses)

The minimum gcc version to compile the kernel has just been raised to 4.6 on all architectures (https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/...), and clang still pretends to be gcc 4.2, so the kernel won't compile with clang anymore. It's not just a matter of the version number; the fallback code for compatibility with old gcc versions has been removed, and AFAIK clang doesn't implement all the new gcc features.

C considered dangerous

Posted Sep 4, 2018 16:27 UTC (Tue) by ndesaulniers (subscriber, #110768) [Link]

I've fixed this in: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/...

Clang can compile a working kernel for x86_64 if the asm goto #error is removed; asm-goto is under development in llvm currently.

Clang can compile arm64 without CONFIG_LSE_ATOMICS. -ffixed and friends need to be implemented.

Other architectures aren't on my radar.

C considered dangerous

Posted Aug 30, 2018 17:16 UTC (Thu) by marcH (subscriber, #57642) [Link]

> The Chromebook Pixel, for instance, is shipped with a Clang-compiled kernel.

Much more than the Pixelbook, currently all devices running chromeos-4.4 and chromeos-4.14:
https://chromium.googlesource.com/chromiumos/overlays/chr...

That's a fairly large number of devices: https://www.chromium.org/chromium-os/developer-informatio...
(not the one expected but the "Year of the Linux desktop" has finally arrived :-)

Hint: check Kees' current employer.

> What's the situation for x86, though?

? like most chromebooks the Pixelbook is x86

> When can we expect that the kernel will "just compile" and the compiled kernel will "just run" on x86?

For reference:
https://chromium.googlesource.com/chromiumos/third_party/...
https://chromium.googlesource.com/chromiumos/third_party/...


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