]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/internal/obj/arm: don't split instructions on NaCl
authorCherry Zhang <cherryyz@google.com>
Wed, 7 Jun 2017 14:00:58 +0000 (10:00 -0400)
committerCherry Zhang <cherryyz@google.com>
Wed, 7 Jun 2017 17:33:46 +0000 (17:33 +0000)
We insert guard instructions after each "dangerous" instruction
to make NaCl's validator happy. This happens before asmout. If
in asmout an instruction is split to two dangerous instructions,
but only one guard instruction is inserted, the validation fails.
Therefore don't split instructions on NaCl.

Fixes #20595.

Change-Id: Ie34f209bc7d907d6d16ecef6721f88420981ac01
Reviewed-on: https://go-review.googlesource.com/45021
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/cmd/internal/obj/arm/asm5.go

index e17d312987b32c8d12553f913499af54f916f818..cee3709eecda1de83c6968cf7e5c5fb964d16022 100644 (file)
@@ -1262,11 +1262,15 @@ func (c *ctxt5) aclass(a *obj.Addr) int {
                        if uint32(c.instoffset) <= 0xffff && objabi.GOARM == 7 {
                                return C_SCON
                        }
-                       if x, y := immrot2a(uint32(c.instoffset)); x != 0 && y != 0 {
-                               return C_RCON2A
-                       }
-                       if y, x := immrot2s(uint32(c.instoffset)); x != 0 && y != 0 {
-                               return C_RCON2S
+                       if c.ctxt.Headtype != objabi.Hnacl {
+                               // Don't split instructions on NaCl. The validator is not
+                               // happy with it. See Issue 20595.
+                               if x, y := immrot2a(uint32(c.instoffset)); x != 0 && y != 0 {
+                                       return C_RCON2A
+                               }
+                               if y, x := immrot2s(uint32(c.instoffset)); x != 0 && y != 0 {
+                                       return C_RCON2S
+                               }
                        }
                        return C_LCON