Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/compile: allow body-less functions under -complete flag if they have a //go:linkname attribute #23311

Closed
mdempsky opened this issue Jan 2, 2018 · 1 comment

Comments

@mdempsky
Copy link
Member

@mdempsky mdempsky commented Jan 2, 2018

Currently the -complete flag (which is automatically set by cmd/go for packages without assembly source) disallows function declarations without a body. We should relax this to still allow function declarations without a body as long as they have a //go:linkname attribute.

@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Nov 26, 2018

Change https://golang.org/cl/151318 mentions this issue: cmd/compile: allow bodyless function if it is linkname'd

@gopherbot gopherbot closed this in 7dc5c0f Nov 26, 2018
bradfitz pushed a commit that referenced this issue Nov 26, 2018
In assembly free packages (aka "complete" or "pure go"), allow
bodyless functions if they are linkname'd to something else.

Presumably the thing the function is linkname'd to has a definition.
If not, the linker will complain. And linkname is unsafe, so we expect
users to know what they are doing.

Note this handles only one direction, where the linkname directive
is in the local package. If the linkname directive is in the remote
package, this CL won't help. (See os/signal/sig.s for an example.)

Fixes #23311

Change-Id: I824361b4b582ee05976d94812e5b0e8b0f7a18a6
Reviewed-on: https://go-review.googlesource.com/c/151318
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
@golang golang locked and limited conversation to collaborators Nov 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.