podman
1//go:build go1.20 && !go1.21
2// +build go1.20,!go1.21
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`github.com/bytedance/sonic/internal/rt`24)
25
26const (27_Magic uint32 = 0xFFFFFFF128)
29
30type moduledata struct {31pcHeader *pcHeader32funcnametab []byte33cutab []uint3234filetab []byte35pctab []byte36pclntable []byte37ftab []funcTab38findfunctab uintptr39minpc, maxpc uintptr // first func address, last func address + last func size40
41text, etext uintptr // start/end of text, (etext-text) must be greater than MIN_FUNC42noptrdata, enoptrdata uintptr43data, edata uintptr44bss, ebss uintptr45noptrbss, enoptrbss uintptr46covctrs, ecovctrs uintptr47end, gcdata, gcbss uintptr48types, etypes uintptr49rodata uintptr50gofunc uintptr // go.func.* is actual funcinfo object in image51
52textsectmap []textSection // see runtime/symtab.go: textAddr()53typelinks []int32 // offsets from types54itablinks []*rt.GoItab55
56ptab []ptabEntry57
58pluginpath string59pkghashes []modulehash60
61modulename string62modulehashes []modulehash63
64hasmain uint8 // 1 if module contains the main function, 0 otherwise65
66gcdatamask, gcbssmask bitVector67
68typemap map[int32]*rt.GoType // offset to *_rtype in previous module69
70bad bool // module failed to load and should be ignored71
72next *moduledata73}
74
75type _func struct {76entryOff uint32 // start pc, as offset from moduledata.text/pcHeader.textStart77nameOff int32 // function name, as index into moduledata.funcnametab.78
79args int32 // in/out args size80deferreturn uint32 // offset of start of a deferreturn call instruction from entry, if any.81
82pcsp uint3283pcfile uint3284pcln uint3285npcdata uint3286cuOffset uint32 // runtime.cutab offset of this function's CU87startLine int32 // line number of start of function (func keyword/TEXT directive)88funcID uint8 // set for certain special runtime functions89flag uint890_ [1]byte // pad91nfuncdata uint8 //92
93// The end of the struct is followed immediately by two variable-length94// arrays that reference the pcdata and funcdata locations for this95// function.96
97// pcdata contains the offset into moduledata.pctab for the start of98// that index's table. e.g.,99// &moduledata.pctab[_func.pcdata[_PCDATA_UnsafePoint]] is the start of100// the unsafe point table.101//102// An offset of 0 indicates that there is no table.103//104// pcdata [npcdata]uint32105
106// funcdata contains the offset past moduledata.gofunc which contains a107// pointer to that index's funcdata. e.g.,108// *(moduledata.gofunc + _func.funcdata[_FUNCDATA_ArgsPointerMaps]) is109// the argument pointer map.110//111// An offset of ^uint32(0) indicates that there is no entry.112//113// funcdata [nfuncdata]uint32114}
115