]> Cypherpunks repositories - gostls13.git/commit
cmd/asm: reject STREX with same source and destination register on ARM
authorCherry Zhang <cherryyz@google.com>
Mon, 16 Oct 2017 17:48:06 +0000 (13:48 -0400)
committerCherry Zhang <cherryyz@google.com>
Mon, 16 Oct 2017 18:30:56 +0000 (18:30 +0000)
commit290de1f880ea73d9e518d8f0737628abc4f01351
tree226df5d87059b4d0356e738816f7cf3e28f00486
parentfc5841af9eef7df854e6ddac006de0c6bcb73ff8
cmd/asm: reject STREX with same source and destination register on ARM

On ARM, STREX does not permit the same register used as both the
source and the destination. Reject the bad instruction.

The assembler also accepted special cases
STREX R0, (R1) as STREX R0, (R1), R0
STREX (R1), R0 as STREX R0, (R1), R0
both are illegal. Remove this special case as well.

For STREXD, check that the destination is not source, and not
source+1. Also check that the source register is even numbered,
as required by the architecture's manual.

Fixes #22268.

Change-Id: I6bfde86ae692d8f1d35bd0bd7aac0f8a11ce8e22
Reviewed-on: https://go-review.googlesource.com/71190
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/cmd/asm/internal/asm/asm.go
src/cmd/asm/internal/asm/testdata/arm.s
src/cmd/asm/internal/asm/testdata/armerror.s
src/cmd/internal/obj/arm/asm5.go