public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Matthias Kaehlcke <mka@chromium.org>
To: linux-kernel@vger.kernel.org
Cc: "Arnd Bergmann" <arnd@arndb.de>,
	"Bernhard Rosenkränzer" <bero@linaro.org>,
	"Khem Raj" <raj.khem@gmail.com>,
	"Behan Webster" <behanw@converseincode.com>,
	"Stefan Agner" <stefan@agner.ch>,
	"Douglas Anderson" <dianders@chromium.org>,
	"Guenter Roeck" <groeck@chromium.org>,
	"Grant Grundler" <grundler@chromium.org>,
	"Nick Desaulniers" <ndesaulniers@google.com>,
	"Greg Hackmann" <ghackmann@google.com>,
	"Michael Davidson" <md@google.com>,
	"Alexander Potapenko" <glider@google.com>,
	"Kees Cook" <keescook@chromium.org>
Subject: Clang patch stacks for LTS kernels (v4.4 and v4.9) and status update
Date: Tue, 22 Aug 2017 16:13:50 -0700	[thread overview]
Message-ID: <20170822231350.GD173745@google.com> (raw)

Hi,

Over the past months efforts have been made to upstream the remaining
LLVMLinux patches (http://llvm.linuxfoundation.org) and to address
other outstanding issues in order to build a usable kernel with clang.
To my knowledge upstream is in a relatively good shape by now for x86
and arm64 (I heard the same about PowerPC, but have no first hand
experience), most of the patches are already in Linus' tree, others
have landed in maintainer trees.

Since many projects use an LTS kernel rather than the latest upstream
I thought it could be useful for others to share my upstreamish
patch stacks (derived from my work on Chrome OS) for building v4.4 and
v4.9 with clang:

https://chromium.googlesource.com/chromiumos/third_party/kernel/+log/sandbox/mka/llvm/v4.4
https://chromium.googlesource.com/chromiumos/third_party/kernel/+log/sandbox/mka/llvm/v4.9

These two branches only have the basic patches needed to build an x86
or arm64 kernel with clang, additional fixes for warnings can be found
here:

https://chromium.googlesource.com/chromiumos/third_party/kernel/+log/sandbox/mka/llvm/v4.9_ext

For reference also a stack for v4.13(-rc6):

https://chromium.googlesource.com/chromiumos/third_party/kernel/+log/sandbox/mka/llvm/v4.13

If v4.14 (LTS) misses important patches I will create a stack for it.


To retrieve the patches (v4.9):

git fetch https://chromium.googlesource.com/chromiumos/third_party/kernel refs/sandbox/mka/llvm/v4.9
git checkout -b llvm_v4.9 FETCH_HEAD


To build the kernel with clang:

make CC=clang

or cross compilation:

make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- CC=aarch64-linux-gnu-clang


A short description of the tags used in the patches:

UPSTREAM   From Linus' tree
BACKPORT   From Linus' tree, conflicts had to be resolved
FROMGIT    From a maintainer tree, will eventually propagate to UPSTREAM
FROMLIST   Patch sent to one or more kernel mailing lists, but not
           picked up (yet)
HACK       Workaround for an issue, not upstreamable, proper fix needed
CUSTOM     Similar to HACK, but less hacky, mainly used for older kernels
OBSOLETE   Workaround for issue fixed in upstream clang, not needed
           with recent clang version (more info in the commit message)

The branches are subject to rebasing (e.g. to promote FROMGIT patches
to UPSTREAM, or to incorporate proper fixes for HACKs). If anyone
really needs a static branch for some reason let me know.


Pending issues (incomplete):
- x86: incompatible inline assembly to force generation of stack
  frames. A possible solution is under development:
  https://lkml.org/lkml/2017/7/28/775
- x86: maintainers raised concerns that clang does not support asm goto,
  LLVM devs do not plan to implement it.
- arm64: inconsistent behavior of -mgeneral-regs-only
  (https://llvm.org/bugs/show_bug.cgi?id=30792). A fix is being worked on.
- build errors in different drivers. Arnd Bergmann put together a
  bunch of patches that can serve as starting point for upstream fixes:
  https://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git/log/?h=next-20170420%2bllvmlinux
- warnings: clang raises more warnings than gcc. Most warnings for x86
  and arm64 defconfig have been fixed, others still need to be addressed.
- ...

Thanks to everybody who contributed/s to this effort!

Matthias

             reply	other threads:[~2017-08-22 23:13 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-22 23:13 Matthias Kaehlcke [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-04-23 13:56 Clang patch stacks for LTS kernels (v4.4 and v4.9) and status update Sedat Dilek
2018-04-23 17:42 ` Matthias Kaehlcke
2018-04-24 11:54   ` Sedat Dilek
2018-04-24 23:06     ` Matthias Kaehlcke
2018-05-06  7:42       ` Sedat Dilek
2018-05-06  8:16         ` Sedat Dilek
2018-05-07 17:49         ` Matthias Kaehlcke
2018-05-07 19:37           ` Sedat Dilek
2018-05-11 11:52           ` Sedat Dilek
2018-05-18 22:54             ` Nick Desaulniers
2018-05-22  7:11               ` Sedat Dilek
2018-05-22  7:39               ` Sedat Dilek
2018-05-22  8:04                 ` Sedat Dilek
2018-05-22  8:49                   ` Sedat Dilek
2018-05-22 10:16                     ` Sedat Dilek
2018-05-22 12:05                       ` Sedat Dilek
2018-05-22 12:17                         ` Sedat Dilek
2018-05-22 14:55                           ` Sedat Dilek
2018-05-06  6:35   ` Sedat Dilek
2018-05-06  7:41     ` Dmitry Vyukov
2018-05-06  7:58       ` Sedat Dilek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170822231350.GD173745@google.com \
    --to=mka@chromium.org \
    --cc=arnd@arndb.de \
    --cc=behanw@converseincode.com \
    --cc=bero@linaro.org \
    --cc=dianders@chromium.org \
    --cc=ghackmann@google.com \
    --cc=glider@google.com \
    --cc=groeck@chromium.org \
    --cc=grundler@chromium.org \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=md@google.com \
    --cc=ndesaulniers@google.com \
    --cc=raj.khem@gmail.com \
    --cc=stefan@agner.ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox