github.com/wfusion/gofusion@v1.1.14/common/utils/inspect/moduledata_go121.go (about) 1 //go:build go1.21 2 // +build go1.21 3 4 package inspect 5 6 import ( 7 _ "unsafe" 8 ) 9 10 // A FuncFlag holds bits about a function. 11 // This list must match the list in cmd/internal/objabi/funcid.go. 12 type funcFlag uint8 13 14 type _func struct { 15 entryOff uint32 // start pc 16 nameoff int32 // function name 17 args int32 // in/out args size 18 deferreturn uint32 // offset of start of a deferreturn call instruction from entry, if any. 19 pcsp uint32 20 pcfile uint32 21 pcln uint32 22 npcdata uint32 23 cuOffset uint32 // runtime.cutab offset of this function's CU 24 funcID uint8 // set for certain special runtime functions 25 flag funcFlag 26 _ [1]byte // pad 27 nfuncdata uint8 // must be last 28 argptrs uint32 29 localptrs uint32 30 } 31 32 type _funcTab struct { 33 entry uint32 34 funcoff uint32 35 } 36 37 type _pcHeader struct { 38 magic uint32 // 0xFFFFFFF1 39 pad1, pad2 uint8 // 0,0 40 minLC uint8 // min instruction size 41 ptrSize uint8 // size of a ptr in bytes 42 nfunc int // number of functions in the module 43 nfiles uint // number of entries in the file tab 44 textStart uintptr // base for function entry PC offsets in this module, equal to moduledata.text 45 funcnameOffset uintptr // offset to the funcnametab variable from pcHeader 46 cuOffset uintptr // offset to the cutab variable from pcHeader 47 filetabOffset uintptr // offset to the filetab variable from pcHeader 48 pctabOffset uintptr // offset to the pctab variable from pcHeader 49 pclnOffset uintptr // offset to the pclntab variable from pcHeader 50 } 51 52 type _bitVector struct { 53 n int32 // # of bits 54 bytedata *uint8 55 } 56 57 type _ptabEntry struct { 58 name nameOff 59 typ typeOff 60 } 61 62 type _textSection struct { 63 vaddr uintptr // prelinked section vaddr 64 end uintptr // vaddr + section length 65 baseaddr uintptr // relocated section address 66 } 67 68 // An initTask represents the set of initializations that need to be done for a package. 69 // Keep in sync with ../../test/noinit.go:initTask 70 type initTask struct { 71 state uint32 // 0 = uninitialized, 1 = in progress, 2 = done 72 nfns uint32 73 // followed by nfns pcs, uintptr sized, one per init function to run 74 } 75 76 // moduledata records information about the layout of the executable 77 // image. It is written by the linker. Any changes here must be 78 // matched changes to the code in cmd/link/internal/ld/symtab.go:symtab. 79 // moduledata is stored in statically allocated non-pointer memory; 80 // none of the pointers here are visible to the garbage collector. 81 type _moduleData struct { 82 notInHeap // Only in static data 83 84 pcHeader *_pcHeader 85 funcnametab []byte 86 cutab []uint32 87 filetab []byte 88 pctab []byte 89 pclntable []byte 90 ftab []_funcTab 91 findfunctab uintptr 92 minpc, maxpc uintptr 93 94 text, etext uintptr 95 noptrdata, enoptrdata uintptr 96 data, edata uintptr 97 bss, ebss uintptr 98 noptrbss, enoptrbss uintptr 99 covctrs, ecovctrs uintptr 100 end, gcdata, gcbss uintptr 101 types, etypes uintptr 102 rodata uintptr 103 gofunc uintptr // go.func.* 104 105 textsectmap []_textSection 106 typelinks []int32 // offsets from types 107 itablinks []*itab 108 109 ptab []_ptabEntry 110 111 pluginpath string 112 pkghashes []_modulehash 113 114 // This slice records the initializing tasks that need to be 115 // done to start up the program. It is built by the linker. 116 inittasks []*initTask 117 118 modulename string 119 modulehashes []_modulehash 120 121 hasmain uint8 // 1 if module contains the main function, 0 otherwise 122 gcdatamask, gcbssmask _bitVector 123 124 typemap map[typeOff]*rtype // offset to *_rtype in previous module 125 126 bad bool // module failed to load and should be ignored 127 128 next *_moduleData 129 } 130 131 type _modulehash struct { 132 modulename string 133 linktimehash string 134 runtimehash *string 135 } 136 137 // nih runtime/internal/sys.nih 138 // NOTE: keep in sync with cmd/compile/internal/types.CalcSize 139 // to make the compiler recognize this as an intrinsic type. 140 type nih struct{} 141 142 // notInHeap runtime/internal/sys.NotInHeap 143 // is a type must never be allocated from the GC'd heap or on the stack, 144 // and is called not-in-heap. 145 type notInHeap struct{ _ nih } 146 147 //go:linkname textAddr runtime.(*moduledata).textAddr 148 func textAddr(md *_moduleData, off32 uint32) uintptr