-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/link: relocation target memcpy not defined for ABI0 (but is defined for ABI0) #33492
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
Comments
You did use Go 1.12.7, which is the latest release. /cc @cherrymui FYI per owners. |
Can you give precise instructions for how to reproduce the problem? Thanks. |
I compiled a rust archive with rustc and llvm optimization flag When I turned on optimizations If you need a minimal code example, I can put one together. Edit: actually it came back after adding more logic. Not sure what is going on with missing memset, memcpy. |
Yes, please do. |
Here's a reproduction: https://github.com/prestonvanloon/go-issue-33492 It's as minimal as I could make it. |
Hmmm.... Calling into C directly from Go assembly is not a supported mechanism. Use cgo instead. Allocating a large frame in assembly, rewinding the stack frame, then using that empty stack frame as a C stack is doubly not supported. That said, the problem you're running into has nothing to do with that. I'm not sure why you're getting that error. It sounds like the Go linker is somehow trying to link the C code and getting confused by it. Probably not worth digging into it given the above, though. If you switch to using cgo and still run into this problem, feel free to reopen. |
I need to put a flashier disclaimer on https://blog.filippo.io/rustgo. It was an experiment and a learning exercise, not something reproducible. (Your issue though looks like you need to link a libc? Or maybe didn't succeed in making the Rust object no_std? If you want to continue down this path, I'd try forcing the external linker, and then debugging it as you would debug linking anything without the go build toolchain support. But again, this is not supported and it will eventually break and won't be fixed on our side.) |
The main idea here was to avoid the cgo performance overhead, if it were possible. @FiloSottile's article looked promising, albeit a bit dated. I suspected I might hit a dead end here, but wanted to try it anyway. I'll give the cgo approach a try. ~70ns overhead might be tolerable for my use case. Thanks for looking into it. I'll be sure to post a follow up here. |
As a data point, I've hit this same issue in CI. If I find anything reproducable, I'll add it here. This is the error I got:
What makes this especially weird is the following:
Also, this specifically happens with a CI Docker image. |
@aykevl This issue is closed. If you do have a reproducible failure, please open a new issue with details. Thanks. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
I didn't try.1.12.7 is the latest. :)What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Link rust FFI archives with go.
What did you expect to see?
Something more meaningful.
What did you see instead?
relocation target memset not defined for ABI0 (but is defined for ABI0)
relocation target memcpy not defined for ABI0 (but is defined for ABI0)
The text was updated successfully, but these errors were encountered: