src/cmd/link/testdata/linkname/coro_var.go
raw| 1 | // Copyright 2024 The Go Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
| 5 | // Linkname "var" to reference newcoro is not allowed. |
| 6 | |
| 7 | package main |
| 8 | |
| 9 | import "unsafe" |
| 10 | |
| 11 | func main() { |
| 12 | call(&newcoro) |
| 13 | } |
| 14 | |
| 15 | //go:linkname newcoro runtime.newcoro |
| 16 | var newcoro unsafe.Pointer |
| 17 | |
| 18 | //go:noinline |
| 19 | func call(*unsafe.Pointer) { |
| 20 | // not implemented |
| 21 | } |