-
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/compile: relocation error when building some programs on linux/amd64 after dev.regabi merge #44330
Comments
Looks like a missing closure -- could this have something to do with the recent changes to the order of closure processing in walk? @mdempsky |
Yeah, that seems plausibly related to the change in closure processing. I don't immediately see any function literals in NewTerm in https://github.com/monsterxx03/gospy/blob/master/pkg/term/term.go though, so I'm not sure where NewTerm.func1 is coming from. I vaguely remember having to deal with some more of these .f issues on dev.typeparams. It would be worthwhile to check if the issue still reproduces on that branch (also, testing both with -gcflags=all=-G=3 and without). Otherwise, minimizing down the failure case would be helpful. |
@mdempsky I bet this issue is the same as many other issues opened recently, which related to inlining of OCLOSURE. If you build the repo with |
@mdempsky also, FYI, |
Here is a more minimal reproduction that still requires a second package, along with a theory about what field is involved.
Building this with git tip produces |
FYI: this stopped working, most probably after https://go-review.googlesource.com/c/go/+/296649/ got merged. |
I can confirm that git tip from commit 9a555fc onward now has this issue again; building either gospy or my test example now fails again. |
(I thought @danscales had been CC'd on this issue already, but it looks like he has not.) |
Yes, I didn't know about this bug, else I wouldn't have checked in 9a555fc without seeing if this issue was fixed. If I can't figure this out by Monday, I'll disable inlining functions with closures again. @siebenmann - in the meantime, you can build using:
Thanks for the repro cases! |
The symptom ("github.com/monsterxx03/gospy/pkg/term.NewTerm.func1·f: relocation target github.com/monsterxx03/gospy/pkg/term.NewTerm.func1 not defined") is the same as a case for our "-G=3" noder where we were missing a call to typecheck.NeedRuntimeType(t) for an anonymous type t. Not sure yet why inlining a function with a closure would cause us to miss a case - maybe some difference about the way we typecheck imported function bodies (which is when we normally call typecheck.NeedRuntimeType). |
OK, I have the simple fix. The issue specifically relates to importing an empty closure. I just need to create the simple test case, then will put the fix out for review. |
Change https://golang.org/cl/297569 mentions this issue: |
What version of Go are you using (
go version
)?This is the current git tip, but the problem happens from commit 8482559 onward (which merges the dev.regabi branch into main).
Does this issue reproduce with the latest release?
No.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
The simplest reproduction is:
(Unfortunately the program doesn't build as a module build with 'go install' due to a 'replace' directive in its go.mod.)
What did you expect to see?
The build works.
What did you see instead?
The text was updated successfully, but these errors were encountered: