Qualcomm is working on compiling the Linux kernel with LLVM/Clang. It would be nice to leverage their work on Gentoo.
Rather than clutter bug #408963, I decided to file this bug to keep track of progress on this issue. It will be closed when sys-kernel/gentoo-sources can be compiled with Clang.
IIRC there's a bit of a problem here in that the kernel devs aren't particularly interested in supporting compilers other than gcc.
That is historically true, but there is a Linux Foundation subdomain being used by the wiki for that project, so it seems possible. It should be okay to keep track of it here until the final status of that effort is known.
Here are some links to information on what has been done in this area so far:
The git tree now has patches for clang+llvm+kernel than are claimed to produce a working kernel for i586 and x86_64
4.4, 4.9 and 4.14 seem to be supported. I am using 4.14.2 built via clang, haven't gotten into trouble so far.
(In reply to Kamalavelan from comment #5)
> I am using 4.14.2 built via clang, haven't gotten into trouble so far.
This means the chromium kernel(mentioned in the mail), not gentoo-sources or mainline, using Clang 5.0.
This appears to be resolved with clang-9, at least with x86/x64 and any ARCHes not requiring CONFIG_JUMP_LABEL=y in the kernel .config.
Tried compiling the latest kernel with clang. Works fine (and boots fine too on nomodeset) but segfaults on amdgpu
(In reply to Amit Prakash Ambasta from comment #8)
> Tried compiling the latest kernel with clang. Works fine (and boots fine too
> on nomodeset) but segfaults on amdgpu
It might be some weird ABI incompatibility. Did you also rebuild x11-drivers/xf86-video-amdgpu with clang before reboot?
(In reply to Peter Levine from comment #9)
> (In reply to Amit Prakash Ambasta from comment #8)
> > Tried compiling the latest kernel with clang. Works fine (and boots fine too
> > on nomodeset) but segfaults on amdgpu
> It might be some weird ABI incompatibility. Did you also rebuild
> x11-drivers/xf86-video-amdgpu with clang before reboot?
And/or reinstall all kernel modules?
For one, I don't use xorg (or its drivers). Entirely on KMS + mesa + sway, so rebuilding xorg-drivers isn't required.
Second, I don't have module support in kernel, so everything is built-in. The kernel segfaults on switching to amdgpudrmfb, but boots fine on nomodeset.
Finally, booting directly via efistub, so I am not sure how I can debug what went wrong with amdgpu
The amdgpu issue is fixed by upstream in commit c868868f6b6a5272350781f9a19b3a5ba1c00b02
Well, can't boot into the kernel at all now (immediately bootloops)
kernel versions tried - all variations of 5.x
currently I see problems with clang on 4.9.263 (http://184.108.40.206:10080/scheduler/job/136) and 5.4.108 (https://kernel1.amd64.dev.gentoo.org/#/builders/76/builds/8/steps/8/logs/stdio)
All other kernel version compile and boot for me on clang 4.14.227 4.19.183 5.10.26 5.11.10
all tests are here:
As alice indicated, clang support is shown here: