Source file src/reflect/badlinkname.go
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 reflect 6 7 import ( 8 "internal/abi" 9 "unsafe" 10 _ "unsafe" 11 ) 12 13 // Widely used packages access these symbols using linkname, 14 // most notably: 15 // - github.com/goccy/go-json 16 // - github.com/goccy/go-reflect 17 // - github.com/sohaha/zlsgo 18 // - github.com/undefinedlabs/go-mpatch 19 // 20 // Do not remove or change the type signature. 21 // See go.dev/issue/67401 22 // and go.dev/issue/67279. 23 24 // ifaceIndir reports whether t is stored indirectly in an interface value. 25 // It is no longer used by this package and is here entirely for the 26 // linkname uses. 27 // 28 //go:linkname unusedIfaceIndir reflect.ifaceIndir 29 func unusedIfaceIndir(t *abi.Type) bool { 30 return t.Kind_&abi.KindDirectIface == 0 31 } 32 33 //go:linkname valueInterface 34 35 // The compiler doesn't allow linknames on methods, for good reasons. 36 // We use this trick to push linknames of the methods. 37 // Do not call them in this package. 38 39 //go:linkname badlinkname_rtype_Align reflect.(*rtype).Align 40 func badlinkname_rtype_Align(*rtype) int 41 42 //go:linkname badlinkname_rtype_AssignableTo reflect.(*rtype).AssignableTo 43 func badlinkname_rtype_AssignableTo(*rtype, Type) bool 44 45 //go:linkname badlinkname_rtype_Bits reflect.(*rtype).Bits 46 func badlinkname_rtype_Bits(*rtype) int 47 48 //go:linkname badlinkname_rtype_ChanDir reflect.(*rtype).ChanDir 49 func badlinkname_rtype_ChanDir(*rtype) ChanDir 50 51 //go:linkname badlinkname_rtype_Comparable reflect.(*rtype).Comparable 52 func badlinkname_rtype_Comparable(*rtype) bool 53 54 //go:linkname badlinkname_rtype_ConvertibleTo reflect.(*rtype).ConvertibleTo 55 func badlinkname_rtype_ConvertibleTo(*rtype, Type) bool 56 57 //go:linkname badlinkname_rtype_Elem reflect.(*rtype).Elem 58 func badlinkname_rtype_Elem(*rtype) Type 59 60 //go:linkname badlinkname_rtype_Field reflect.(*rtype).Field 61 func badlinkname_rtype_Field(*rtype, int) StructField 62 63 //go:linkname badlinkname_rtype_FieldAlign reflect.(*rtype).FieldAlign 64 func badlinkname_rtype_FieldAlign(*rtype) int 65 66 //go:linkname badlinkname_rtype_FieldByIndex reflect.(*rtype).FieldByIndex 67 func badlinkname_rtype_FieldByIndex(*rtype, []int) StructField 68 69 //go:linkname badlinkname_rtype_FieldByName reflect.(*rtype).FieldByName 70 func badlinkname_rtype_FieldByName(*rtype, string) (StructField, bool) 71 72 //go:linkname badlinkname_rtype_FieldByNameFunc reflect.(*rtype).FieldByNameFunc 73 func badlinkname_rtype_FieldByNameFunc(*rtype, func(string) bool) (StructField, bool) 74 75 //go:linkname badlinkname_rtype_Implements reflect.(*rtype).Implements 76 func badlinkname_rtype_Implements(*rtype, Type) bool 77 78 //go:linkname badlinkname_rtype_In reflect.(*rtype).In 79 func badlinkname_rtype_In(*rtype, int) Type 80 81 //go:linkname badlinkname_rtype_IsVariadic reflect.(*rtype).IsVariadic 82 func badlinkname_rtype_IsVariadic(*rtype) bool 83 84 //go:linkname badlinkname_rtype_Key reflect.(*rtype).Key 85 func badlinkname_rtype_Key(*rtype) Type 86 87 //go:linkname badlinkname_rtype_Kind reflect.(*rtype).Kind 88 func badlinkname_rtype_Kind(*rtype) Kind 89 90 //go:linkname badlinkname_rtype_Len reflect.(*rtype).Len 91 func badlinkname_rtype_Len(*rtype) int 92 93 //go:linkname badlinkname_rtype_Method reflect.(*rtype).Method 94 func badlinkname_rtype_Method(*rtype, int) Method 95 96 //go:linkname badlinkname_rtype_MethodByName reflect.(*rtype).MethodByName 97 func badlinkname_rtype_MethodByName(*rtype, string) (Method, bool) 98 99 //go:linkname badlinkname_rtype_Name reflect.(*rtype).Name 100 func badlinkname_rtype_Name(*rtype) string 101 102 //go:linkname badlinkname_rtype_NumField reflect.(*rtype).NumField 103 func badlinkname_rtype_NumField(*rtype) int 104 105 //go:linkname badlinkname_rtype_NumIn reflect.(*rtype).NumIn 106 func badlinkname_rtype_NumIn(*rtype) int 107 108 //go:linkname badlinkname_rtype_NumMethod reflect.(*rtype).NumMethod 109 func badlinkname_rtype_NumMethod(*rtype) int 110 111 //go:linkname badlinkname_rtype_NumOut reflect.(*rtype).NumOut 112 func badlinkname_rtype_NumOut(*rtype) int 113 114 //go:linkname badlinkname_rtype_Out reflect.(*rtype).Out 115 func badlinkname_rtype_Out(*rtype, int) Type 116 117 //go:linkname badlinkname_rtype_PkgPath reflect.(*rtype).PkgPath 118 func badlinkname_rtype_PkgPath(*rtype) string 119 120 //go:linkname badlinkname_rtype_Size reflect.(*rtype).Size 121 func badlinkname_rtype_Size(*rtype) uintptr 122 123 //go:linkname badlinkname_rtype_String reflect.(*rtype).String 124 func badlinkname_rtype_String(*rtype) string 125 126 //go:linkname badlinkname_rtype_ptrTo reflect.(*rtype).ptrTo 127 func badlinkname_rtype_ptrTo(*rtype) *abi.Type 128 129 //go:linkname badlinkname_Value_pointer reflect.(*Value).pointer 130 func badlinkname_Value_pointer(Value) unsafe.Pointer 131