src/cmd/link/testdata/linkname/p/p.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 | package p |
| 6 | |
| 7 | import _ "unsafe" |
| 8 | |
| 9 | // f1 is pushed from main. |
| 10 | // |
| 11 | //go:linkname f1 |
| 12 | func f1() |
| 13 | |
| 14 | // Push f2 to main. |
| 15 | // |
| 16 | //go:linkname f2 main.f2 |
| 17 | func f2() {} |
| 18 | |
| 19 | func F() { f1() } |