-
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 target not defined" for constant of instantiated type #51245
Comments
Hm, works fine on my desktop. Maybe something with the playground? |
I can reproduce on my laptop:
|
Ah, |
I think this is DWARF, which is turned off by
Indeed there is no |
Strangely, if I change the constant to
Is the linker making up the |
I think the linker creates DWARF type symbols, from Go type descriptor symbols (e.g. |
I'll take a look.
In our current design the linker manufactures all |
When T is not a generic type, when compiling the main package it emits the type descriptor symbol ( |
Why is the compiler not emitting any "type.*" symbols in this example? If I change the code to
then as part of the assembly output I see
Shouldn't these be there for the generic type as well? |
I can imagine it not getting generated. We might use the type declaration to decide when to output, but for generics it is the instantiations that actually generate the concrete types. |
Change https://go.dev/cl/388117 mentions this issue: |
Compiling the following code:
Yields the following linker error:
https://go.dev/play/p/sR5foIWLFEg?v=gotip
This looks like a valid program to me, so I think this is a bug (at the very least, the error message could be improved).
CC @danscales @randall77 @mdempsky @griesemer
The text was updated successfully, but these errors were encountered: