mirror of
https://github.com/golang/go
synced 2024-11-26 07:27:59 -07:00
cmd/link: disable plugin support if cgo is disabled
Functional plugin support requires cgo to be enabled. Disable it if the environment has disabled cgo. This prevents unexpected linker failures when linking large binaries with cgo disabled which use the plugin package. Fixes #45564 Change-Id: Ib71f0e089f7373b7b3e3cd53da3612291e7bc473 Reviewed-on: https://go-review.googlesource.com/c/go/+/314449 Run-TryBot: Paul Murphy <murp@ibm.com> Reviewed-by: Cherry Zhang <cherryyz@google.com> TryBot-Result: Go Bot <gobot@golang.org> Trust: Lynn Boger <laboger@linux.vnet.ibm.com>
This commit is contained in:
parent
214c8dd80c
commit
983dea90c1
@ -539,7 +539,10 @@ func (ctxt *Link) loadlib() {
|
|||||||
// up symbol by name may not get expected result.
|
// up symbol by name may not get expected result.
|
||||||
|
|
||||||
iscgo = ctxt.LibraryByPkg["runtime/cgo"] != nil
|
iscgo = ctxt.LibraryByPkg["runtime/cgo"] != nil
|
||||||
ctxt.canUsePlugins = ctxt.LibraryByPkg["plugin"] != nil
|
|
||||||
|
// Plugins a require cgo support to function. Similarly, plugins may require additional
|
||||||
|
// internal linker support on some platforms which may not be implemented.
|
||||||
|
ctxt.canUsePlugins = ctxt.LibraryByPkg["plugin"] != nil && iscgo
|
||||||
|
|
||||||
// We now have enough information to determine the link mode.
|
// We now have enough information to determine the link mode.
|
||||||
determineLinkMode(ctxt)
|
determineLinkMode(ctxt)
|
||||||
|
Loading…
Reference in New Issue
Block a user