]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.19] cmd/compile: allow ineffectual //go:linkname in -lang=go1...
authorMatthew Dempsky <mdempsky@google.com>
Thu, 3 Nov 2022 18:56:43 +0000 (11:56 -0700)
committerMichael Knyszek <mknyszek@google.com>
Wed, 9 Nov 2022 18:44:24 +0000 (18:44 +0000)
commit9e0b6c11115ce187f6c526858904204c3efa2ce2
tree08d7d10e0fe0b8d1374d525719ca8d90ce317871
parenta2335d052bbd7cadebd09a5bc378d2110c280fd7
[release-branch.go1.19] cmd/compile: allow ineffectual //go:linkname in -lang=go1.17 and older

Prior to Go 1.18, ineffectual //go:linkname directives (i.e.,
directives referring to an undeclared name, or to a declared type or
constant) were treated as noops. In Go 1.18, we changed this into a
compiler error to mitigate accidental misuse.

However, the x/sys repo contained ineffectual //go:linkname directives
up until go.dev/cl/274573, which has caused a lot of user confusion.

It seems a bit late to worry about now, but to at least prevent
further user pain, this CL changes the error message to only apply to
modules using "go 1.18" or newer. (The x/sys repo declared "go 1.12"
at the time go.dev/cl/274573 was submitted.)

For #55889.
Fixes #56557.

Change-Id: Id762fff96fd13ba0f1e696929a9e276dfcba2620
Reviewed-on: https://go-review.googlesource.com/c/go/+/447755
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/447816
src/cmd/compile/internal/noder/noder.go
test/fixedbugs/issue55889.go [new file with mode: 0644]