podman

Форк
0
113 строк · 3.4 Кб
1
// go:build go1.18 && !go1.20
2
//go:build go1.18 && !go1.20
3
// +build go1.18,!go1.20
4

5
/*
6
 * Copyright 2021 ByteDance Inc.
7
 *
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
11
 *
12
 *     http://www.apache.org/licenses/LICENSE-2.0
13
 *
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.
19
 */
20

21
package loader
22

23
import (
24
    `github.com/bytedance/sonic/internal/rt`
25
)
26

27
const (
28
    _Magic uint32 = 0xfffffff0
29
)
30

31
type moduledata struct {
32
    pcHeader     *pcHeader
33
    funcnametab  []byte
34
    cutab        []uint32
35
    filetab      []byte
36
    pctab        []byte
37
    pclntable    []byte
38
    ftab         []funcTab
39
    findfunctab  uintptr
40
    minpc, maxpc uintptr // first func address, last func address + last func size
41

42
    text, etext           uintptr // start/end of text, (etext-text) must be greater than MIN_FUNC
43
    noptrdata, enoptrdata uintptr
44
    data, edata           uintptr
45
    bss, ebss             uintptr
46
    noptrbss, enoptrbss   uintptr
47
    end, gcdata, gcbss    uintptr
48
    types, etypes         uintptr
49
    rodata                uintptr
50
    gofunc                uintptr // go.func.* is actual funcinfo object in image
51

52
    textsectmap []textSection // see runtime/symtab.go: textAddr()
53
    typelinks   []int32 // offsets from types
54
    itablinks   []*rt.GoItab
55

56
    ptab []ptabEntry
57

58
    pluginpath string
59
    pkghashes  []modulehash
60

61
    modulename   string
62
    modulehashes []modulehash
63

64
    hasmain uint8 // 1 if module contains the main function, 0 otherwise
65

66
    gcdatamask, gcbssmask bitVector
67

68
    typemap map[int32]*rt.GoType // offset to *_rtype in previous module
69

70
    bad bool // module failed to load and should be ignored
71

72
    next *moduledata
73
}
74

75
type _func struct {
76
    entryOff uint32 // start pc, as offset from moduledata.text/pcHeader.textStart
77
    nameOff  int32  // function name, as index into moduledata.funcnametab.
78

79
    args        int32  // in/out args size
80
    deferreturn uint32 // offset of start of a deferreturn call instruction from entry, if any.
81

82
    pcsp      uint32 
83
    pcfile    uint32
84
    pcln      uint32
85
    npcdata   uint32
86
    cuOffset  uint32 // runtime.cutab offset of this function's CU
87
    funcID    uint8  // set for certain special runtime functions
88
    flag      uint8
89
    _         [1]byte // pad
90
    nfuncdata uint8   // 
91
    
92
    // The end of the struct is followed immediately by two variable-length
93
    // arrays that reference the pcdata and funcdata locations for this
94
    // function.
95

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.
100
    //
101
    // An offset of 0 indicates that there is no table.
102
    //
103
    // pcdata [npcdata]uint32
104

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.
109
    //
110
    // An offset of ^uint32(0) indicates that there is no entry.
111
    //
112
    // funcdata [nfuncdata]uint32
113
}
114

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.