From: Tom Roeder <tmroeder@google.com>
To: Nick Desaulniers <ndesaulniers@google.com>
Cc: Raul E Rangel <rrangel@chromium.org>,
Masahiro Yamada <yamada.masahiro@socionext.com>,
Matthias Kaehlcke <mka@chromium.org>,
zwisler@chromium.org, Joe Lawrence <joe.lawrence@redhat.com>,
Kees Cook <keescook@chromium.org>,
Linux Kbuild mailing list <linux-kbuild@vger.kernel.org>,
Petr Mladek <pmladek@suse.com>,
LKML <linux-kernel@vger.kernel.org>,
Michal Marek <michal.lkml@markovi.net>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Changbin Du <changbin.du@intel.com>,
Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>,
Sri Krishna chowdary <schowdary@nvidia.com>,
Matthew Wilcox <willy@infradead.org>,
Mikulas Patocka <mpatocka@redhat.com>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [RFC PATCH] kbuild: Add option to generate a Compilation Database
Date: Fri, 7 Jun 2019 08:32:46 -0700 [thread overview]
Message-ID: <20190607153246.GB101503@google.com> (raw)
In-Reply-To: <CAKwvOd=RCL3hpHBVukomrRiXKhvJHMxe3HSrtd0MRcCe1B3ZGw@mail.gmail.com>
On Thu, Jun 06, 2019 at 04:40:00PM -0700, Nick Desaulniers wrote:
> On Thu, Jun 6, 2019 at 1:54 PM Tom Roeder <tmroeder@google.com> wrote:
> >
> > On Thu, Jun 06, 2019 at 02:30:03PM -0600, Raul E Rangel wrote:
> > > Clang tooling requires a compilation database to figure out the build
> > > options for each file. This enables tools like clang-tidy and
> > > clang-check.
> > >
> > > See https://clang.llvm.org/docs/HowToSetupToolingForLLVM.html for more
> > > information.
>
> I'm also super happy to see this!
> https://nickdesaulniers.github.io/blog/2017/05/31/running-clang-tidy-on-the-linux-kernel/
> I don't know enough about GNU Make/Kbuild to answer the questions, but
> hopefully Masahiro can help there.
>
> > I'm glad to see someone adding this to the Makefile directly. I added
> > scripts/gen_compile_commands.py in b302046 (in Dec 2018) when I was
>
> Heh, cool. I had a script that basically did this; we recently
> dropped it from the Android trees when doing an audit of out of tree
> patches.
>
> > working on using clang-check to look for bugs in KVM. That script
>
> I'm very interested in this work; my summer intern is looking into
> static analyses of the Linux kernel. Can you maybe reach out to me
> off thread to tell me more about what you found (or didn't)?
>
> > > Normally cmake is used to generate the compilation database, but the
> > > linux kernel uses make. Another option is using
> > > [BEAR](https://github.com/rizsotto/Bear) which instruments
> > > exec to find clang invocations and generate the database that way.
>
> It's probably possible to get this to work w/ GCC if the additional
> dependency of bear exists on the host's system (and may reduce the
> number of implementations). Downside is the additional host
> dependency.
>
> Sounds like it may also be possible to just run
> scripts/gen_compile_commands.py at build time if this config is
> enabled?
Yes, for scripts/gen_compile_commands.py, you run a build first with
whatever configuration you want, then call the script to produce the
compile_commands.json file.
next prev parent reply other threads:[~2019-06-07 15:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-06 20:30 [RFC PATCH] kbuild: Add option to generate a Compilation Database Raul E Rangel
2019-06-06 20:54 ` Tom Roeder
2019-06-06 23:40 ` Nick Desaulniers
2019-06-07 15:32 ` Tom Roeder [this message]
2019-06-18 15:16 ` Masahiro Yamada
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=20190607153246.GB101503@google.com \
--to=tmroeder@google.com \
--cc=akpm@linux-foundation.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=changbin.du@intel.com \
--cc=joe.lawrence@redhat.com \
--cc=keescook@chromium.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.lkml@markovi.net \
--cc=mka@chromium.org \
--cc=mpatocka@redhat.com \
--cc=ndesaulniers@google.com \
--cc=penguin-kernel@i-love.sakura.ne.jp \
--cc=pmladek@suse.com \
--cc=rrangel@chromium.org \
--cc=schowdary@nvidia.com \
--cc=willy@infradead.org \
--cc=yamada.masahiro@socionext.com \
--cc=zwisler@chromium.org \
/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