]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/compile: re-compile instantiated generic methods in linkshared mode
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Fri, 17 Mar 2023 17:53:07 +0000 (00:53 +0700)
committerCuong Manh Le <cuong.manhle.vn@gmail.com>
Wed, 22 Mar 2023 04:04:11 +0000 (04:04 +0000)
commitbcd82125f85c7c552493e863fa1bb14e6c444557
treecef5a09e01472340412a52383984546d74432466
parentf17e7e84410aa03988dd2a9c4f446fc2c8d0da23
cmd/compile: re-compile instantiated generic methods in linkshared mode

For G[T] that was seen and compiled in imported package, it is not added
to typecheck.Target.Decls, prevent wasting compile time re-creating
DUPOKS symbols. However, the linker do not support a type symbol
referencing a method symbol across DSO boundary. That causes unreachable
sym error when building under -linkshared mode.

To fix it, always re-compile generic methods in linkshared mode.

Fixes #58966

Change-Id: I894b417cfe8234ae1fe809cc975889345df22cef
Reviewed-on: https://go-review.googlesource.com/c/go/+/477375
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
misc/cgo/testshared/shared_test.go
misc/cgo/testshared/testdata/issue58966/main.go [new file with mode: 0644]
src/cmd/compile/internal/noder/unified.go