Skip to content

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

Closed

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.

Activity

  1. davecheney commented on Jan 11, 2018

    @davecheney
    Contributor
  2. crvv commented on Jan 12, 2018

    @crvv
    Contributor

    This looks like a duplicate of #23311

  3. davecheney commented on Jan 12, 2018

    @davecheney
    Contributor

    Closing as answered.

  4. locked and limited conversation to collaborators on Jan 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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