Skip to content

Commit f0cbd3b

Browse files
Vasily Gorbikhcahca
authored andcommitted
s390/atomic: circumvent gcc 10 build regression
Circumvent the following gcc 10 allyesconfig build regression: CC drivers/leds/trigger/ledtrig-cpu.o In file included from ./arch/s390/include/asm/bitops.h:39, from ./include/linux/bitops.h:29, from ./include/linux/kernel.h:12, from drivers/leds/trigger/ledtrig-cpu.c:18: ./arch/s390/include/asm/atomic_ops.h: In function 'ledtrig_cpu': ./arch/s390/include/asm/atomic_ops.h:46:2: warning: 'asm' operand 1 probably does not match constraints 46 | asm volatile( \ | ^~~ ./arch/s390/include/asm/atomic_ops.h:53:2: note: in expansion of macro '__ATOMIC_CONST_OP' 53 | __ATOMIC_CONST_OP(op_name, op_type, op_string, "\n") \ | ^~~~~~~~~~~~~~~~~ ./arch/s390/include/asm/atomic_ops.h:56:1: note: in expansion of macro '__ATOMIC_CONST_OPS' 56 | __ATOMIC_CONST_OPS(__atomic_add_const, int, "asi") | ^~~~~~~~~~~~~~~~~~ ./arch/s390/include/asm/atomic_ops.h:46:2: error: impossible constraint in 'asm' 46 | asm volatile( \ | ^~~ ./arch/s390/include/asm/atomic_ops.h:53:2: note: in expansion of macro '__ATOMIC_CONST_OP' 53 | __ATOMIC_CONST_OP(op_name, op_type, op_string, "\n") \ | ^~~~~~~~~~~~~~~~~ ./arch/s390/include/asm/atomic_ops.h:56:1: note: in expansion of macro '__ATOMIC_CONST_OPS' 56 | __ATOMIC_CONST_OPS(__atomic_add_const, int, "asi") | ^~~~~~~~~~~~~~~~~~ scripts/Makefile.build:280: recipe for target 'drivers/leds/trigger/ledtrig-cpu.o' failed By swapping conditions as proposed here: https://gcc.gnu.org/pipermail/gcc-patches/2020-July/549318.html Suggested-by: Ilya Leoshkevich <[email protected]> Signed-off-by: Vasily Gorbik <[email protected]> Signed-off-by: Heiko Carstens <[email protected]>
1 parent 00e4db5 commit f0cbd3b

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

arch/s390/include/asm/atomic.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,11 @@ static inline int atomic_fetch_add(int i, atomic_t *v)
4545
static inline void atomic_add(int i, atomic_t *v)
4646
{
4747
#ifdef CONFIG_HAVE_MARCH_Z196_FEATURES
48-
if (__builtin_constant_p(i) && (i > -129) && (i < 128)) {
48+
/*
49+
* Order of conditions is important to circumvent gcc 10 bug:
50+
* https://gcc.gnu.org/pipermail/gcc-patches/2020-July/549318.html
51+
*/
52+
if ((i > -129) && (i < 128) && __builtin_constant_p(i)) {
4953
__atomic_add_const(i, &v->counter);
5054
return;
5155
}
@@ -112,7 +116,11 @@ static inline s64 atomic64_fetch_add(s64 i, atomic64_t *v)
112116
static inline void atomic64_add(s64 i, atomic64_t *v)
113117
{
114118
#ifdef CONFIG_HAVE_MARCH_Z196_FEATURES
115-
if (__builtin_constant_p(i) && (i > -129) && (i < 128)) {
119+
/*
120+
* Order of conditions is important to circumvent gcc 10 bug:
121+
* https://gcc.gnu.org/pipermail/gcc-patches/2020-July/549318.html
122+
*/
123+
if ((i > -129) && (i < 128) && __builtin_constant_p(i)) {
116124
__atomic64_add_const(i, (long *)&v->counter);
117125
return;
118126
}

0 commit comments

Comments
 (0)