lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 12 Aug 2020 14:56:24 -0500
From:   Nathan Huckleberry <nhuck@...gle.com>
To:     Masahiro Yamada <masahiroy@...nel.org>
Cc:     Linux Kbuild mailing list <linux-kbuild@...r.kernel.org>,
        Nick Desaulniers <ndesaulniers@...gle.com>,
        Tom Roeder <tmroeder@...gle.com>,
        clang-built-linux <clang-built-linux@...glegroups.com>,
        "David S. Miller" <davem@...emloft.net>,
        Mauro Carvalho Chehab <mchehab+huawei@...nel.org>,
        Michal Marek <michal.lkml@...kovi.net>,
        Rob Herring <robh@...nel.org>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 0/3] kbuild: clang-tidy

On Wed, Aug 12, 2020 at 12:40 PM Masahiro Yamada <masahiroy@...nel.org> wrote:
>
>
> I improved gen_compile_commands.py in the first two patches,
> then rebased Nathan's v7 [1] on top of them.
> To save time, I modified the Makefile part.
> No change for run-clang-tools.py
>
> I am not sure if the new directory, scripts/clang-tools/,
> is worth creating only for 2 files, but I do not have
> a strong opinion about it.
>
> "make clang-tidy" should work in-tree build,
> out-of-tree build (O=), and external module build (M=).
> Tests and reviews are appreciated.
>
> "make clang-tidy" worked for me.
>
> masahiro@...ar:~/workspace/linux-kbuild$ make -j24 CC=clang clang-tidy
>   DESCEND  objtool
>   CALL    scripts/atomic/check-atomics.sh
>   CALL    scripts/checksyscalls.sh
>   CHK     include/generated/compile.h
>   GEN     compile_commands.json
>   CHECK   compile_commands.json
>
> But "make clang-analyzer" just sprinkled the following error:
>
>   Error: no checks enabled.
>   USAGE: clang-tidy [options] <source0> [... <sourceN>]
>
> I built clang-tidy from the latest source.
> I had no idea how to make it work...

How are you building clang-tidy? The clang static-analyzer may not
have been built.
I believe the static analyzer is built as a part of clang, not as a
part of clang-tools-extra.

I use this command to build.
cmake -DCMAKE_BUILD_TYPE="release"
-DLLVM_TARGETS_TO_BUILD="X86;AArch64;ARM;RISCV"
-DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;lld;llvm-as"
-DLLVM_ENABLE_LLD=1 -G "Ninja" ../llvm

Adding clang to the list of -DLLVM_ENABLE_PROJECTS will build the
static analyzer.
-DCLANG_ENABLE_STATIC_ANALYZER=1 might also work, but I haven't tested it.

I tested the patchset and both clang-tidy and clang-analyzer work for me.

>
> [1] https://patchwork.kernel.org/patch/11687833/
>
>
>
> Masahiro Yamada (2):
>   gen_compile_commands: parse only the first line of .*.cmd files
>   gen_compile_commands: wire up build rule to Makefile
>
> Nathan Huckleberry (1):
>   Makefile: Add clang-tidy and static analyzer support to makefile
>
>  MAINTAINERS                                 |   1 +
>  Makefile                                    |  45 +++++-
>  scripts/clang-tools/gen_compile_commands.py | 117 +++++++++++++++
>  scripts/clang-tools/run-clang-tools.py      |  74 ++++++++++
>  scripts/gen_compile_commands.py             | 151 --------------------
>  5 files changed, 233 insertions(+), 155 deletions(-)
>  create mode 100755 scripts/clang-tools/gen_compile_commands.py
>  create mode 100755 scripts/clang-tools/run-clang-tools.py
>  delete mode 100755 scripts/gen_compile_commands.py
>
> --
> 2.25.1
>

Powered by blists - more mailing lists