Closed
Description
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:
- If definition resolves an identifier to a non-function declaration or a function declaration with a function body, do the same thing as now.
- 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.
- Search the package's .s files for a TEXT declaration that declares the function symbol; if found, return that location.
- If the function declaration is within $GOROOT, then apply steps 2 and 3 but searching within package runtime instead.
- 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