-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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/asm: R15 gets clobbered in plugin mode #43661
Comments
Try adding NOSPLIT to your assembly code. For example,
You probably also need
What I suspect is happening is that depending on stack size (which is why plugin may change things) a stack growth is occurring on entry to your assembly. The stack gets copied (or possibly, a GC gets run), but the arguments to your assembly don't get adjusted (or, if it is the GC, its referents marked). You need either |
Acutally, maybe not. I think you should get pointer maps automatically added, see the docs for |
Thanks for the input, but there was no change using NOSPLIT. |
New theory: you can't use Replacing Let me know if you can get it to work as well. |
Our compiler avoids
|
It's been like this for a while. See #18820. I've got a CL that errors out in the assembler when it detects a bad case. I think waiting until 1.17 is the right plan. |
Change https://golang.org/cl/283474 mentions this issue: |
What version of Go are you using (
go version
)?go version : 1.15.7
( However go version 1.14 and 1.16beta1 also show same error behaviour.)Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?OS: linux x86_64
What did you do?
A bug which occurs only in plugins with assembly code.
The package consists of a bn256 crypto implementation which has amd64 assembly code and also a generic implementation.
The assembly implementation is default and generic implementation can be enabled using the "generic" tag.
The plugin when compiled as a binary runs OK with both assembly and go implementation.
The plugin when compiled as a plugin FAILS with assembly code but runs OK with generic implementation.
TESTING:
However, if the plugin is compiled with generic tag (To disable asm code, the bug doesn't occur), Some register corruption occurs due to wrong code being generated.
go build -buildmode=plugin -tags generic -o /tmp/plugin.so ../compiler_bug/plugin/
Running plugin will not cause an error.
go run runplugin/main.go
Repo to reproduce
https://github.com/DankFC/compile-bug
What did you expect to see?
What did you see instead?
demo.sh is included in the repo to recreate the bug easily.
The text was updated successfully, but these errors were encountered: