OSDN Git Service

arm64: atomics: Use K constraint when toolchain appears to support it
authorWill Deacon <will@kernel.org>
Thu, 29 Aug 2019 13:34:42 +0000 (14:34 +0100)
committerWill Deacon <will@kernel.org>
Fri, 30 Aug 2019 10:18:40 +0000 (11:18 +0100)
commit03adcbd996be7ce81cac793b1511406a7a4df117
tree47a2847b763aad328f42f7cbc22984a129a47227
parent5aad6cdabbf91fd330bd216fe3c93d90f78bc7e7
arm64: atomics: Use K constraint when toolchain appears to support it

The 'K' constraint is a documented AArch64 machine constraint supported
by GCC for matching integer constants that can be used with a 32-bit
logical instruction. Unfortunately, some released compilers erroneously
accept the immediate '4294967295' for this constraint, which is later
refused by GAS at assembly time. This had led us to avoid the use of
the 'K' constraint altogether.

Instead, detect whether the compiler is up to the job when building the
kernel and pass the 'K' constraint to our 32-bit atomic macros when it
appears to be supported.

Signed-off-by: Will Deacon <will@kernel.org>
arch/arm64/Makefile
arch/arm64/include/asm/atomic_ll_sc.h