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: 'relocation target not defined' when building with CL 484859 (since reverted) #59709

Closed
thanm opened this issue Apr 19, 2023 · 3 comments
Assignees
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@thanm
Copy link
Contributor

thanm commented Apr 19, 2023

What version of Go are you using (go version)?

Using tip, plus CL 484859 (since reverted).

$ go version
go version devel go1.21-f8162a0e72 Mon Apr 17 14:52:41 2023 +0000 linux/amd64

Does this issue reproduce with the latest release?

No.

What operating system and processor architecture are you using (go env)?

linux/amd64

What did you do?

Build this program

What did you expect to see?

Clean build

What did you see instead?

$ go build 
# x.y
main.main.func1·f: relocation target main.main.func1 not defined
$ 

Turns out there is a bug in the original CL relating to generic instantiation.

For CL 484859 I placed the call togarbageCollectUnreferencedHiddenClosures here in the body of InlineDecls. This works fine if there are no generics, but InlineDecls also gets called during generic function instantiation here. At that point in the game it is too early to be looking for dead hidden closures, and we wind up marking things dead incorrectly.

@thanm thanm added the NeedsFix The path to resolution is known, but the work has not been done. label Apr 19, 2023
@thanm thanm added this to the Go1.21 milestone Apr 19, 2023
@thanm thanm self-assigned this Apr 19, 2023
@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Apr 19, 2023
@gopherbot
Copy link

Change https://go.dev/cl/486377 mentions this issue: cmd/compile: rework marking of dead hidden closure functions

@gopherbot
Copy link

Change https://go.dev/cl/492016 mentions this issue: cmd/compile: rework marking of dead hidden closure functions

gopherbot pushed a commit that referenced this issue May 5, 2023
[This is a roll-forward of CL 484859, this time including a fix for
issue #59709. The call to do dead function marking was taking place in
the wrong spot, causing it to run more than once if generics were
instantiated.]

This patch generalizes the code in the inliner that marks unreferenced
hidden closure functions as dead. Rather than doing the marking on the
fly (previous approach), this new approach does a single pass at the
end of inlining, which catches more dead functions.

Change-Id: I0e079ad755c21295477201acbd7e1a732a98fffd
Reviewed-on: https://go-review.googlesource.com/c/go/+/492016
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
@thanm
Copy link
Contributor Author

thanm commented May 8, 2023

This is now fixed with latest https://go.dev/cl/486377

@thanm thanm closed this as completed May 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

2 participants