You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
garble/testdata/script/linkname_forbid.txtar

35 lines
753 B
Plaintext

# Disallow certain kinds of runtime linknaming which break with garble.
! exec garble build
cmp stderr build.stderr
[short] stop # no need to verify this with -short
go build
exec ./main
-- build.stderr --
# test/main
garble does not support packages with a //go:linkname to runtime.lastmoduledatap
exit status 1
-- go.mod --
module test/main
go 1.23
-- linkname_runtime.go --
package main
import _ "unsafe"
// Note that it doesn't matter that the struct here is empty,
// as the linknames below only use pointers to it.
type moduledata struct{}
//go:linkname lastmoduledatap runtime.lastmoduledatap
var lastmoduledatap *moduledata
//go:linkname moduledataverify1 runtime.moduledataverify1
func moduledataverify1(_ *moduledata)
func main() {}