From: Nathan Chancellor <natechancellor@gmail.com>
To: Sedat Dilek <sedat.dilek@gmail.com>
Cc: Masahiro Yamada <masahiroy@kernel.org>,
"Steven Rostedt (VMware)" <rostedt@goodmis.org>,
Masami Hiramatsu <mhiramat@kernel.org>, Tejun Heo <tj@kernel.org>,
Jessica Yu <jeyu@kernel.org>,
Mauro Carvalho Chehab <mchehab+samsung@kernel.org>,
"Joel Fernandes (Google)" <joel@joelfernandes.org>,
Patrick Bellasi <patrick.bellasi@arm.com>,
Krzysztof Kozlowski <krzk@kernel.org>,
Dan Williams <dan.j.williams@intel.com>,
"Eric W. Biederman" <ebiederm@xmission.com>,
linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com
Subject: Re: [PATCH] kbuild: Set CLANG_VERSION only when Clang is used
Date: Sun, 19 Apr 2020 08:37:03 -0700 [thread overview]
Message-ID: <20200419153703.GA41789@ubuntu-s3-xlarge-x86> (raw)
In-Reply-To: <20200419123612.173187-1-sedat.dilek@gmail.com>
On Sun, Apr 19, 2020 at 02:36:12PM +0200, Sedat Dilek wrote:
> Do like GCC_VERSION is set when GCC (see CC_IS_GCC) is used.
>
> Signed-off-by: Sedat Dilek <sedat.dilek@gmail.com>
> ---
> init/Kconfig | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/init/Kconfig b/init/Kconfig
> index 9e22ee8fbd75..c23f9d3d6d6c 100644
> --- a/init/Kconfig
> +++ b/init/Kconfig
> @@ -25,7 +25,7 @@ config CC_IS_CLANG
>
> config CLANG_VERSION
> int
> - default $(shell,$(srctree)/scripts/clang-version.sh $(CC))
> + default $(shell,$(srctree)/scripts/clang-version.sh $(CC)) if CC_IS_CLANG
>
> config CC_CAN_LINK
> def_bool $(success,$(srctree)/scripts/cc-can-link.sh $(CC))
> --
> 2.26.1
>
I don't understand the motivation behind this. The commit message needs
to be expanded upon or further clarification is needed.
CONFIG_GCC_VERSION is always set, either to 0 if using clang or the
actual version spit out by GCC so the commit message is not entirely
accurate.
It is done in the
default $(shell,$(srctree)/scripts/gcc-version.sh $(CC)) if CC_IS_GCC
default 0
way because it relies on the __GNUC__, __GNUC_MINOR__, and
__GNUC_PATCHLEVEL__ preprocessor macros to figure out the verison, which
clang also defines (to 4, 2, and 1 respectively) so it has to be done
this way to avoid confusing clang for GCC.
We can handle this in clang-version.sh so that CONFIG_CLANG_VERSION is
set to zero if CONFIG_CC_IS_GCC is set, just like CONFIG_GCC_VERSION:
if ! ( $compiler --version | grep -q clang) ; then
echo 0
exit 1
fi
CONFIG_CLANG_VERSION needs to be defined, otherwise we are breaking the
assumption that I made in commit df3da04880b4 ("mips: Fix unroll macro
when building with Clang").
With your patch and GCC 9.3.0 building malta_defconfig:
arch/mips/include/asm/r4kcache.h: In function 'blast_scache64_node':
arch/mips/include/asm/unroll.h:29:9: error: 'CONFIG_CLANG_VERSION' undeclared (first use in this function); did you mean 'CONFIG_LD_VERSION'?
29 | CONFIG_CLANG_VERSION >= 80000) && \
| ^~~~~~~~~~~~~~~~~~~~
/home/nathan/src/linux/include/linux/compiler.h:330:9: note: in definition of macro '__compiletime_assert'
330 | if (!(condition)) \
| ^~~~~~~~~
/home/nathan/src/linux/include/linux/compiler.h:350:2: note: in expansion of macro '_compiletime_assert'
350 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^~~~~~~~~~~~~~~~~~~
/home/nathan/src/linux/include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
| ^~~~~~~~~~~~~~~~~~
/home/nathan/src/linux/include/linux/build_bug.h:50:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
50 | BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
| ^~~~~~~~~~~~~~~~
/home/nathan/src/linux/arch/mips/include/asm/unroll.h:28:2: note: in expansion of macro 'BUILD_BUG_ON'
28 | BUILD_BUG_ON((CONFIG_GCC_VERSION >= 40700 || \
| ^~~~~~~~~~~~
/home/nathan/src/linux/arch/mips/include/asm/r4kcache.h:203:2: note: in expansion of macro 'unroll'
203 | unroll(times, _cache_op, insn, op, (addr) + (i++ * (lsize))); \
| ^~~~~~
/home/nathan/src/linux/arch/mips/include/asm/r4kcache.h:370:4: note: in expansion of macro 'cache_unroll'
370 | cache_unroll(32, kernel_cache, indexop, \
| ^~~~~~~~~~~~
/home/nathan/src/linux/arch/mips/include/asm/r4kcache.h:376:1: note: in expansion of macro '__BUILD_BLAST_CACHE_NODE'
376 | __BUILD_BLAST_CACHE_NODE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 64)
| ^~~~~~~~~~~~~~~~~~~~~~~~
Cheers,
Nathan
next prev parent reply other threads:[~2020-04-19 15:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-19 12:36 Sedat Dilek
2020-04-19 15:37 ` Nathan Chancellor [this message]
2020-04-21 9:52 ` kbuild test robot
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=20200419153703.GA41789@ubuntu-s3-xlarge-x86 \
--to=natechancellor@gmail.com \
--cc=clang-built-linux@googlegroups.com \
--cc=dan.j.williams@intel.com \
--cc=ebiederm@xmission.com \
--cc=jeyu@kernel.org \
--cc=joel@joelfernandes.org \
--cc=krzk@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=masahiroy@kernel.org \
--cc=mchehab+samsung@kernel.org \
--cc=mhiramat@kernel.org \
--cc=patrick.bellasi@arm.com \
--cc=rostedt@goodmis.org \
--cc=sedat.dilek@gmail.com \
--cc=tj@kernel.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
all inboxes | Powered by JetHome®