Debian Codegraph @

src/cmd/link/testdata/linkname/badlinkname.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 // Existing pull linknames in the wild are allowed _for now_,
6 // for legacy reason. Test a function and a method.
7 // NOTE: this may not be allowed in the future. Don't do this!
8
9 package main
10
11 import (
12 _ "reflect"
13 "unsafe"
14 )
15
16 //go:linkname noescape runtime.noescape
17 func noescape(unsafe.Pointer) unsafe.Pointer
18
19 //go:linkname rtype_String reflect.(*rtype).String
20 func rtype_String(unsafe.Pointer) string
21
22 func main() {
23 println(rtype_String(noescape(nil)))
24 }