Skip to content

x/tools/cmd/guru: extend 'definition' to understand go:linkname and assembly #20050

Closed
@mdempsky

Description

@mdempsky

This is a bit of a ponies request, but it would be really convenient while working on the standard library if "guru definition" could handle go:linkname and assembly. Here's how I would suggest this work:

  1. If definition resolves an identifier to a non-function declaration or a function declaration with a function body, do the same thing as now.
  2. If there's a go:linkname comment in any of the .go files that references the function name, then recursively look for the remote name's definition.
  3. Search the package's .s files for a TEXT declaration that declares the function symbol; if found, return that location.
  4. If the function declaration is within $GOROOT, then apply steps 2 and 3 but searching within package runtime instead.
  5. Else, return the body-less function declaration's position.

The order of steps 2 and 3 aren't critical.

Step 4 is clunky, but necessary for the standard repo. I think outside of the standard library steps 2 and 3 alone should suffice.

/cc @alandonovan

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeatureRequestIssues asking for a new feature that does not need a proposal.ToolsThis label describes issues relating to any tools in the x/tools repository.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions