From: Masami Hiramatsu <mhiramat@kernel.org>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Anders Roxell <anders.roxell@linaro.org>,
Leo Yan <leo.yan@linaro.org>,
Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH] tools/perf: build issues with Clang on arm64 and CFLAGS
Date: Fri, 7 May 2021 17:54:25 +0900 [thread overview]
Message-ID: <162037766527.94840.4323848545957010011.stgit@devnote2> (raw)
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@kernel.org>
next reply other threads:[~2021-05-07 8:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-07 8:54 Masami Hiramatsu [this message]
2021-05-07 8:54 ` [PATCH] tools/perf: Fix a build error on arm64 with clang Masami Hiramatsu
2021-05-09 12:50 ` Arnaldo Carvalho de Melo
2021-05-10 12:14 ` [PATCH] tools/perf: build issues with Clang on arm64 and CFLAGS Arnaldo Carvalho de Melo
2021-05-11 10:36 ` Masami Hiramatsu
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=162037766527.94840.4323848545957010011.stgit@devnote2 \
--to=mhiramat@kernel.org \
--cc=acme@kernel.org \
--cc=anders.roxell@linaro.org \
--cc=leo.yan@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sergey.senozhatsky@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.