Skip to content

Commit

Permalink
chore: add more neccessary linkname
Browse files Browse the repository at this point in the history
  • Loading branch information
AsterDY committed Feb 14, 2025
1 parent 1cf62be commit 8f15864
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/plugin/plugin_dlopen.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,16 @@ func lookup(p *Plugin, symName string) (Symbol, error) {
}

var (
// pluginsMu should be an internal detail,
// but widely used packages access it using linkname.
// Notable members of the hall of shame include:
// - github.com/bytedance/sonic
//
// Do not remove or change the type signature.
// See go.dev/issues/67401.
// See go.dev/issues/71672.
//
//go:linkname pluginsMu
pluginsMu sync.Mutex
plugins map[string]*Plugin
)
Expand Down
10 changes: 10 additions & 0 deletions src/runtime/stubs.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,16 @@ func asmcgocall(fn, arg unsafe.Pointer) int32

func morestack()

// morestack_noctxt should be an internal detail,
// but widely used packages access it using linkname.
// Notable members of the hall of shame include:
// - github.com/bytedance/sonic
//
// Do not remove or change the type signature.
// See go.dev/issues/67401.
// See go.dev/issues/71672.
//
//go:linkname morestack_noctxt
func morestack_noctxt()

func rt0_go()
Expand Down
12 changes: 11 additions & 1 deletion src/runtime/symtab.go
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ var firstmoduledata moduledata // linker symbol
// See go.dev/issues/67401.
// See go.dev/issues/71672.
//
//go:linkname lastmoduledatap runtime.lastmoduledatap
//go:linkname lastmoduledatap
var lastmoduledatap *moduledata // linker symbol

var modulesSlice *[]*moduledata // see activeModules
Expand Down Expand Up @@ -602,6 +602,16 @@ func moduledataverify() {

const debugPcln = false

// moduledataverify1 should be an internal detail,
// but widely used packages access it using linkname.
// Notable members of the hall of shame include:
// - github.com/bytedance/sonic
//
// Do not remove or change the type signature.
// See go.dev/issues/67401.
// See go.dev/issues/71672.
//
//go:linkname moduledataverify1
func moduledataverify1(datap *moduledata) {
// Check that the pclntab's format is valid.
hdr := datap.pcHeader
Expand Down

0 comments on commit 8f15864

Please sign in to comment.