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  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <162037766527.94840.4323848545957010011.stgit@devnote2>
Date:   Fri,  7 May 2021 17:54:25 +0900
From:   Masami Hiramatsu <mhiramat@...nel.org>
To:     Arnaldo Carvalho de Melo <acme@...nel.org>
Cc:     Anders Roxell <anders.roxell@...aro.org>,
        Leo Yan <leo.yan@...aro.org>,
        Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
        linux-kernel@...r.kernel.org
Subject: [PATCH] tools/perf: build issues with Clang on arm64 and CFLAGS

Hi Arnaldo,

Recently, I tested the perf build by clang on arm64 and found an issue
in arch/arm64/util/kvm-stat.c, related to missing-field-initializers warning.

----
 tools/perf $ make CC=clang LLVM=1 
...
arch/arm64/util/kvm-stat.c:74:9: error: missing field 'ops' initializer [-Werror,-Wmissing-field-initializers]
        { NULL },
               ^
1 error generated.
----

That error itself can be fixed easily by just adding field initializers
[1/1] Note that I didn't add Fixes tag, because I'm not sure clang build
of perf is officially supported or not, and this seems correct C code
to initialize a data structure with zero.(*)

And while investigating the error, I found another issue in the Makefile.config.

It seems to make CFLAGS from CORE_CFLAGS, INC_FLAGS, EXTRA_CFLAGS, EXTRA_WARNINGS
in the following order;

CFLAGS = $EXTRA_CFLAGS $EXTRA_WARNINGS $CORE_CFLAGS $INC_FLAGS

But since CORE_CFLAGS includes -Wall and -Wextra, the other -Wno-XXXX in
EXTRA_CFLAGS and EXTRA_WARNINGS are overriden and ignored.
So, I think it is better to define it as

CFLAGS = $CORE_CFLAGS $INC_FLAGS $EXTRA_CFLAGS $EXTRA_WARNINGS

But I also saw some configs tweaks CFLAGS directly. I think they should
modify EXTRA_CFLAGS.

My question is that this order is intentional or not. I might
miss something on it.

(*) BTW, there seems a discussion on the clang warning behavior,
 because gcc doesn't warn it anymore
 (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36750).
 It might be better to add -Wno-missing-field-initializers in case
 of CC=clang by default.


Thank you,

---

Masami Hiramatsu (1):
      tools/perf: Fix a build error on arm64 with clang


 tools/perf/arch/arm64/util/kvm-stat.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--
Masami Hiramatsu (Linaro) <mhiramat@...nel.org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ