diff options
author | Ian Lance Taylor <iant@golang.org> | 2018-06-11 16:46:23 -0700 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2018-08-21 03:42:22 +0000 |
commit | 4d6ae73dfc5f0856e58aca2a892f27b2ab80b148 (patch) | |
tree | 0a8e00ee8de54fb44dd45b6beb84777bb98ec168 | |
parent | dea961ebd9f871b39b3bdaab32f952037f28cd71 (diff) | |
download | go-4d6ae73dfc5f0856e58aca2a892f27b2ab80b148.tar.gz go-4d6ae73dfc5f0856e58aca2a892f27b2ab80b148.zip |
[release-branch.go1.10] cmd/link: treat cgo exported symbols as C symbols
Fixes #25827
Change-Id: I6736c3ac061ca32aac2eb68b01ba53a179d68cf4
Reviewed-on: https://go-review.googlesource.com/118076
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
(cherry picked from commit f861f66d1db9f1abcdf91fc54d0d84bd3f9e9310)
Reviewed-on: https://go-review.googlesource.com/126455
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
-rw-r--r-- | src/cmd/link/internal/ld/pcln.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/cmd/link/internal/ld/pcln.go b/src/cmd/link/internal/ld/pcln.go index 8708924d92..ed1b523b4e 100644 --- a/src/cmd/link/internal/ld/pcln.go +++ b/src/cmd/link/internal/ld/pcln.go @@ -11,6 +11,7 @@ import ( "log" "os" "path/filepath" + "strings" ) // iteration over encoded pcdata tables. @@ -162,13 +163,15 @@ func renumberfiles(ctxt *Link, files []*sym.Symbol, d *sym.Pcdata) { *d = out } -// onlycsymbol reports whether this is a cgo symbol provided by the -// runtime and only used from C code. +// onlycsymbol reports whether this is a symbol that is referenced by C code. func onlycsymbol(s *sym.Symbol) bool { switch s.Name { case "_cgo_topofstack", "_cgo_panic", "crosscall2": return true } + if strings.HasPrefix(s.Name, "_cgoexp_") { + return true + } return false } |