From f41afca23d8f32c142c0ec5fd40950f606b4482d Mon Sep 17 00:00:00 2001 From: Sami Tolvanen Date: Thu, 8 Aug 2019 15:30:50 -0700 Subject: [PATCH] FROMLIST: arm64: fix alternatives with LLVM's integrated assembler LLVM's integrated assembler fails with the following error when building KVM: :12:6: error: expected absolute expression .if kvm_update_va_mask == 0 ^ :21:6: error: expected absolute expression .if kvm_update_va_mask == 0 ^ :24:2: error: unrecognized instruction mnemonic NOT_AN_INSTRUCTION ^ LLVM ERROR: Error parsing inline asm These errors come from ALTERNATIVE_CB and __ALTERNATIVE_CFG, which test for the existence of the callback parameter in inline assembly using the following expression: " .if " __stringify(cb) " == 0\n" This works with GNU as, but isn't supported by LLVM. This change splits __ALTERNATIVE_CFG and ALTINSTR_ENTRY into separate macros to fix the LLVM build. Bug: 145210207 Change-Id: I62dd786277bcaf3c730a7489c4b5a2b437f722ce (am from https://lore.kernel.org/patchwork/patch/1136803/) Link: https://github.com/ClangBuiltLinux/linux/issues/472 Signed-off-by: Sami Tolvanen Signed-off-by: Dakkshesh --- arch/arm64/include/asm/alternative.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/include/asm/alternative.h b/arch/arm64/include/asm/alternative.h index b7205c254c0d..4a1555d5f139 100644 --- a/arch/arm64/include/asm/alternative.h +++ b/arch/arm64/include/asm/alternative.h @@ -36,7 +36,7 @@ void apply_alternatives(void *start, size_t length); " .byte 662b-661b\n" /* source len */ \ " .byte 664f-663f\n" /* replacement len */ -#define ALTINSTR_ENTRY_CB(feature, cb) \ +#define ALTINSTR_ENTRY_CB(feature,cb) \ " .word 661b - .\n" /* label */ \ " .word " __stringify(cb) "- .\n" /* callback */ \ " .hword " __stringify(feature) "\n" /* feature bit */ \ @@ -82,7 +82,7 @@ void apply_alternatives(void *start, size_t length); oldinstr "\n" \ "662:\n" \ ".pushsection .altinstructions,\"a\"\n" \ - ALTINSTR_ENTRY_CB(feature, cb) \ + ALTINSTR_ENTRY_CB(feature,cb) \ ".popsection\n" \ "663:\n\t" \ "664:\n\t" \