Re: [RESEND PATCH] arm64: fix alternatives with LLVM's integrated assembler

From: Will Deacon
Date: Thu Nov 14 2019 - 11:55:53 EST


Hi Sami,

Sorry -- I thought I'd already replied to this, but it had actually
slipped through the cracks.

On Thu, Oct 31, 2019 at 12:46:52PM -0700, Sami Tolvanen wrote:
> LLVM's integrated assembler fails with the following error when
> building KVM:
>
> <inline asm>:12:6: error: expected absolute expression
> .if kvm_update_va_mask == 0
> ^
> <inline asm>:21:6: error: expected absolute expression
> .if kvm_update_va_mask == 0
> ^
> <inline asm>: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.

Please could you explain a bit more about the failure and why LLVM's
integrated assembler rejects this? Could we use something like .ifb or
.ifeqs instead?

Thanks,

Will