mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/link: disable weak reference in itab if build with "-linkshared"
When build with "-linkshared", we can't tell if the interface method will be used or not. It can be used in shared library. Fixes #47873 Change-Id: Iba12812f199b7679cf2fd41a304268d6d6dd03c6 Reviewed-on: https://go-review.googlesource.com/c/go/+/350189 Reviewed-by: Cherry Mui <cherryyz@google.com> Run-TryBot: Cherry Mui <cherryyz@google.com> TryBot-Result: Go Bot <gobot@golang.org> Trust: Alexander Rakoczy <alex@golang.org>
This commit is contained in:
parent
0454d7346f
commit
f687831e4c
4 changed files with 44 additions and 1 deletions
|
|
@ -134,7 +134,9 @@ func (d *deadcodePass) flood() {
|
|||
methods = methods[:0]
|
||||
for i := 0; i < relocs.Count(); i++ {
|
||||
r := relocs.At(i)
|
||||
if r.Weak() {
|
||||
// When build with "-linkshared", we can't tell if the interface
|
||||
// method in itab will be used or not. Ignore the weak attribute.
|
||||
if r.Weak() && !(d.ctxt.linkShared && d.ldr.IsItab(symIdx)) {
|
||||
continue
|
||||
}
|
||||
t := r.Type()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue