podman
1//go:build go1.21 && !go1.22
2// +build go1.21,!go1.22
3
4/*
5* Copyright 2021 ByteDance Inc.
6*
7* Licensed under the Apache License, Version 2.0 (the "License");
8* you may not use this file except in compliance with the License.
9* You may obtain a copy of the License at
10*
11* http://www.apache.org/licenses/LICENSE-2.0
12*
13* Unless required by applicable law or agreed to in writing, software
14* distributed under the License is distributed on an "AS IS" BASIS,
15* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16* See the License for the specific language governing permissions and
17* limitations under the License.
18*/
19
20package loader21
22import (23`unsafe`24`github.com/bytedance/sonic/internal/rt`25)
26
27const (28_Magic uint32 = 0xFFFFFFF129)
30
31type moduledata struct {32pcHeader *pcHeader33funcnametab []byte34cutab []uint3235filetab []byte36pctab []byte37pclntable []byte38ftab []funcTab39findfunctab uintptr40minpc, maxpc uintptr // first func address, last func address + last func size41
42text, etext uintptr // start/end of text, (etext-text) must be greater than MIN_FUNC43noptrdata, enoptrdata uintptr44data, edata uintptr45bss, ebss uintptr46noptrbss, enoptrbss uintptr47covctrs, ecovctrs uintptr48end, gcdata, gcbss uintptr49types, etypes uintptr50rodata uintptr51gofunc uintptr // go.func.* is actual funcinfo object in image52
53textsectmap []textSection // see runtime/symtab.go: textAddr()54typelinks []int32 // offsets from types55itablinks []*rt.GoItab56
57ptab []ptabEntry58
59pluginpath string60pkghashes []modulehash61
62// This slice records the initializing tasks that need to be63// done to start up the program. It is built by the linker.64inittasks []unsafe.Pointer65
66modulename string67modulehashes []modulehash68
69hasmain uint8 // 1 if module contains the main function, 0 otherwise70
71gcdatamask, gcbssmask bitVector72
73typemap map[int32]*rt.GoType // offset to *_rtype in previous module74
75bad bool // module failed to load and should be ignored76
77next *moduledata78}
79
80type _func struct {81entryOff uint32 // start pc, as offset from moduledata.text/pcHeader.textStart82nameOff int32 // function name, as index into moduledata.funcnametab.83
84args int32 // in/out args size85deferreturn uint32 // offset of start of a deferreturn call instruction from entry, if any.86
87pcsp uint3288pcfile uint3289pcln uint3290npcdata uint3291cuOffset uint32 // runtime.cutab offset of this function's CU92startLine int32 // line number of start of function (func keyword/TEXT directive)93funcID uint8 // set for certain special runtime functions94flag uint895_ [1]byte // pad96nfuncdata uint8 //97
98// The end of the struct is followed immediately by two variable-length99// arrays that reference the pcdata and funcdata locations for this100// function.101
102// pcdata contains the offset into moduledata.pctab for the start of103// that index's table. e.g.,104// &moduledata.pctab[_func.pcdata[_PCDATA_UnsafePoint]] is the start of105// the unsafe point table.106//107// An offset of 0 indicates that there is no table.108//109// pcdata [npcdata]uint32110
111// funcdata contains the offset past moduledata.gofunc which contains a112// pointer to that index's funcdata. e.g.,113// *(moduledata.gofunc + _func.funcdata[_FUNCDATA_ArgsPointerMaps]) is114// the argument pointer map.115//116// An offset of ^uint32(0) indicates that there is no entry.117//118// funcdata [nfuncdata]uint32119}
120