Commit 39f42c59 authored by Austin Clements's avatar Austin Clements

cmd/vet: teach asmdecl check about NOFRAME

Change-Id: I3f71228e391f122f9cc5656ca6835fdf51a424b7
Reviewed-on: https://go-review.googlesource.com/92435
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: 's avatarCherry Zhang <cherryyz@google.com>
parent e940358f
...@@ -240,17 +240,17 @@ Files: ...@@ -240,17 +240,17 @@ Files:
continue continue
} }
} }
flag := m[3]
fn = knownFunc[fnName][arch] fn = knownFunc[fnName][arch]
if fn != nil { if fn != nil {
size, _ := strconv.Atoi(m[5]) size, _ := strconv.Atoi(m[5])
flag := m[3]
if size != fn.size && (flag != "7" && !strings.Contains(flag, "NOSPLIT") || size != 0) { if size != fn.size && (flag != "7" && !strings.Contains(flag, "NOSPLIT") || size != 0) {
badf("wrong argument size %d; expected $...-%d", size, fn.size) badf("wrong argument size %d; expected $...-%d", size, fn.size)
} }
} }
localSize, _ = strconv.Atoi(m[4]) localSize, _ = strconv.Atoi(m[4])
localSize += archDef.intSize localSize += archDef.intSize
if archDef.lr { if archDef.lr && !strings.Contains(flag, "NOFRAME") {
// Account for caller's saved LR // Account for caller's saved LR
localSize += archDef.intSize localSize += archDef.intSize
} }
......
...@@ -43,3 +43,6 @@ func wrapper(x int) ...@@ -43,3 +43,6 @@ func wrapper(x int)
func f15271() (x uint32) func f15271() (x uint32)
func f17584(x float32, y complex64) func f17584(x float32, y complex64)
func noframe1(x int32)
func noframe2(x int32)
...@@ -176,3 +176,17 @@ TEXT ·leaf(SB),0,$-4-12 ...@@ -176,3 +176,17 @@ TEXT ·leaf(SB),0,$-4-12
MOVW y+4(FP), AX MOVW y+4(FP), AX
MOVW AX, ret+8(FP) MOVW AX, ret+8(FP)
RET RET
TEXT ·noframe1(SB),0,$0-4
MOVW 0(R13), AX // Okay; our saved LR
MOVW 4(R13), AX // Okay; caller's saved LR
MOVW x+8(R13), AX // Okay; x argument
MOVW 12(R13), AX // ERROR "use of 12\(R13\) points beyond argument frame"
RET
TEXT ·noframe2(SB),NOFRAME,$0-4
MOVW 0(R13), AX // Okay; caller's saved LR
MOVW x+4(R13), AX // Okay; x argument
MOVW 8(R13), AX // ERROR "use of 8\(R13\) points beyond argument frame"
MOVW 12(R13), AX // ERROR "use of 12\(R13\) points beyond argument frame"
RET
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment