]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
arm64: alternative: Work around .inst assembler bugs
authorMarc Zyngier <marc.zyngier@arm.com>
Mon, 1 Jun 2015 09:47:42 +0000 (10:47 +0100)
committerCatalin Marinas <catalin.marinas@arm.com>
Fri, 5 Jun 2015 09:38:54 +0000 (10:38 +0100)
commiteb7c11ee3c5ce6c45ac28a5015a8e60ed458b412
tree62b2a7c0b2639a364c09ad3d3631495ca07871ae
parent8d883b23aed73cad844ba48051c7e96eddf0f51c
arm64: alternative: Work around .inst assembler bugs

AArch64 toolchains suffer from the following bug:

$ cat blah.S
1:
.inst 0x01020304
.if ((. - 1b) != 4)
.error "blah"
.endif
$ aarch64-linux-gnu-gcc -c blah.S
blah.S: Assembler messages:
blah.S:3: Error: non-constant expression in ".if" statement

which precludes the use of msr_s and co as part of alternatives.

We workaround this issue by not directly testing the labels
themselves, but by moving the current output pointer by a value
that should always be zero. If this value is not null, then
we will trigger a backward move, which is expclicitely forbidden.
This triggers the error we're after:

  AS      arch/arm64/kvm/hyp.o
arch/arm64/kvm/hyp.S: Assembler messages:
arch/arm64/kvm/hyp.S:1377: Error: attempt to move .org backwards
scripts/Makefile.build:294: recipe for target 'arch/arm64/kvm/hyp.o' failed
make[1]: *** [arch/arm64/kvm/hyp.o] Error 1
Makefile:946: recipe for target 'arch/arm64/kvm' failed

Not pretty, but at least works on the current toolchains.

Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/arm64/include/asm/alternative.h