-
Notifications
You must be signed in to change notification settings - Fork 18.6k
Closed
Labels
BugReportIssues describing a possible bug in the Go implementation.Issues describing a possible bug in the Go implementation.FixPendingIssues that have a fix which has not yet been reviewed or submitted.Issues that have a fix which has not yet been reviewed or submitted.compiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.
Milestone
Description
package main
import (
_ "unsafe"
)
//go:linkname addmoduledata runtime.addmoduledata
func addmoduledata()
func main() {
addmoduledata()
}This program can compile ok. However, comment said do NOT call from Go.
Lines 427 to 428 in ebc763f
| // Called from linker-generated .initarray; declared for go vet; do NOT call from Go. | |
| func addmoduledata() |
And using linkname on this function will cause a linker crash when building with buildmode=plugin.
package main
import (
_ "unsafe"
)
//go:linkname addmoduledata runtime.addmoduledata
func addmoduledata()
func FOO() {
addmoduledata()
}go build -buildmode=plugin a.go
# command-line-arguments
runtime.gcWriteBarrier1: phase error: addr=0x63750 but val=0x5dc00 sym=runtime.gcWriteBarrier1 type=STEXT sect=.text sect.addr=0x0 prev=runtime.addmoduledata
Metadata
Metadata
Assignees
Labels
BugReportIssues describing a possible bug in the Go implementation.Issues describing a possible bug in the Go implementation.FixPendingIssues that have a fix which has not yet been reviewed or submitted.Issues that have a fix which has not yet been reviewed or submitted.compiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.