]> git.baikalelectronics.ru Git - kernel.git/commit
compiler.h: Fix annotation macro misplacement with Clang
authorJosh Poimboeuf <jpoimboe@redhat.com>
Mon, 8 Nov 2021 22:35:59 +0000 (14:35 -0800)
committerJosh Poimboeuf <jpoimboe@redhat.com>
Tue, 21 Dec 2021 23:09:46 +0000 (15:09 -0800)
commit0d07413487e045b5ad7e6f14eaddd1e3f982d687
tree924ef38b1c608d28308f4684364482009d39409a
parent832bc9a2a4c3bc24a6f570d4207ea3c7de68cdfb
compiler.h: Fix annotation macro misplacement with Clang

When building with Clang and CONFIG_TRACE_BRANCH_PROFILING, there are a
lot of unreachable warnings, like:

  arch/x86/kernel/traps.o: warning: objtool: handle_xfd_event()+0x134: unreachable instruction

Without an input to the inline asm, 'volatile' is ignored for some
reason and Clang feels free to move the reachable() annotation away from
its intended location.

Fix that by re-adding the counter value to the inputs.

Fixes: 54821a1a89f3 ("compiler.h: Avoid using inline asm operand modifiers")
Fixes: ef78709a91fe ("instrumentation.h: Avoid using inline asm operand modifiers")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Link: https://lore.kernel.org/r/0417e96909b97a406323409210de7bf13df0b170.1636410380.git.jpoimboe@redhat.com
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: x86@kernel.org
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Miroslav Benes <mbenes@suse.cz>
include/linux/compiler.h
include/linux/instrumentation.h