github.com/wfusion/gofusion@v1.1.14/common/utils/inspect/moduledata_go116.go (about)

     1  //go:build go1.16 && !go1.18
     2  // +build go1.16,!go1.18
     3  
     4  package inspect
     5  
     6  import "unsafe"
     7  
     8  type _func struct {
     9  	entry       uintptr // start pc
    10  	nameoff     int32   // function name
    11  	args        int32   // in/out args size
    12  	deferreturn uint32  // offset of start of a deferreturn call instruction from entry, if any.
    13  	pcsp        uint32
    14  	pcfile      uint32
    15  	pcln        uint32
    16  	npcdata     uint32
    17  	cuOffset    uint32  // runtime.cutab offset of this function's CU
    18  	funcID      uint8   // set for certain special runtime functions
    19  	_           [2]byte // pad
    20  	nfuncdata   uint8   // must be last
    21  	argptrs     uintptr
    22  	localptrs   uintptr
    23  }
    24  
    25  type _funcTab struct {
    26  	entry   uintptr
    27  	funcoff uintptr
    28  }
    29  
    30  type _pcHeader struct {
    31  	magic          uint32  // 0xFFFFFFFA
    32  	pad1, pad2     uint8   // 0,0
    33  	minLC          uint8   // min instruction size
    34  	ptrSize        uint8   // size of a ptr in bytes
    35  	nfunc          int     // number of functions in the module
    36  	nfiles         uint    // number of entries in the file tab.
    37  	funcnameOffset uintptr // offset to the funcnametab variable from _PCHeader
    38  	cuOffset       uintptr // offset to the cutab variable from _PCHeader
    39  	filetabOffset  uintptr // offset to the filetab variable from _PCHeader
    40  	pctabOffset    uintptr // offset to the pctab varible from _PCHeader
    41  	pclnOffset     uintptr // offset to the pclntab variable from _PCHeader
    42  }
    43  
    44  type _bitVector struct {
    45  	n        int32 // # of bits
    46  	bytedata *uint8
    47  }
    48  
    49  type _ptabEntry struct {
    50  	name int32
    51  	typ  int32
    52  }
    53  
    54  type _textSection struct {
    55  	vaddr    uintptr // prelinked section vaddr
    56  	length   uintptr // section length
    57  	baseaddr uintptr // relocated section address
    58  }
    59  
    60  // moduledata records information about the layout of the executable
    61  // image. It is written by the linker. Any changes here must be
    62  // matched changes to the code in cmd/internal/ld/symtab.go:symtab.
    63  // moduledata is stored in statically allocated non-pointer memory;
    64  // none of the pointers here are visible to the garbage collector.
    65  type _moduleData struct {
    66  	pcHeader     *_pcHeader
    67  	funcnametab  []byte
    68  	cutab        []uint32
    69  	filetab      []byte
    70  	pctab        []byte
    71  	pclntable    []_func
    72  	ftab         []_funcTab
    73  	findfunctab  *_findFuncBucket
    74  	minpc, maxpc uintptr
    75  
    76  	text, etext           uintptr
    77  	noptrdata, enoptrdata uintptr
    78  	data, edata           uintptr
    79  	bss, ebss             uintptr
    80  	noptrbss, enoptrbss   uintptr
    81  	end, gcdata, gcbss    uintptr
    82  	types, etypes         uintptr
    83  
    84  	textsectmap []_textSection
    85  	typelinks   []int32 // offsets from types
    86  	itablinks   []unsafe.Pointer
    87  
    88  	ptab []_ptabEntry
    89  
    90  	pluginpath string
    91  	pkghashes  []struct{}
    92  
    93  	modulename   string
    94  	modulehashes []struct{}
    95  
    96  	hasmain uint8 // 1 if module contains the main function, 0 otherwise
    97  
    98  	gcdatamask, gcbssmask _bitVector
    99  
   100  	typemap map[int32]*rtype // offset to *_rtype in previous module
   101  
   102  	bad bool // module failed to load and should be ignored
   103  
   104  	next *_moduleData
   105  }
   106  
   107  type _findFuncBucket struct {
   108  	idx        uint32
   109  	subbuckets [16]byte
   110  }