Skip to content

Commit

Permalink
fix #99 adapter golang 1.23
Browse files Browse the repository at this point in the history
  • Loading branch information
pkujhd committed Jun 25, 2024
1 parent 1a28096 commit 7bed20a
Show file tree
Hide file tree
Showing 21 changed files with 134 additions and 40 deletions.
4 changes: 2 additions & 2 deletions constants/pkgpath.1.19.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build go1.19 && !go1.23
// +build go1.19,!go1.23
//go:build go1.19 && !go1.24
// +build go1.19,!go1.24

package constants

Expand Down
4 changes: 2 additions & 2 deletions constants/type.1.20.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build go1.20 && !go1.23
// +build go1.20,!go1.23
//go:build go1.20 && !go1.24
// +build go1.20,!go1.24

package constants

Expand Down
4 changes: 2 additions & 2 deletions deferreturn.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build go1.14 && !go1.23
// +build go1.14,!go1.23
//go:build go1.14 && !go1.24
// +build go1.14,!go1.24

package goloader

Expand Down
4 changes: 2 additions & 2 deletions func.1.20.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build go1.20 && !go1.23
// +build go1.20,!go1.23
//go:build go1.20 && !go1.24
// +build go1.20,!go1.24

package goloader

Expand Down
4 changes: 2 additions & 2 deletions functab.1.18.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build go1.18 && !go1.23
// +build go1.18,!go1.23
//go:build go1.18 && !go1.24
// +build go1.18,!go1.24

package goloader

Expand Down
4 changes: 2 additions & 2 deletions iface.1.10.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build go1.10 && !go1.23
// +build go1.10,!go1.23
//go:build go1.10 && !go1.24
// +build go1.10,!go1.24

package goloader

Expand Down
4 changes: 2 additions & 2 deletions init.1.21.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build go1.21 && !go1.23
// +build go1.21,!go1.23
//go:build go1.21 && !go1.24
// +build go1.21,!go1.24

package goloader

Expand Down
94 changes: 94 additions & 0 deletions module.1.23.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
//go:build go1.23 && !go1.24
// +build go1.23,!go1.24

package goloader

import (
"unsafe"
)

const magic uint32 = 0xFFFFFFF1

// pcHeader holds data used by the pclntab lookups.
type pcHeader struct {
magic uint32 // 0xFFFFFFF1
pad1, pad2 uint8 // 0,0
minLC uint8 // min instruction size
ptrSize uint8 // size of a ptr in bytes
nfunc int // number of functions in the module
nfiles uint // number of entries in the file tab
textStart uintptr // base for function entry PC offsets in this module, equal to moduledata.text
funcnameOffset uintptr // offset to the funcnametab variable from pcHeader
cuOffset uintptr // offset to the cutab variable from pcHeader
filetabOffset uintptr // offset to the filetab variable from pcHeader
pctabOffset uintptr // offset to the pctab variable from pcHeader
pclnOffset uintptr // offset to the pclntab variable from pcHeader
}

// moduledata records information about the layout of the executable
// image. It is written by the linker. Any changes here must be
// matched changes to the code in cmd/link/internal/ld/symtab.go:symtab.
// moduledata is stored in statically allocated non-pointer memory;
// none of the pointers here are visible to the garbage collector.
type moduledata struct {
pcHeader *pcHeader
funcnametab []byte
cutab []uint32
filetab []byte
pctab []byte
pclntable []byte
ftab []functab
findfunctab uintptr
minpc, maxpc uintptr

text, etext uintptr
noptrdata, enoptrdata uintptr
data, edata uintptr
bss, ebss uintptr
noptrbss, enoptrbss uintptr
covctrs, ecovctrs uintptr
end, gcdata, gcbss uintptr
types, etypes uintptr
rodata uintptr
gofunc uintptr // go.func.*

textsectmap []textsect
typelinks []int32 // offsets from types
itablinks []*itab

ptab []ptabEntry

pluginpath string
pkghashes []modulehash

// This slice records the initializing tasks that need to be
// done to start up the program. It is built by the linker.
inittasks []*initTask

modulename string
modulehashes []modulehash

hasmain uint8 // 1 if module contains the main function, 0 otherwise
bad bool // module failed to load and should be ignored

gcdatamask, gcbssmask bitvector

typemap map[typeOff]uintptr // offset to *_rtype in previous module

next *moduledata
}

func initmodule(module *moduledata, linker *Linker) {
module.pcHeader = (*pcHeader)(unsafe.Pointer(&(module.pclntable[0])))
module.pcHeader.textStart = module.text
module.pcHeader.nfunc = len(module.ftab)
module.pcHeader.nfiles = (uint)(len(module.filetab))
module.funcnametab = module.pclntable
module.pctab = module.pclntable
module.cutab = linker.Filetab
module.filetab = module.pclntable
module.hasmain = 0
module.bad = false
module.gofunc = module.noptrdata
module.rodata = module.noptrdata
}
4 changes: 2 additions & 2 deletions obj/funcinfo.1.20.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build go1.20 && !go1.23
// +build go1.20,!go1.23
//go:build go1.20 && !go1.24
// +build go1.20,!go1.24

package obj

Expand Down
4 changes: 2 additions & 2 deletions obj/inlinedcall.1.20.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build go1.20 && !go1.23
// +build go1.20,!go1.23
//go:build go1.20 && !go1.24
// +build go1.20,!go1.24

package obj

Expand Down
4 changes: 2 additions & 2 deletions obj/pathtoprefix.1.9.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build go1.9 && !go1.23
// +build go1.9,!go1.23
//go:build go1.9 && !go1.24
// +build go1.9,!go1.24

package obj

Expand Down
4 changes: 2 additions & 2 deletions obj/readobj.1.16.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build go1.16 && !go1.23
// +build go1.16,!go1.23
//go:build go1.16 && !go1.24
// +build go1.16,!go1.24

package obj

Expand Down
4 changes: 2 additions & 2 deletions objabi/dataindex/dataindex.1.20.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build go1.20 && !go1.23
// +build go1.20,!go1.23
//go:build go1.20 && !go1.24
// +build go1.20,!go1.24

package dataindex

Expand Down
4 changes: 2 additions & 2 deletions objabi/funcalign/funcalign.1.16.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build go1.16 && !go1.23
// +build go1.16,!go1.23
//go:build go1.16 && !go1.24
// +build go1.16,!go1.24

package funcalign

Expand Down
4 changes: 2 additions & 2 deletions objabi/reloctype/reloctype.1.21.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build go1.21 && !go1.23
// +build go1.21,!go1.23
//go:build go1.21 && !go1.24
// +build go1.21,!go1.24

package reloctype

Expand Down
4 changes: 2 additions & 2 deletions objabi/symkind/symkind.1.9.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build go1.9 && !go1.23
// +build go1.9,!go1.23
//go:build go1.9 && !go1.24
// +build go1.9,!go1.24

package symkind

Expand Down
4 changes: 2 additions & 2 deletions objabi/tls/headtype.1.9.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build go1.9 && !go1.23
// +build go1.9,!go1.23
//go:build go1.9 && !go1.24
// +build go1.9,!go1.24

package tls

Expand Down
4 changes: 2 additions & 2 deletions objabi/tls/tls.1.13.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build go1.13 && !go1.23
// +build go1.13,!go1.23
//go:build go1.13 && !go1.24
// +build go1.13,!go1.24

package tls

Expand Down
4 changes: 2 additions & 2 deletions stackobject/stackobject.1.18.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build go1.18 && !go1.23
// +build go1.18,!go1.23
//go:build go1.18 && !go1.24
// +build go1.18,!go1.24

package stackobject

Expand Down
4 changes: 2 additions & 2 deletions stackobject/stackobject.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build go1.12 && !go1.23
// +build go1.12,!go1.23
//go:build go1.12 && !go1.24
// +build go1.12,!go1.24

package stackobject

Expand Down
4 changes: 2 additions & 2 deletions type.1.14.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build go1.14 && !go1.23
// +build go1.14,!go1.23
//go:build go1.14 && !go1.24
// +build go1.14,!go1.24

package goloader

Expand Down

0 comments on commit 7bed20a

Please sign in to comment.