]> Cypherpunks repositories - gostls13.git/commit
cmd/link: propagate UsedInIface through method descriptor
authorCherry Zhang <cherryyz@google.com>
Fri, 18 Sep 2020 01:34:52 +0000 (21:34 -0400)
committerCherry Zhang <cherryyz@google.com>
Fri, 18 Sep 2020 14:36:22 +0000 (14:36 +0000)
commit789d77a87e5417c10377a9f9de07ec37c65048f2
treebcb48cc3712b338a89aac72d480521e832d64094
parentbf9800c7931da96e2ddc8363955f43581265b95c
cmd/link: propagate UsedInIface through method descriptor

The linker prunes methods that are not directly reachable if the
receiver type is never converted to interface. A type can be
converted to interface using reflection through other types.
The linker already takes this into consideration but it missed
the case that the intermediate is a method descriptor. Handle
this case.

Change-Id: I590efc5da163c326db8d43583908a2ef67f65d9d
Reviewed-on: https://go-review.googlesource.com/c/go/+/255858
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
src/cmd/link/internal/ld/deadcode.go
src/cmd/link/internal/ld/deadcode_test.go
src/cmd/link/internal/ld/testdata/deadcode/ifacemethod3.go [new file with mode: 0644]