forked from alangpierce/go-forceexport
-
Notifications
You must be signed in to change notification settings - Fork 1
/
go_1_14.go
72 lines (57 loc) · 1.39 KB
/
go_1_14.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
//go:build !go1.16
// +build !go1.16
package forceexport
import (
"runtime"
"unsafe"
)
type (
functab struct {
entry uintptr
funcoff uintptr
}
oldModuleWrapper struct {
pclntable []byte
ftab []functab
filetab []uint32
findfunctab uintptr
minpc, maxpc uintptr
text, etext uintptr
noptrdata, enoptrdata uintptr
data, edata uintptr
bss, ebss uintptr
noptrbss, enoptrbss uintptr
end, gcdata, gcbss uintptr
// Original type was []*_type
typelinks []interface{}
modulename string
// Original type was []modulehash
modulehashes []interface{}
gcdatamask, gcbssmask Bitvector
next *oldModuleWrapper
}
Bitvector struct {
n int32 // # of bits
bytedata *uint8
}
)
func (me *oldModuleWrapper) GetFtab() []functab {
return me.ftab
}
func (me *oldModuleWrapper) GetFunc(ftab functab) *runtime.Func {
return (*runtime.Func)(unsafe.Pointer(&me.pclntable[ftab.funcoff]))
}
func (me *oldModuleWrapper) GetNext() moduleWrapper {
if me.next != nil {
return (*oldModuleWrapper)(unsafe.Pointer(me.next))
}
return nil
}
func getModuleWrapper() moduleWrapper {
old := &Firstmoduledata
// println(&Firstmoduledata)
// println(old)
return old
}
//go:linkname Firstmoduledata runtime.firstmoduledata
var Firstmoduledata oldModuleWrapper