Summary: | The Linux kernel does not compile with Clang | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Richard Yao (RETIRED) <ryao> |
Component: | [OLD] Core system | Assignee: | Gentoo Kernel Bug Wranglers and Kernel Maintainers <kernel> |
Status: | RESOLVED FIXED | ||
Severity: | enhancement | CC: | adaptee, amit.prakash.ambasta, contact, djc, kripton, lssndrbarbieri, nikoli, pageexec, plevine457, sam, sskamalavelan, wizardedit |
Priority: | Lowest | Keywords: | Goal, LATER, NeedPatch |
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
URL: | http://llvm.linuxfoundation.org/index.php/Main_Page | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Bug Depends on: | 427352 | ||
Bug Blocks: | 408963 |
Description
Richard Yao (RETIRED)
2012-04-05 20:26:39 UTC
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: http://lwn.net/Articles/411654/ http://lwn.net/Articles/441018/ https://events.linuxfoundation.org/slides/2011/lfcs/lfcs2011_llvm_lelbach.pdf http://llvm.org/devmtg/2012-04-12/Slides/Mark_Charlebois.pdf The git tree now has patches for clang+llvm+kernel than are claimed to produce a working kernel for i586 and x86_64 http://git.linuxfoundation.org/?p=llvm-setup.git;a=tree;hb=HEAD https://lkml.org/lkml/2017/11/22/943 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. See: https://releases.llvm.org/9.0.0/tools/clang/docs/ReleaseNotes.html#linux-kernel 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://140.211.166.173: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: https://kernel1.amd64.dev.gentoo.org/#/builders As alice indicated, clang support is shown here: https://kernel1.amd64.dev.gentoo.org/#/builders |