cmd/compile: REFLECTMETHOD attribute is not set correctly #44207
Labels
FrozenDueToAge
NeedsFix
The path to resolution is known, but the work has not been done.
release-blocker
Milestone
What version of Go are you using (
go version
)?tip (e9c9683)
Does this issue reproduce with the latest release?
Not in Go 1.15.
What operating system and processor architecture are you using (
go env
)?darwin/amd64
What did you do?
Run this program.
What did you expect to see?
Print 0.
What did you see instead?
Crash.
What happens is that the main function used to (as in Go 1.15) have REFLECTMETHOD attribute set, so the linker knows it and marks all exported methods, but not now.
(tip) vs.
(1.15)
It is because in cmd/compile/internal/gc/walk.go, it only marks reflect.Type.Method/MethodByName as interface calls (i.e. expecting a CALLINTER). But now it devirtualizes to a concrete call (CALLMETH).
(tip) vs.
(1.15)
Without the REFLECTMETHOD attribute set, the linker prunes methods more aggressively. In this case, S.M is discarded.
The text was updated successfully, but these errors were encountered: