2020-07-10 04:57:49

by Cesar Eduardo Barros

[permalink] [raw]
Subject: [PATCH] Restore gcc check in mips asm/unroll.h

While raising the gcc version requirement to 4.9, the compile-time check
in the unroll macro was accidentally changed from being used on gcc and
clang to being used on clang only.

Restore the gcc check, changing it from "gcc >= 4.7" to "all gcc".

Fixes: 6ec4476ac825 ("Raise gcc version requirement to 4.9")
Signed-off-by: Cesar Eduardo Barros <[email protected]>
---
arch/mips/include/asm/unroll.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/mips/include/asm/unroll.h b/arch/mips/include/asm/unroll.h
index 8ed660adc84f..49009319ac2c 100644
--- a/arch/mips/include/asm/unroll.h
+++ b/arch/mips/include/asm/unroll.h
@@ -25,7 +25,8 @@
* generate reasonable code for the switch statement, \
* so we skip the sanity check for those compilers. \
*/ \
- BUILD_BUG_ON((CONFIG_CLANG_VERSION >= 80000) && \
+ BUILD_BUG_ON((CONFIG_CC_IS_GCC || \
+ CONFIG_CLANG_VERSION >= 80000) && \
!__builtin_constant_p(times)); \
\
switch (times) { \
--
2.26.2


2020-07-10 22:37:03

by Nathan Chancellor

[permalink] [raw]
Subject: [PATCH] mips: Remove compiler check in unroll macro

CONFIG_CC_IS_GCC is undefined when Clang is used, which breaks the build
(see our Travis link below).

Clang 8 was chosen as a minimum version for this check because there
were some improvements around __builtin_constant_p in that release. In
reality, MIPS was not even buildable until clang 9 so that check was not
technically necessary. Just remove all compiler checks and just assume
that we have a working compiler.

Fixes: d4e60453266b ("Restore gcc check in mips asm/unroll.h")
Link: https://travis-ci.com/github/ClangBuiltLinux/continuous-integration/jobs/359642821
Signed-off-by: Nathan Chancellor <[email protected]>
---
arch/mips/include/asm/unroll.h | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/mips/include/asm/unroll.h b/arch/mips/include/asm/unroll.h
index 49009319ac2c..7dd4a80e05d6 100644
--- a/arch/mips/include/asm/unroll.h
+++ b/arch/mips/include/asm/unroll.h
@@ -25,9 +25,7 @@
* generate reasonable code for the switch statement, \
* so we skip the sanity check for those compilers. \
*/ \
- BUILD_BUG_ON((CONFIG_CC_IS_GCC || \
- CONFIG_CLANG_VERSION >= 80000) && \
- !__builtin_constant_p(times)); \
+ BUILD_BUG_ON(!__builtin_constant_p(times)); \
\
switch (times) { \
case 32: fn(__VA_ARGS__); /* fall through */ \

base-commit: aa0c9086b40c17a7ad94425b3b70dd1fdd7497bf
--
2.27.0

2020-07-10 22:44:38

by Linus Torvalds

[permalink] [raw]
Subject: Re: [PATCH] mips: Remove compiler check in unroll macro

On Fri, Jul 10, 2020 at 3:34 PM Nathan Chancellor
<[email protected]> wrote:
>
> Clang 8 was chosen as a minimum version for this check because there
> were some improvements around __builtin_constant_p in that release. In
> reality, MIPS was not even buildable until clang 9 so that check was not
> technically necessary. Just remove all compiler checks and just assume
> that we have a working compiler.

Thanks, that looks much nicer.

Applied.

I think we could probably remove the (unrelated) clang-8 check in the
arm side too, but I guess I'll let arm/clang people worry about it.

Linus

2020-07-11 02:17:58

by Nathan Chancellor

[permalink] [raw]
Subject: Re: [PATCH] mips: Remove compiler check in unroll macro

On Fri, Jul 10, 2020 at 03:43:43PM -0700, Linus Torvalds wrote:
> On Fri, Jul 10, 2020 at 3:34 PM Nathan Chancellor
> <[email protected]> wrote:
> >
> > Clang 8 was chosen as a minimum version for this check because there
> > were some improvements around __builtin_constant_p in that release. In
> > reality, MIPS was not even buildable until clang 9 so that check was not
> > technically necessary. Just remove all compiler checks and just assume
> > that we have a working compiler.
>
> Thanks, that looks much nicer.
>
> Applied.
>
> I think we could probably remove the (unrelated) clang-8 check in the
> arm side too, but I guess I'll let arm/clang people worry about it.
>
> Linus

Yes, we probably should. I'll comment more on that in the other thread.

Thanks for picking up the patch quickly!

Cheers,
Nathan