aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHiroshi Ioka <hirochachacha@gmail.com>2017-08-17 07:26:07 +0900
committerIan Lance Taylor <iant@golang.org>2017-08-17 01:12:30 +0000
commit064ae118c1b8db9a5704be2529675cdab05109db (patch)
tree20ad689088dc4fe32e0cdc79c64091b9cdd49541 /src
parentf52ce42274573d39386f3bacc77ab2ef969d5a0d (diff)
downloadgo-064ae118c1b8db9a5704be2529675cdab05109db.tar.xz
cmd/link: correct runtime/cgo detection for -linkshared
Current code detect runtime/cgo iff the package or sub packages imports runtime/cgo directly. However, when we are using linkshared, imported shared libraries might have already included runtime/cgo. This CL handles later case by looking an actual runtime/cgo symbol. Change-Id: I35e7dfdb5e1a939eafc95a0259ee1af9782bc864 Reviewed-on: https://go-review.googlesource.com/56310 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src')
-rw-r--r--src/cmd/link/internal/ld/lib.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/cmd/link/internal/ld/lib.go b/src/cmd/link/internal/ld/lib.go
index d906893218..c7f14b3e04 100644
--- a/src/cmd/link/internal/ld/lib.go
+++ b/src/cmd/link/internal/ld/lib.go
@@ -421,7 +421,6 @@ func (ctxt *Link) loadlib() {
var i int
for i = 0; i < len(ctxt.Library); i++ {
- iscgo = iscgo || ctxt.Library[i].Pkg == "runtime/cgo"
if ctxt.Library[i].Shlib == "" {
if ctxt.Debugvlog > 1 {
ctxt.Logf("%5.2f autolib: %s (from %s)\n", Cputime(), ctxt.Library[i].File, ctxt.Library[i].Objref)
@@ -439,6 +438,8 @@ func (ctxt *Link) loadlib() {
}
}
+ iscgo = ctxt.Syms.ROLookup("x_cgo_init", 0) != nil
+
// We now have enough information to determine the link mode.
determineLinkMode(ctxt)