1
// go:build go1.18 && !go1.20
2
//go:build go1.18 && !go1.20
3
// +build go1.18,!go1.20
6
* Copyright 2021 ByteDance Inc.
8
* Licensed under the Apache License, Version 2.0 (the "License");
9
* you may not use this file except in compliance with the License.
10
* You may obtain a copy of the License at
12
* http://www.apache.org/licenses/LICENSE-2.0
14
* Unless required by applicable law or agreed to in writing, software
15
* distributed under the License is distributed on an "AS IS" BASIS,
16
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
* See the License for the specific language governing permissions and
18
* limitations under the License.
24
`github.com/bytedance/sonic/internal/rt`
28
_Magic uint32 = 0xfffffff0
31
type moduledata struct {
40
minpc, maxpc uintptr // first func address, last func address + last func size
42
text, etext uintptr // start/end of text, (etext-text) must be greater than MIN_FUNC
43
noptrdata, enoptrdata uintptr
46
noptrbss, enoptrbss uintptr
47
end, gcdata, gcbss uintptr
50
gofunc uintptr // go.func.* is actual funcinfo object in image
52
textsectmap []textSection // see runtime/symtab.go: textAddr()
53
typelinks []int32 // offsets from types
54
itablinks []*rt.GoItab
59
pkghashes []modulehash
62
modulehashes []modulehash
64
hasmain uint8 // 1 if module contains the main function, 0 otherwise
66
gcdatamask, gcbssmask bitVector
68
typemap map[int32]*rt.GoType // offset to *_rtype in previous module
70
bad bool // module failed to load and should be ignored
76
entryOff uint32 // start pc, as offset from moduledata.text/pcHeader.textStart
77
nameOff int32 // function name, as index into moduledata.funcnametab.
79
args int32 // in/out args size
80
deferreturn uint32 // offset of start of a deferreturn call instruction from entry, if any.
86
cuOffset uint32 // runtime.cutab offset of this function's CU
87
funcID uint8 // set for certain special runtime functions
92
// The end of the struct is followed immediately by two variable-length
93
// arrays that reference the pcdata and funcdata locations for this
96
// pcdata contains the offset into moduledata.pctab for the start of
97
// that index's table. e.g.,
98
// &moduledata.pctab[_func.pcdata[_PCDATA_UnsafePoint]] is the start of
99
// the unsafe point table.
101
// An offset of 0 indicates that there is no table.
103
// pcdata [npcdata]uint32
105
// funcdata contains the offset past moduledata.gofunc which contains a
106
// pointer to that index's funcdata. e.g.,
107
// *(moduledata.gofunc + _func.funcdata[_FUNCDATA_ArgsPointerMaps]) is
108
// the argument pointer map.
110
// An offset of ^uint32(0) indicates that there is no entry.
112
// funcdata [nfuncdata]uint32