Skip to content

cmd/compile: "missing function body" error when using the //go:linkname compiler directive #23408

@bigfg

Description

@bigfg

For example let's say (hypothetically) that I wanted to call the strhash function defined in the runtime package, I could do:

`package key

import "unsafe"

//go:linkname strhash runtime.strhash
func strhash(a unsafe.Pointer, h uintptr) uintptr

func hash(s string) uintptr {
return strhash(unsafe.Pointer(&s), 0)
}`

this case came from: #15006

actually, I try to fix this with:
flag.BoolVar(&completeFlag, "complete", true, "compiling complete package")

But it doesn't seem to work.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions