diff --git a/cmd/vet/asmdecl.go b/cmd/vet/asmdecl.go index c23514c2..a32f1d69 100644 --- a/cmd/vet/asmdecl.go +++ b/cmd/vet/asmdecl.go @@ -69,7 +69,7 @@ var ( var ( re = regexp.MustCompile asmPlusBuild = re(`//\s+\+build\s+([^\n]+)`) - asmTEXT = re(`\bTEXT\b.*·([^\(]+)\(SB\)(?:\s*,\s*([0-9]+))?(?:\s*,\s*\$([0-9]+)(?:-([0-9]+))?)?`) + asmTEXT = re(`\bTEXT\b.*·([^\(]+)\(SB\)(?:\s*,\s*([0-9A-Z|+]+))?(?:\s*,\s*\$([0-9]+)(?:-([0-9]+))?)?`) asmDATA = re(`\b(DATA|GLOBL)\b`) asmNamedFP = re(`([a-zA-Z0-9_\xFF-\x{10FFFF}]+)(?:\+([0-9]+))\(FP\)`) asmUnnamedFP = re(`[^+\-0-9]](([0-9]+)\(FP\))`) @@ -146,7 +146,7 @@ func asmCheck(pkg *Package) { fn = knownFunc[m[1]][arch] if fn != nil { size, _ := strconv.Atoi(m[4]) - if size != fn.size && (m[2] != "7" || size != 0) { + if size != fn.size && (m[2] != "7" && !strings.Contains(m[2], "NOSPLIT") || size != 0) { warnf("wrong argument size %d; expected $...-%d", size, fn.size) } } diff --git a/cmd/vet/testdata/asm.go b/cmd/vet/testdata/asm.go index 18254a40..d8df5aae 100644 --- a/cmd/vet/testdata/asm.go +++ b/cmd/vet/testdata/asm.go @@ -22,3 +22,10 @@ func argiface(x interface{}, y interface { func returnint() int func returnbyte(x int) byte func returnnamed(x byte) (r1 int, r2 int16, r3 string, r4 byte) + +func noprof(x int) +func dupok(x int) +func nosplit(x int) +func rodata(x int) +func noptr(x int) +func wrapper(x int) diff --git a/cmd/vet/testdata/asm4.s b/cmd/vet/testdata/asm4.s new file mode 100644 index 00000000..044b050b --- /dev/null +++ b/cmd/vet/testdata/asm4.s @@ -0,0 +1,26 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build amd64 +// +build vet_test + +// Test cases for symbolic NOSPLIT etc. on TEXT symbols. + +TEXT ·noprof(SB),NOPROF,$0-8 + RET + +TEXT ·dupok(SB),DUPOK,$0-8 + RET + +TEXT ·nosplit(SB),NOSPLIT,$0 + RET + +TEXT ·rodata(SB),RODATA,$0-8 + RET + +TEXT ·noptr(SB),NOPTR|NOSPLIT,$0 + RET + +TEXT ·wrapper(SB),WRAPPER,$0-8 + RET